-
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.
Merge pull request #4122 from dotty-staging/fix-#4098
Fix #4098: Check that refinements have good bounds
- Loading branch information
Showing
4 changed files
with
77 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
object App { | ||
import scala.reflect.Selectable.reflectiveSelectable | ||
|
||
def coerce[U, V](u: U): V = { | ||
type X = { type R >: U } | ||
type Y = { type R = V } | ||
type Z = X & Y | ||
val u1: Z#R = u // error: not a legal path | ||
u1 | ||
} | ||
|
||
def main(args: Array[String]): Unit = { | ||
val x: Int = coerce[String, Int]("a") | ||
println(x + 1) | ||
} | ||
} |
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,16 @@ | ||
object App { | ||
import scala.reflect.Selectable.reflectiveSelectable | ||
|
||
def coerce[U, V](u: U): V = { | ||
type X = { val x: { type R >: U } } | ||
type Y = { val x: { type R = V } } | ||
lazy val z: X & Y = z | ||
val u1: z.x.R = u // error: Object { type R >: U | V <: V } is not stable (with arrows under z.x) | ||
u1 | ||
} | ||
|
||
def main(args: Array[String]): Unit = { | ||
val x: Int = coerce[String, Int]("a") | ||
println(x + 1) | ||
} | ||
} |