Skip to content

Commit f0e4189

Browse files
committed
Remove call of Inlined after PostTyper
1 parent 18a8d51 commit f0e4189

File tree

6 files changed

+8
-93
lines changed

6 files changed

+8
-93
lines changed

compiler/src/dotty/tools/dotc/Compiler.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ class Compiler {
3737
/** Phases dealing with the frontend up to trees ready for TASTY pickling */
3838
protected def frontendPhases: List[List[Phase]] =
3939
List(new FrontEnd) :: // Compiler frontend: scanner, parser, namer, typer
40-
List(new YCheckPositions) :: // YCheck positions
4140
List(new sbt.ExtractDependencies) :: // Sends information on classes' dependencies to sbt via callbacks
4241
List(new semanticdb.ExtractSemanticDB) :: // Extract info into .semanticdb files
4342
List(new PostTyper) :: // Additional checks and cleanups after type checking

compiler/src/dotty/tools/dotc/quoted/PickledQuotes.scala

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ object PickledQuotes {
3232
def pickleQuote(tree: Tree)(using Context): PickledQuote =
3333
if (ctx.reporter.hasErrors) Nil
3434
else {
35-
assert(!tree.isInstanceOf[Hole]) // Should not be pickled as it represents `'{$x}` which should be optimized to `x`
35+
// FIXME handle new optimization opportunities. Previousliy we got some `Inlined(EmptyTree, Nil, Hole(...))` that did not get optimized
36+
// assert(!tree.isInstanceOf[Hole]) // Should not be pickled as it represents `'{$x}` which should be optimized to `x`
3637
val pickled = pickle(tree)
3738
TastyString.pickle(pickled)
3839
}
@@ -56,11 +57,9 @@ object PickledQuotes {
5657
val tastyBytes = TastyString.unpickle(tasty)
5758
val unpickled = withMode(Mode.ReadPositions)(
5859
unpickle(tastyBytes, splices, isType = false))
59-
val Inlined(call, Nil, expnasion) = unpickled
60-
val inlineCtx = inlineContext(call)
61-
val expansion1 = spliceTypes(expnasion, splices)(using inlineCtx)
62-
val expansion2 = spliceTerms(expansion1, splices)(using inlineCtx)
63-
cpy.Inlined(unpickled)(call, Nil, expansion2)
60+
val expansion1 = spliceTypes(unpickled, splices)
61+
val expansion2 = spliceTerms(expansion1, splices)
62+
cpy.Inlined(unpickled)(EmptyTree, Nil, expansion2)
6463
}
6564

6665
/** Unpickle the tree contained in the TastyType */

compiler/src/dotty/tools/dotc/transform/PostTyper.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,7 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
289289
super.transform(tree1)
290290
}
291291
case Inlined(call, bindings, expansion) if !call.isEmpty =>
292-
val pos = call.sourcePos
293-
val callTrace = Inliner.inlineCallTrace(call.symbol, pos)(using ctx.withSource(pos.source))
294-
cpy.Inlined(tree)(callTrace, transformSub(bindings), transform(expansion)(using inlineContext(tree)))
292+
cpy.Inlined(tree)(EmptyTree, transformSub(bindings), transform(expansion)(using inlineContext(tree)))
295293
case templ: Template =>
296294
withNoCheckNews(templ.parents.flatMap(newPart)) {
297295
forwardParamAccessors(templ)

compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,8 @@ class ReifyQuotes extends MacroTransform {
132132
}
133133
else {
134134
val (body1, splices) = nested(isQuote = true).splitQuote(body)(using quoteContext)
135-
if (level == 0) {
136-
val body2 =
137-
if (body1.isType) body1
138-
else Inlined(Inliner.inlineCallTrace(ctx.owner, quote.sourcePos), Nil, body1)
139-
pickledQuote(body2, splices, body.tpe, isType).withSpan(quote.span)
140-
}
141-
else
142-
body
135+
if level == 0 then pickledQuote(body1, splices, body.tpe, isType).withSpan(quote.span)
136+
else body
143137
}
144138
}
145139

compiler/src/dotty/tools/dotc/transform/YCheckPositions.scala

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

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -258,19 +258,6 @@ object Inliner {
258258
(new Reposition).transform(tree)
259259
}
260260

261-
/** Leave only a call trace consisting of
262-
* - a reference to the top-level class from which the call was inlined,
263-
* - the call's position
264-
* in the call field of an Inlined node.
265-
* The trace has enough info to completely reconstruct positions.
266-
* Note: For macros it returns a Select and for other inline methods it returns an Ident (this distinction is only temporary to be able to run YCheckPositions)
267-
*/
268-
def inlineCallTrace(callSym: Symbol, pos: SourcePosition)(using Context): Tree = {
269-
assert(ctx.source == pos.source)
270-
if (callSym.is(Macro)) ref(callSym.topLevelClass.owner).select(callSym.topLevelClass.name).withSpan(pos.span)
271-
else Ident(callSym.topLevelClass.typeRef).withSpan(pos.span)
272-
}
273-
274261
object Intrinsics {
275262
import dotty.tools.dotc.reporting.Diagnostic.Error
276263
private enum ErrorKind:

0 commit comments

Comments
 (0)