File tree Expand file tree Collapse file tree 3 files changed +7
-10
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 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
192192 }
193193 else
194194 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)
199195 case tree : Apply =>
200196 methPart(tree) match {
201197 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 {
8888 sym != inlineMethod &&
8989 (! sym.is(Param ) || sym.owner != inlineMethod)
9090
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)
9596
9697 /** Register inline info for given inline method `sym`.
9798 *
Original file line number Diff line number Diff line change @@ -475,8 +475,8 @@ class Typer extends Namer
475475 case pt : SelectionProto if pt.name == nme.CONSTRUCTOR => true
476476 case _ => false
477477 }
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)
480480 pt match {
481481 case pt : SelectionProto if pt.name.isTypeName =>
482482 qual1 // don't do super references for types; they are meaningless anyway
You can’t perform that action at this time.
0 commit comments