Skip to content

Commit 2136fc1

Browse files
authored
Merge pull request #4516 from dotty-staging/fix/4498
Fix #4498: Go to definition in lifted expressions
2 parents 8b0defa + 361b5b2 commit 2136fc1

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ abstract class Lifter {
4949
var liftedType = fullyDefinedType(expr.tpe.widen, "lifted expression", expr.pos)
5050
if (liftedFlags.is(Method)) liftedType = ExprType(liftedType)
5151
val lifted = ctx.newSymbol(ctx.owner, name, liftedFlags, liftedType, coord = positionCoord(expr.pos))
52-
defs += liftedDef(lifted, expr).withPos(expr.pos.focus)
53-
ref(lifted.termRef).withPos(expr.pos)
52+
defs += liftedDef(lifted, expr).withPos(expr.pos)
53+
ref(lifted.termRef).withPos(expr.pos.focus)
5454
}
5555

5656
/** Lift out common part of lhs tree taking part in an operator assignment such as

language-server/test/dotty/tools/languageserver/DefinitionTest.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,11 @@ class DefinitionTest {
3636
.definition(m5 to m6, List(m1 to m2))
3737
}
3838

39+
@Test def liftedExpression: Unit = {
40+
withSources(
41+
code"class ${m1}A${m2}",
42+
code"object B { val lst = new ${m3}A${m4} :: Nil }"
43+
).definition(m3 to m4, List(m1 to m2))
44+
}
45+
3946
}

0 commit comments

Comments
 (0)