Skip to content

Commit f0c3408

Browse files
committed
Fix "supercalls not allowed in inlined code" error logic
1 parent 9d2cec0 commit f0c3408

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,6 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
192192
}
193193
else
194194
transformSelect(tree, Nil)
195-
case tree: Super =>
196-
if (ctx.owner.enclosingMethod.isInlinedMethod)
197-
ctx.error(SuperCallsNotAllowedInline(ctx.owner), tree.pos)
198-
super.transform(tree)
199195
case tree: Apply =>
200196
methPart(tree) match {
201197
case Select(nu: New, nme.CONSTRUCTOR) if isCheckable(nu) =>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,9 @@ class Typer extends Namer
476476
case pt: SelectionProto if pt.name == nme.CONSTRUCTOR => true
477477
case _ => false
478478
}
479+
val enclosingInlineable = ctx.owner.ownersIterator.findSymbol(_.isInlineableMethod)
480+
if (enclosingInlineable.exists && !Inliner.isLocal(qual1.symbol, enclosingInlineable))
481+
ctx.error(SuperCallsNotAllowedInline(enclosingInlineable), tree.pos)
479482
pt match {
480483
case pt: SelectionProto if pt.name.isTypeName =>
481484
qual1 // don't do super references for types; they are meaningless anyway

0 commit comments

Comments
 (0)