diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/files/pos/t2305.scala | 26 | ||||
-rw-r--r-- | test/files/pos/t2454.scala | 25 |
2 files changed, 51 insertions, 0 deletions
diff --git a/test/files/pos/t2305.scala b/test/files/pos/t2305.scala new file mode 100644 index 0000000000..8b5abccbe0 --- /dev/null +++ b/test/files/pos/t2305.scala @@ -0,0 +1,26 @@ +import java.util.ArrayList + +trait Bind[Z[_]] + +class MySerializable[X] extends java.io.Serializable + +object Bind { + implicit val JavaArrayListBind: Bind[ArrayList] = new Bind[ArrayList] {} + implicit val MySerializableBind: Bind[MySerializable] = new Bind[MySerializable] {} +} + +object works { + // this works fine: + def runbind(implicit bind: Bind[MySerializable]) {} + runbind +} + +object breaks { + def runbind(implicit bind: Bind[ArrayList]) {} + runbind + /*java.lang.AssertionError: assertion failed: java.io.Serializable + at scala.Predef$.assert(Predef.scala:107) + at scala.tools.nsc.symtab.Types$TypeRef.transform(Types.scala:1417) + at scala.tools.nsc.symtab.Types$TypeRef.baseType(Types.scala:1559) + */ +} diff --git a/test/files/pos/t2454.scala b/test/files/pos/t2454.scala new file mode 100644 index 0000000000..00f2e6f677 --- /dev/null +++ b/test/files/pos/t2454.scala @@ -0,0 +1,25 @@ +package am; + +trait One[M[_]] { + val x : Int +} + +trait Two[M[_,_]] { + val x : Int +} + +object Test { + // Works. + val x = new Two[Map] { + val x = 5 + } + + val o = new One[java.util.List] { + val x = 1 + } + + // Does not work + val y = new Two[java.util.concurrent.ConcurrentHashMap] { + val x = 3 + } +} |