You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
&&!(cls.symbol.asClass.ownersIterator.toList.tail.exists(p => p.isInlineTrait)) // We can skip anything that would be inlined into a class that lives somewhere inside an inline trait
140
-
// because it must be on the RHS of a member definition in the inline trait and so pruned out later
140
+
// because it must be on the RHS of a member definition in the inline trait and so pruned out later
141
141
)
142
142
143
143
ancestors.flatMap(ancestor =>
@@ -151,7 +151,7 @@ object Inlines:
151
151
report.error(s"unknown base type ${baseTpe.show} for ancestor ${ancestor.show} of ${cls.symbol.show}")
caseSpecialization(spec) if spec.hasSpecializedParams &&!spec.isFullySpecialized =>None// these can only exist in cases where we don't want to inline because:
157
157
// 1) they will be pruned out later anyway and if we inline them we will create a loop (as in tests/pos/specialized-trait-inlining-causes-implementation-required-loop-bad.scala)
if cls.symbol.isAnonymousClass && ancestors.exists(tree =>Specialization.unapply(tree.tpe).exists(anc => anc.isSpecialized || anc.isFullySpecializedToTopClassesOrNothing)) then
367
367
// No need to inline into specialized trait anonymous class instances; these will later be replaced by $impl$ classes.
368
368
return cls
369
-
369
+
370
370
valcycleFound= ancestors.exists { parent =>
371
371
valparentSym= symbolFromParent(parent)
372
-
valerrorPos=
372
+
valerrorPos=
373
373
// Trying to inline into the tree which defines parentSym (need to catch this separately
374
-
// as need to catch it before we inline the second time to avoid tripping an assertion)
374
+
// as need to catch it before we inline the second time to avoid tripping an assertion)
375
375
if cls.symbol.ownersIterator.contains(parentSym) then
376
-
Some(cls.srcPos)
377
-
elseif ctx.inlineTraitState.inlineOrigins(cls.symbol).contains(parentSym) then
376
+
Some(cls.srcPos)
377
+
elseif ctx.inlineTraitState.inlineOrigins(cls.symbol).contains(parentSym) then
378
378
// Select the user code that caused this error so we get two errors if there are two problematic inlines, not one
379
-
valuserPos= tpd.enclosingInlineds.last.srcPos
379
+
valuserPos= tpd.enclosingInlineds.last.srcPos
380
380
// Trying to inline into the inlined body of parentSym not in the defn tree
381
-
Some(userPos)
381
+
Some(userPos)
382
382
elseNone// Fine
383
-
383
+
384
384
errorPos.foreach(pos =>
385
385
report.error(s"Inlining of inline traits looped. Tried to inline ${parentSym} into its own body.", pos)
do report.error(s"Inlining of inline trait created name conflict on ${pacc.denot.name}. Constructor parameters of inline receivers may not collide with members of inline traits.", pacc.srcPos)
417
-
416
+
do report.error(s"Inlining of inline trait created name conflict on ${pacc.denot.name}. Constructor parameters of inline receivers may not collide with members of inline traits.", pacc.srcPos)
417
+
418
418
valimpl1= cpy.Template(impl)(body = newbody)
419
419
420
420
cpy.TypeDef(cls)(rhs = impl1)
@@ -720,7 +720,7 @@ object Inlines:
720
720
/** The Inlined node representing the inlined call */
721
721
defexpand(rhsToInline: Tree):Tree=
722
722
723
-
// Special handling of `requireConst`and `codeOf`
723
+
// Special handling of `requireConst`, `codeOf`, and `magic.Ok`
724
724
callValueArgss match
725
725
case (arg ::Nil) ::Nil=>
726
726
if inlinedMethod == defn.Compiletime_requireConstthen
0 commit comments