diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 2 | ||||
-rw-r--r-- | src/library/scala/collection/immutable/List.scala | 2 | ||||
-rw-r--r-- | test/files/pos/t4336.scala | 19 |
3 files changed, 21 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 770b55d6ab..d3ff331f98 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -793,7 +793,7 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser { val tree0 = etaExpand(context.unit, tree) // println("eta "+tree+" ---> "+tree0+":"+tree0.tpe+" undet: "+context.undetparams+ " mode: "+Integer.toHexString(mode)) - if (meth.typeParams.nonEmpty) { + if (context.undetparams.nonEmpty) { // #2624: need to infer type arguments for eta expansion of a polymorphic method // context.undetparams contains clones of meth.typeParams (fresh ones were generated in etaExpand) // need to run typer on tree0, since etaExpansion sets the tpe's of its subtrees to null diff --git a/src/library/scala/collection/immutable/List.scala b/src/library/scala/collection/immutable/List.scala index f789de9fac..5f3f9b717f 100644 --- a/src/library/scala/collection/immutable/List.scala +++ b/src/library/scala/collection/immutable/List.scala @@ -620,7 +620,7 @@ object List extends SeqFactory[List] { } /** Only used for list serialization */ -@SerialVersionUID(0L - 8476791151975527571L) +@SerialVersionUID(0L - 8287891243975527522L) private[scala] case object ListSerializeStart /** Only used for list serialization */ diff --git a/test/files/pos/t4336.scala b/test/files/pos/t4336.scala new file mode 100644 index 0000000000..e10d001585 --- /dev/null +++ b/test/files/pos/t4336.scala @@ -0,0 +1,19 @@ +object Main { + class NonGeneric {} + class Generic[T] {} + + class Composite { + def contains(setup : Composite => Unit) : Composite = this + } + + def generic[T](parent: Composite): Generic[T] = new Generic[T] + def nonGeneric(parent: Composite): NonGeneric = new NonGeneric + + new Composite().contains( + nonGeneric // should have type Composite => NonGeneric + ) + + new Composite().contains( + generic[Int] // should have type Composite => Generic[Int] + ) +} |