Skip to content

Commit 9ce0409

Browse files
committed
Remove remaining bits from untyped inliner
1 parent 3102abc commit 9ce0409

File tree

5 files changed

+11
-33
lines changed

5 files changed

+11
-33
lines changed

compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,8 +656,7 @@ class TreePickler(pickler: TastyPickler) {
656656
// Such annotations will be reconstituted when unpickling the child class.
657657
// See tests/pickling/i3149.scala
658658
case _ =>
659-
if (Inliner.typedInline) ann.symbol == defn.BodyAnnot // inline bodies are reconstituted automatically when unpickling
660-
else false
659+
ann.symbol == defn.BodyAnnot // inline bodies are reconstituted automatically when unpickling
661660
}
662661

663662
def pickleAnnotation(owner: Symbol, ann: Annotation)(implicit ctx: Context): Unit =

compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import core.quoted.PickledQuotes
2222
import scala.quoted
2323
import scala.quoted.Types.TreeType
2424
import scala.quoted.Exprs.TastyTreeExpr
25-
import typer.Inliner.typedInline
2625

2726
import scala.annotation.internal.sharable
2827

@@ -555,7 +554,7 @@ class TreeUnpickler(reader: TastyReader,
555554
sym.completer.withDecls(newScope)
556555
forkAt(templateStart).indexTemplateParams()(localContext(sym))
557556
}
558-
else if (typedInline && sym.isInlineMethod)
557+
else if (sym.isInlineMethod)
559558
sym.addAnnotation(LazyBodyAnnotation { ctx0 =>
560559
implicit val ctx: Context = localContext(sym)(ctx0).addMode(Mode.ReadPositions)
561560
// avoids space leaks by not capturing the current context
@@ -643,14 +642,9 @@ class TreeUnpickler(reader: TastyReader,
643642
val lazyAnnotTree = readLaterWithOwner(end, rdr => ctx => rdr.readTerm()(ctx))
644643

645644
owner =>
646-
if (tp.isRef(defn.BodyAnnot)) {
647-
assert(!typedInline)
648-
LazyBodyAnnotation(implicit ctx => lazyAnnotTree(owner).complete)
649-
}
650-
else
651-
Annotation.deferredSymAndTree(
652-
implicit ctx => tp.typeSymbol,
653-
implicit ctx => lazyAnnotTree(owner).complete)
645+
Annotation.deferredSymAndTree(
646+
implicit ctx => tp.typeSymbol,
647+
implicit ctx => lazyAnnotTree(owner).complete)
654648
}
655649

656650
/** Create symbols for the definitions in the statement sequence between
@@ -749,7 +743,7 @@ class TreeUnpickler(reader: TastyReader,
749743
def readRhs(implicit ctx: Context) =
750744
if (nothingButMods(end))
751745
EmptyTree
752-
else if (sym.isInlineMethod && typedInline)
746+
else if (sym.isInlineMethod)
753747
// The body of an inline method is stored in an annotation, so no need to unpickle it again
754748
new Trees.Lazy[Tree] {
755749
def complete(implicit ctx: Context) = typer.Inliner.bodyToInline(sym)

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ import util.Positions.Position
2525
object Inliner {
2626
import tpd._
2727

28-
val typedInline: Boolean = true
29-
3028
/** `sym` is an inline method with a known body to inline (note: definitions coming
3129
* from Scala2x class files might be `@forceInline`, but still lack that body).
3230
*/

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,7 @@ object ProtoTypes {
7575
* achieved by replacing expected type parameters with wildcards.
7676
*/
7777
def constrainResult(meth: Symbol, mt: Type, pt: Type)(implicit ctx: Context): Boolean =
78-
if (Inliner.isInlineable(meth) && !Inliner.typedInline) {
79-
constrainResult(mt, wildApprox(pt))
80-
true
81-
}
82-
else constrainResult(mt, pt)
78+
constrainResult(mt, pt)
8379
}
8480

8581
object NoViewsAllowed extends Compatibility {

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

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1992,17 +1992,9 @@ class Typer extends Namer
19921992
case none =>
19931993
typed(mdef) match {
19941994
case mdef1: DefDef if Inliner.hasBodyToInline(mdef1.symbol) =>
1995-
if (Inliner.typedInline) {
1996-
buf += inlineExpansion(mdef1)
1997-
// replace body with expansion, because it will be used as inlined body
1998-
// from separately compiled files - the original BodyAnnotation is not kept.
1999-
}
2000-
else {
2001-
assert(mdef1.symbol.isInlineMethod, mdef.symbol)
2002-
Inliner.bodyToInline(mdef1.symbol) // just make sure accessors are computed,
2003-
buf += mdef1 // but keep original definition, since inline-expanded code
2004-
// is pickled in this case.
2005-
}
1995+
buf += inlineExpansion(mdef1)
1996+
// replace body with expansion, because it will be used as inlined body
1997+
// from separately compiled files - the original BodyAnnotation is not kept.
20061998
case mdef1 =>
20071999
import untpd.modsDeco
20082000
mdef match {
@@ -2453,8 +2445,7 @@ class Typer extends Namer
24532445
!ctx.settings.YnoInline.value &&
24542446
!ctx.isAfterTyper &&
24552447
!ctx.reporter.hasErrors &&
2456-
(!Inliner.typedInline || tree.tpe <:< pt)) {
2457-
if (!Inliner.typedInline) tree.tpe <:< wildApprox(pt)
2448+
tree.tpe <:< pt) {
24582449
readaptSimplified(Inliner.inlineCall(tree, pt))
24592450
}
24602451
else if (tree.tpe <:< pt) {

0 commit comments

Comments
 (0)