Skip to content

Commit 1951bec

Browse files
committed
address review: part 3
1 parent be8d0c6 commit 1951bec

File tree

11 files changed

+7
-149
lines changed

11 files changed

+7
-149
lines changed

compiler/src/dotty/tools/dotc/core/Annotations.scala

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,8 @@ object Annotations {
177177
assert(myTree != null)
178178
myTree match {
179179
case treeFn: (Context ?=> Tree) @unchecked =>
180-
var result: Tree | Null = null
181180
myTree = null
182-
try
183-
result = atPhaseBeforeTransforms(treeFn)
184-
myTree = result
185-
finally if result == null then
186-
myTree = ctx ?=> treeFn(using ctx) // reset, if unit is suspended then it will re-enter this annotation
181+
myTree = atPhaseBeforeTransforms(treeFn)
187182
case _ =>
188183
}
189184
myTree.asInstanceOf[Tree]

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

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,11 @@ class TreeUnpickler(reader: TastyReader,
170170
case ex: Exception => fail(ex)
171171
}
172172

173-
class TreeReader(val reader: TastyReader, inInlineBody: Boolean = false) {
173+
class TreeReader(val reader: TastyReader) {
174174
import reader.*
175175

176-
def forkAt(start: Addr, inInlineBody: Boolean = false): TreeReader =
177-
new TreeReader(subReader(start, endAddr), inInlineBody)
178-
179-
def fork: TreeReader = forkAt(currentAddr, inInlineBody)
176+
def forkAt(start: Addr): TreeReader = new TreeReader(subReader(start, endAddr))
177+
def fork: TreeReader = forkAt(currentAddr)
180178

181179
def skipParentTree(tag: Int): Unit = {
182180
if tag == SPLITCLAUSE then ()
@@ -696,7 +694,7 @@ class TreeUnpickler(reader: TastyReader,
696694
val ctx1 = localContext(sym)(using ctx0).addMode(Mode.ReadPositions)
697695
inContext(sourceChangeContext(Addr(0))(using ctx1)) {
698696
// avoids space leaks by not capturing the current context
699-
forkAt(rhsStart, inInlineBody = true).readTree()
697+
forkAt(rhsStart).readTree()
700698
}
701699
})
702700
goto(start)
@@ -1585,11 +1583,7 @@ class TreeUnpickler(reader: TastyReader,
15851583
val denot = inContext(ctx.addMode(Mode.ResolveFromTASTy)):
15861584
searchDenot // able to resolve Invisible members
15871585

1588-
1589-
val sel = makeSelect(qual, name, denot)
1590-
if denot == NoDenotation && inInlineBody && sel.denot.symbol.exists && sel.symbol.isDefinedInCurrentRun then
1591-
throw new ChangedMethodDenot(sel.denot.symbol)
1592-
sel
1586+
makeSelect(qual, name, denot)
15931587
case REPEATED =>
15941588
val elemtpt = readTpt()
15951589
SeqLiteral(until(end)(readTree()), elemtpt)
@@ -1896,9 +1890,6 @@ class TreeUnpickler(reader: TastyReader,
18961890

18971891
object TreeUnpickler {
18981892

1899-
/** Specifically thrown when a SELECTin was written to TASTy, i.e. is expected to resolve, and then doesn't. */
1900-
private[dotc] final class ChangedMethodDenot(val resolved: Symbol) extends Exception
1901-
19021893
/** Define the expected format of the tasty bytes
19031894
* - TopLevel: Tasty that contains a full class nested in its package
19041895
* - Term: Tasty that contains only a term tree

compiler/src/dotty/tools/dotc/inlines/Inlines.scala

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import staging.StagingLevel
1919
import collection.mutable
2020
import reporting.{NotConstant, trace}
2121
import util.Spans.Span
22-
import dotty.tools.dotc.core.tasty.TreeUnpickler
2322

2423
/** Support for querying inlineable methods and for inlining calls to such methods */
2524
object Inlines:
@@ -159,18 +158,7 @@ object Inlines:
159158
else if enclosingInlineds.length < ctx.settings.XmaxInlines.value && !reachedInlinedTreesLimit then
160159
val body =
161160
try bodyToInline(tree.symbol) // can typecheck the tree and thereby produce errors
162-
catch
163-
case _: MissingInlineInfo => throw CyclicReference(ctx.owner)
164-
case err: TreeUnpickler.ChangedMethodDenot =>
165-
// tested in sbt-test/tasty-compat/add-param-unroll2/a_v3/A.scala
166-
if err.resolved.source == ctx.source then
167-
report.error(em"""cannot inline ${tree.symbol}:
168-
| The definition of ${err.resolved.showLocated}, defined in the current file, has changed incompatibly.
169-
| Try inlining from a different file.""", tree.srcPos)
170-
EmptyTree
171-
else
172-
// Tested in sbt-test/tasty-compat/add-param-unroll2/a_v3_2/C.scala
173-
ctx.compilationUnit.suspend("suspending in case of possible generated methods")
161+
catch case _: MissingInlineInfo => throw CyclicReference(ctx.owner)
174162
new InlineCall(tree).expand(body)
175163
else
176164
ctx.base.stopInlining = true

sbt-test/tasty-compat/add-param-unroll2/a_v1/A.scala

Lines changed: 0 additions & 10 deletions
This file was deleted.

sbt-test/tasty-compat/add-param-unroll2/a_v2/B.scala

Lines changed: 0 additions & 8 deletions
This file was deleted.

sbt-test/tasty-compat/add-param-unroll2/a_v3/A.scala

Lines changed: 0 additions & 19 deletions
This file was deleted.

sbt-test/tasty-compat/add-param-unroll2/a_v3_2/A.scala

Lines changed: 0 additions & 10 deletions
This file was deleted.

sbt-test/tasty-compat/add-param-unroll2/a_v3_2/C.scala

Lines changed: 0 additions & 9 deletions
This file was deleted.

sbt-test/tasty-compat/add-param-unroll2/build.sbt

Lines changed: 0 additions & 38 deletions
This file was deleted.

sbt-test/tasty-compat/add-param-unroll2/project/DottyInjectedPlugin.scala

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)