File tree 3 files changed +7
-10
lines changed
compiler/src/dotty/tools/dotc
3 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -192,10 +192,6 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
192
192
}
193
193
else
194
194
transformSelect(tree, Nil )
195
- case tree : Super =>
196
- if (ctx.owner.enclosingMethod.isInlineMethod)
197
- ctx.error(SuperCallsNotAllowedInline (ctx.owner), tree.pos)
198
- super .transform(tree)
199
195
case tree : Apply =>
200
196
methPart(tree) match {
201
197
case Select (nu : New , nme.CONSTRUCTOR ) if isCheckable(nu) =>
Original file line number Diff line number Diff line change @@ -88,10 +88,11 @@ object Inliner {
88
88
sym != inlineMethod &&
89
89
(! sym.is(Param ) || sym.owner != inlineMethod)
90
90
91
- def isExternalReference (sym : Symbol )(implicit ctx : Context ): Boolean = {
92
- val inlineMethod = ctx.owner.ownersIterator.findSymbol(_.isInlineMethod)
93
- sym.exists && ! isLocal(sym, inlineMethod)
94
- }
91
+ def enclosingInlineMethod (implicit ctx : Context ) =
92
+ ctx.owner.ownersIterator.findSymbol(_.isInlineMethod)
93
+
94
+ def isExternalReference (sym : Symbol )(implicit ctx : Context ): Boolean =
95
+ ctx.mode.is(Mode .BodyOfInlined ) && sym.exists && ! isLocal(sym, enclosingInlineMethod)
95
96
96
97
/** Register inline info for given inline method `sym`.
97
98
*
Original file line number Diff line number Diff line change @@ -475,8 +475,8 @@ class Typer extends Namer
475
475
case pt : SelectionProto if pt.name == nme.CONSTRUCTOR => true
476
476
case _ => false
477
477
}
478
- if (ctx.mode.is( Mode . BodyOfInlined ) && Inliner .isExternalReference(qual1.symbol))
479
- ctx.error(em " illegal super call in inlined method " , tree.pos)
478
+ if (Inliner .isExternalReference(qual1.symbol))
479
+ ctx.error(SuperCallsNotAllowedInline ( Inliner .enclosingInlineMethod) , tree.pos)
480
480
pt match {
481
481
case pt : SelectionProto if pt.name.isTypeName =>
482
482
qual1 // don't do super references for types; they are meaningless anyway
You can’t perform that action at this time.
0 commit comments