forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix scala#4060 by marking ghost symbols as unstable
- Loading branch information
1 parent
e531634
commit 5221b80
Showing
7 changed files
with
57 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Could become a run test if we had totality checking for erased arguments | ||
|
||
object Test { | ||
|
||
def main(args: Array[String]): Unit = { | ||
println(fun(new Bar)) | ||
} | ||
|
||
def fun(erased foo: Foo): foo.X = { // error | ||
null.asInstanceOf[foo.X] // error | ||
} | ||
|
||
def fun2(erased foo: Foo)(erased bar: foo.B): bar.X = { // error // error | ||
null.asInstanceOf[bar.X] // error | ||
} | ||
} | ||
|
||
class Foo { | ||
type X | ||
type B <: Bar | ||
} | ||
|
||
class Bar extends Foo { | ||
type X = String | ||
} |
8 changes: 5 additions & 3 deletions
8
tests/pos/erased-pathdep-1.scala → tests/neg/erased-pathdep-1.scala
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
6 changes: 4 additions & 2 deletions
6
tests/pos/erased-pathdep-2.scala → tests/neg/erased-pathdep-2.scala
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 X { type R } | ||
class T(erased val a: X)(val value: a.R) // error | ||
|
||
object App { | ||
def coerce[U, V](u: U): V = { | ||
trait X { type R >: U } | ||
trait Y { type R = V } | ||
|
||
class T[A <: X](erased val a: A)(val value: a.R) // error | ||
|
||
object O { lazy val x : Y & X = ??? } // warning | ||
|
||
val a = new T[Y & X](O.x)(u) | ||
a.value | ||
} | ||
|
||
def main(args: Array[String]): Unit = { | ||
val x: Int = coerce[String, Int]("a") | ||
println(x + 1) | ||
|
||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.