Skip to content

Commit 15b90b1

Browse files
committed
Fix hoisting supercall arguments from primary constructor
Fix hoisting of supercall arguments from primary constructor of a class with var parameters. Fixes #11045
1 parent 5672999 commit 15b90b1

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class HoistSuperArgs extends MiniPhase with IdentityDenotTransformer { thisPhase
6767
val constr = cdef.symbol
6868
lazy val origParams = // The parameters that can be accessed in the supercall
6969
if (constr == cls.primaryConstructor)
70-
cls.info.decls.filter(d => d.is(TypeParam) || d.is(ParamAccessor))
70+
cls.info.decls.filter(d => d.is(TypeParam) || d.is(ParamAccessor) && !d.isSetter)
7171
else
7272
allParamSyms(cdef)
7373

tests/pos/i11045.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
abstract class Foo(x: Any)
2+
class Boom(var x: Unit, y: Unit) extends Foo((x: Int) => x)

0 commit comments

Comments
 (0)