-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle type member extractors as specced match types.
- Loading branch information
Showing
7 changed files
with
115 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
// scalac: -Yno-legacy-match-types:false | ||
|
||
import scala.util.Try | ||
|
||
trait RDF: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
trait TC[T] | ||
|
||
object TC { | ||
def optionTCForPart[T](implicit tc: TC[ExtractPart[T]]): TC[Option[ExtractPart[T]]] = new TC[Option[ExtractPart[T]]] {} | ||
} | ||
|
||
trait ThingWithPart { | ||
type Part | ||
} | ||
|
||
type ExtractPart[T] = T match { | ||
case PartField[t] => t | ||
} | ||
type PartField[T] = ThingWithPart { type Part = T } | ||
|
||
class ValuePartHolder extends ThingWithPart { | ||
type Part = Value | ||
} | ||
|
||
class Value | ||
object Value { | ||
implicit val tcValue: TC[Value] = new {} | ||
} | ||
|
||
@main def main(): Unit = { | ||
// import Value.tcValue // explicit import works around the issue, but shouldn't be necessary | ||
val tc = TC.optionTCForPart[ValuePartHolder] | ||
println(tc) | ||
} |