-
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.
Unstable types can still be realizable (i.e. if their underlying type is concrete with no bad bounds).
- Loading branch information
Showing
6 changed files
with
57 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
class C { type T } | ||
|
||
class Test { | ||
|
||
type D <: C | ||
|
||
lazy val a: C = ??? | ||
final lazy val b: C = ??? | ||
val c: D = ??? | ||
final lazy val d: D = ??? | ||
|
||
val x1: a.T = ??? // error: not a legal path, since a is lazy & non-final | ||
val x2: b.T = ??? // OK, b is lazy but concrete | ||
val x3: c.T = ??? // OK, c is abstract but strict | ||
val x4: d.T = ??? // error: not a legal path since d is abstract and lazy | ||
|
||
val y1: Singleton = a | ||
val y2: Singleton = a | ||
val y3: Singleton = a | ||
val y4: Singleton = a | ||
|
||
} |
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,8 @@ | ||
object App { | ||
trait A { type L >: Any} | ||
def upcast(a: A, x: Any): a.L = x | ||
lazy val p: A { type L <: Nothing } = p | ||
val q = new A { type L = Any } | ||
def coerce1(x: Any): Any = upcast(q, x) // ok | ||
def coerce3(x: Any): Any = upcast(p, x) // ok, since dependent result type is not needed | ||
} |