Skip to content

Commit ee9d929

Browse files
authored
check for primary constructor in namePresentInSource (#18325)
fixes #18319 note that we still do not produce occurrences for the primary constructor's own parameters, it seems in scala 2 implementation only the local backing field has occurrences.
2 parents 4dc1671 + 7ee5bb2 commit ee9d929

File tree

2 files changed

+191
-50
lines changed

2 files changed

+191
-50
lines changed

compiler/src/dotty/tools/dotc/semanticdb/Scala3.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ object Scala3:
4747
// for secondary constructors `this`
4848
desig match
4949
case sym: Symbol =>
50-
if sym.isConstructor && nameInSource == nme.THISkw.toString then
50+
if sym.isConstructor
51+
&& (sym.isPrimaryConstructor || nameInSource == nme.THISkw.toString) then
5152
true
5253
else
5354
val target =

0 commit comments

Comments
 (0)