Skip to content

Commit

Permalink
Test for inference ticket (#8544)
Browse files Browse the repository at this point in the history
Test for inference ticket
  • Loading branch information
lrytz committed Nov 18, 2019
2 parents 41e9827 + 6b6a685 commit 9ef8fc3
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/files/pos/t1479.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
class A {
class C
class Inf[X<:C](x: X)
def f[X<:C](x: X) = ()
}

object Test extends A {
val c: C = new C
f(c)
new Inf(c)
}

/*
snips $ ~/scala-2.13.0-M2/bin/scalac -d /tmp t1479.scala
t1479.scala:10: error: inferred type arguments [Test.C] do not conform to class Inf's type parameter bounds [X <: A.this.C]
new Inf(c)
^
t1479.scala:10: error: type mismatch;
found : Test.C
required: X
new Inf(c)
^
two errors found
snips $ ~/scala-2.13.0-M3/bin/scalac -d /tmp t1479.scala
t1479.scala:10: error: type mismatch;
found : Test.C
required: A.this.C
new Inf(c)
^
one error found
snips $ ~/scala-2.13.0-M5/bin/scalac -d /tmp t1479.scala
*/

0 comments on commit 9ef8fc3

Please sign in to comment.