diff --git a/mtags/src/main/scala-2/scala/meta/internal/pc/MetalsGlobal.scala b/mtags/src/main/scala-2/scala/meta/internal/pc/MetalsGlobal.scala index be19ca4d20b..242da2b9761 100644 --- a/mtags/src/main/scala-2/scala/meta/internal/pc/MetalsGlobal.scala +++ b/mtags/src/main/scala-2/scala/meta/internal/pc/MetalsGlobal.scala @@ -282,11 +282,13 @@ class MetalsGlobal( val result = tpe match { case TypeRef(pre, sym, args) => def shortSymbol = { + // workaround for Tuple1 (which is incorrectly printed by Scala 2 compiler) + def isTuple1 = sym == definitions.TupleClass(1) /* If it's an alias type we want to prevent dealiasing it AnyRef should stay to be dropped if neded later on since it's not an important class. */ - if (sym.isAliasType && sym != definitions.AnyRefClass) + if ((sym.isAliasType && sym != definitions.AnyRefClass) || isTuple1) backtickify(sym.newErrorSymbol(sym.name).updateInfo(sym.info)) else backtickify(sym) } diff --git a/tests/cross/src/test/scala/tests/pc/InsertInferredTypeSuite.scala b/tests/cross/src/test/scala/tests/pc/InsertInferredTypeSuite.scala index c9913f6d8ba..90d0a597826 100644 --- a/tests/cross/src/test/scala/tests/pc/InsertInferredTypeSuite.scala +++ b/tests/cross/src/test/scala/tests/pc/InsertInferredTypeSuite.scala @@ -884,6 +884,18 @@ class InsertInferredTypeSuite extends BaseCodeActionSuite { |""".stripMargin, ) + checkEdit( + "tuple1", + """|object A { + | val <> = List.empty[Tuple1[Int]] + |} + |""".stripMargin, + """|object A { + | val v: List[Tuple1[Int]] = List.empty[Tuple1[Int]] + |} + |""".stripMargin, + ) + def checkEdit( name: TestOptions, original: String,