diff --git a/compiler/src/dotty/tools/dotc/ast/Desugar.scala b/compiler/src/dotty/tools/dotc/ast/Desugar.scala index 961d63814c7b..3d0dd4ac5390 100644 --- a/compiler/src/dotty/tools/dotc/ast/Desugar.scala +++ b/compiler/src/dotty/tools/dotc/ast/Desugar.scala @@ -1440,7 +1440,7 @@ object desugar { val buf = new ListBuffer[VarInfo] def seenName(name: Name) = buf exists (_._1.name == name) def add(named: NameTree, t: Tree): Unit = - if (!seenName(named.name)) buf += ((named, t)) + if (!seenName(named.name) && named.name.isTermName) buf += ((named, t)) def collect(tree: Tree): Unit = tree match { case Bind(nme.WILDCARD, tree1) => collect(tree1) diff --git a/tests/neg/i4453.scala b/tests/neg/i4453.scala new file mode 100644 index 000000000000..cc339f83b35b --- /dev/null +++ b/tests/neg/i4453.scala @@ -0,0 +1,2 @@ +class x0 { var x0 == _ * // error: _* can be used only for last argument // error: == cannot be used as an extractor in a pattern because it lacks an unapply or unapplySeq method +// error '=' expected, but eof found \ No newline at end of file