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
368
368
// No need to inline into specialized trait anonymous class instances; these will later be replaced by $impl$ classes.
369
369
return cls
370
-
370
+
371
371
valcycleFound= ancestors.exists { parent =>
372
372
valparentSym= symbolFromParent(parent)
373
-
valerrorPos=
373
+
valerrorPos=
374
374
// Trying to inline into the tree which defines parentSym (need to catch this separately
375
-
// as need to catch it before we inline the second time to avoid tripping an assertion)
375
+
// as need to catch it before we inline the second time to avoid tripping an assertion)
376
376
if cls.symbol.ownersIterator.contains(parentSym) then
377
-
Some(cls.srcPos)
378
-
elseif ctx.inlineTraitState.inlineOrigins(cls.symbol).contains(parentSym) then
377
+
Some(cls.srcPos)
378
+
elseif ctx.inlineTraitState.inlineOrigins(cls.symbol).contains(parentSym) then
379
379
// Select the user code that caused this error so we get two errors if there are two problematic inlines, not one
380
-
valuserPos= tpd.enclosingInlineds.last.srcPos
380
+
valuserPos= tpd.enclosingInlineds.last.srcPos
381
381
// Trying to inline into the inlined body of parentSym not in the defn tree
382
-
Some(userPos)
382
+
Some(userPos)
383
383
elseNone// Fine
384
-
384
+
385
385
errorPos.foreach(pos =>
386
386
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)
418
-
417
+
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)
418
+
419
419
valimpl1= cpy.Template(impl)(body = newbody)
420
420
421
421
cpy.TypeDef(cls)(rhs = impl1)
@@ -721,7 +721,7 @@ object Inlines:
721
721
/** The Inlined node representing the inlined call */
722
722
defexpand(rhsToInline: Tree):Tree=
723
723
724
-
// Special handling of `requireConst`and `codeOf`
724
+
// Special handling of `requireConst`, `codeOf`, and `Ok`
725
725
callValueArgss match
726
726
case (arg ::Nil) ::Nil=>
727
727
if inlinedMethod == defn.Compiletime_requireConstthen
0 commit comments