From c1643b1801d204fefa58be40f477e9d68f2d3771 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sun, 31 Dec 2017 15:50:25 +0100 Subject: [PATCH] Fix #3630: Handle classtag searches with wildcard arguments --- compiler/src/dotty/tools/dotc/core/TypeErasure.scala | 1 + compiler/src/dotty/tools/dotc/typer/Implicits.scala | 2 +- tests/neg/i3630.scala | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 tests/neg/i3630.scala diff --git a/compiler/src/dotty/tools/dotc/core/TypeErasure.scala b/compiler/src/dotty/tools/dotc/core/TypeErasure.scala index b62327f8b103..321ef835ae78 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeErasure.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeErasure.scala @@ -320,6 +320,7 @@ object TypeErasure { case _ => false } case tp: TypeParamRef => false + case tp: TypeBounds => false case tp: TypeProxy => hasStableErasure(tp.superType) case tp: AndOrType => hasStableErasure(tp.tp1) && hasStableErasure(tp.tp2) case _ => false diff --git a/compiler/src/dotty/tools/dotc/typer/Implicits.scala b/compiler/src/dotty/tools/dotc/typer/Implicits.scala index d35852a2b2e8..07377aea17a5 100644 --- a/compiler/src/dotty/tools/dotc/typer/Implicits.scala +++ b/compiler/src/dotty/tools/dotc/typer/Implicits.scala @@ -564,7 +564,7 @@ trait Implicits { self: Typer => * synthesize a class tag for `T`. */ def synthesizedClassTag(formal: Type)(implicit ctx: Context): Tree = - formal.argTypes match { + formal.argInfos match { case arg :: Nil => fullyDefinedType(arg, "ClassTag argument", pos) match { case defn.ArrayOf(elemTp) => diff --git a/tests/neg/i3630.scala b/tests/neg/i3630.scala new file mode 100644 index 000000000000..2ca36cdffc16 --- /dev/null +++ b/tests/neg/i3630.scala @@ -0,0 +1 @@ +class U { Array(Array(2), Array("a")) } // error: no classtag