Skip to content

Commit f3a6cdc

Browse files
authored
Merge pull request #9308 from dotty-staging/fix-#9307
Fix #9307: Handle `_` without a symbol
2 parents 8533942 + 8a00e72 commit f3a6cdc

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

compiler/src/dotty/tools/dotc/transform/Constructors.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ class Constructors extends MiniPhase with IdentityDenotTransformer { thisPhase =
149149
case Ident(_) | Select(This(_), _) =>
150150
var sym = tree.symbol
151151
if (sym.is(ParamAccessor, butNot = Mutable)) sym = sym.subst(accessors, paramSyms)
152-
if (sym.owner.isConstructor) ref(sym).withSpan(tree.span) else tree
152+
if (sym.maybeOwner.isConstructor) ref(sym).withSpan(tree.span) else tree
153153
case Apply(fn, Nil) =>
154154
val fn1 = transform(fn)
155155
if ((fn1 ne fn) && fn1.symbol.is(Param) && fn1.symbol.owner.isPrimaryConstructor)

tests/pos/i9307.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class Foo:
2+
private var foo1: Int = _
3+
private var foo2: Array[Int] = _
4+
private[this] var foo3: Array[Int] = _
5+
private var foo4: Array[Object] = _
6+
private var foo5: Array[Array[Int]] = _
7+
private var foo6: List[Int] = _

0 commit comments

Comments
 (0)