File tree 2 files changed +8
-26
lines changed
2 files changed +8
-26
lines changed Original file line number Diff line number Diff line change 1
1
// See https://github.com/lampepfl/dotty/issues/4060#issuecomment-445808377
2
- import scala .language .experimental .erasedDefinitions
3
2
4
3
object App {
5
4
trait A { type L >: Any }
6
- // def upcast(a: A, x: Any): a.L = x
7
5
def upcast (erased a : A )(x : Any ): a.L = x
8
- // lazy val p: A { type L <: Nothing } = p
9
- erased val p : A { type L <: Nothing } = p // error
6
+ erased val p : A { type L <: Nothing } = p
10
7
def coerce (x : Any ): Int = upcast(p)(x) // error
11
8
12
9
def coerceInline (x : Any ): Int = upcast(compiletime.erasedValue[A {type L <: Nothing }])(x) // error
13
10
11
+ trait B { type L <: Nothing }
12
+ def upcast_dep_parameter (erased a : B )(x : a.L ) : Int = x
13
+ erased val q : B { type L >: Any } = compiletime.erasedValue
14
+
15
+ def coerceInlineWithB (x : Any ): Int = upcast_dep_parameter(q)(x) // error
16
+
14
17
def main (args : Array [String ]): Unit = {
15
18
println(coerce(" Uh oh!" ))
19
+ println(coerceInlineWithB(" Uh oh!" ))
16
20
}
17
21
}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments