-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test for inference ticket
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 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
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 | ||
*/ |