diff --git a/compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala b/compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala index 2f39b07aa998..80dec10a5c6a 100644 --- a/compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala +++ b/compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala @@ -49,8 +49,8 @@ abstract class Lifter { var liftedType = fullyDefinedType(expr.tpe.widen, "lifted expression", expr.pos) if (liftedFlags.is(Method)) liftedType = ExprType(liftedType) val lifted = ctx.newSymbol(ctx.owner, name, liftedFlags, liftedType, coord = positionCoord(expr.pos)) - defs += liftedDef(lifted, expr).withPos(expr.pos.focus) - ref(lifted.termRef).withPos(expr.pos) + defs += liftedDef(lifted, expr).withPos(expr.pos) + ref(lifted.termRef).withPos(expr.pos.focus) } /** Lift out common part of lhs tree taking part in an operator assignment such as diff --git a/language-server/test/dotty/tools/languageserver/DefinitionTest.scala b/language-server/test/dotty/tools/languageserver/DefinitionTest.scala index cf18ea0914b8..a95efe2258f9 100644 --- a/language-server/test/dotty/tools/languageserver/DefinitionTest.scala +++ b/language-server/test/dotty/tools/languageserver/DefinitionTest.scala @@ -36,4 +36,11 @@ class DefinitionTest { .definition(m5 to m6, List(m1 to m2)) } + @Test def liftedExpression: Unit = { + withSources( + code"class ${m1}A${m2}", + code"object B { val lst = new ${m3}A${m4} :: Nil }" + ).definition(m3 to m4, List(m1 to m2)) + } + }