Skip to content

Commit c6f82c0

Browse files
committed
Add parameter-only dependency case
1 parent 872ce9c commit c6f82c0

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tests/neg-custom-args/erased/i4060.scala

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,20 @@ import scala.language.experimental.erasedDefinitions
33

44
object App {
55
trait A { type L >: Any}
6-
//def upcast(a: A, x: Any): a.L = x
76
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
7+
erased val p: A { type L <: Nothing } = p
108
def coerce(x: Any): Int = upcast(p)(x) // error
119

1210
def coerceInline(x: Any): Int = upcast(compiletime.erasedValue[A {type L <: Nothing}])(x) // error
1311

12+
trait B { type L <: Nothing }
13+
def upcast_dep_parameter(erased a: B)(x: a.L) : Int = x
14+
erased val q : B { type L >: Any } = compiletime.erasedValue
15+
16+
def coerceInlineWithB(x: Any): Int = upcast_dep_parameter(q)(x) // error
17+
1418
def main(args: Array[String]): Unit = {
1519
println(coerce("Uh oh!"))
20+
println(coerceInlineWithB("Uh oh!"))
1621
}
1722
}

0 commit comments

Comments
 (0)