Skip to content

Commit 49e18fd

Browse files
committed
Fix position of class parents
Previously, the position of class parents was the position of the whole class, which means that NavigateAST#pathTo always returned the class parents when looking up a position in the body of the class. Fixed by using the position of the name of the class instead.
1 parent f24190d commit 49e18fd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1312,7 +1312,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
13121312

13131313
completeAnnotations(cdef, cls)
13141314
val constr1 = typed(constr).asInstanceOf[DefDef]
1315-
val parentsWithClass = ensureFirstIsClass(parents mapconserve typedParent, cdef.pos.toSynthetic)
1315+
val parentsWithClass = ensureFirstIsClass(parents mapconserve typedParent, cdef.namePos)
13161316
val parents1 = ensureConstrCall(cls, parentsWithClass)(superCtx)
13171317
val self1 = typed(self)(ctx.outer).asInstanceOf[ValDef] // outer context where class members are not visible
13181318
val dummy = localDummy(cls, impl)

0 commit comments

Comments
 (0)