Skip to content

Unencode quote and splice trees #17342

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 46 commits into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
c2f6362
Rename `Spliced` to `SplicedExpr`
nicolasstucki Apr 21, 2023
938d3ae
Split `Quoted` extractor into `QuotedExpr` and `QuotedTypeOf`
nicolasstucki Apr 21, 2023
b7ca9b1
Split `transformQuotation` into `transformQuotedExpr` and `transformQ…
nicolasstucki Apr 21, 2023
deb03a7
Add `QuotedExpr` to encode quotes directly in the AST
nicolasstucki Apr 21, 2023
b7a7227
Add `SplicedExpr` to encode splices directly in the AST
nicolasstucki Apr 21, 2023
fe64a3e
Remove splice outer quotes context
nicolasstucki Apr 25, 2023
161ef49
Rename `SplicedExpr.{spliced=>expr}`
nicolasstucki Apr 25, 2023
cf30d30
Use QuotedExpr instead of Quote trees
nicolasstucki Apr 25, 2023
f0d758b
Use SplicedExpr instead of Splice trees
nicolasstucki Apr 25, 2023
c6adab8
Move typedQuotedExpr/typedSplicedExpr to QuotesAndSplices
nicolasstucki Apr 25, 2023
3a045c4
Rename QuotedExpr to Quote and SplicedExpr to Splice
nicolasstucki Apr 25, 2023
76d0daf
Add documentation
nicolasstucki Apr 25, 2023
75bacdb
Backwards compatibility support for quotes and splice in reflection API
nicolasstucki Apr 25, 2023
0e6dc2e
Add regression test
nicolasstucki Apr 25, 2023
cdd5ffb
Adapt REPL test output
nicolasstucki Apr 26, 2023
04f020f
Remove `Splice.isInBraces`
nicolasstucki Apr 27, 2023
35db4a1
Move Quote/Splice retyping into ReTyper
nicolasstucki Apr 27, 2023
1ef7f59
Add documentation
nicolasstucki Apr 27, 2023
687d06e
Transform Quote/Splice in MiniPhase
nicolasstucki Apr 27, 2023
1f62049
Add TODOs and fix typos
nicolasstucki Apr 28, 2023
5ae7861
Remove `tpt` from `Quote`
nicolasstucki Apr 28, 2023
3976d06
Remove `tpt` from `Splice`
nicolasstucki Apr 28, 2023
d4b2f09
Rename `Quote.{expr=>body}`
nicolasstucki Apr 28, 2023
35408ec
Fix staging level tracking in Transformer
nicolasstucki Apr 28, 2023
e73eab7
Cleanup unnecessary staging level updates
nicolasstucki Apr 28, 2023
e06b0f9
Use `Quote to encode `Type.of` in the `staging phase`
nicolasstucki May 1, 2023
095a7f1
Remove state from TreeMapWithStages
nicolasstucki May 1, 2023
10cbc60
Fix wrong staging level error message
nicolasstucki May 1, 2023
3097f49
Simplify quoted type transformation in CrossStageSafety
nicolasstucki May 1, 2023
8a9871f
Simplify Quote/Splice transformations in CrossStageSafety
nicolasstucki May 1, 2023
966835b
Deduplicate code that transforms `Quote`, `Splice`, `Type.of`
nicolasstucki May 1, 2023
95c39bc
Cleanup
nicolasstucki May 1, 2023
0ca6066
Remove redundant case
nicolasstucki May 1, 2023
e3735fa
Refactor
nicolasstucki May 1, 2023
6956c43
Refactor quote cancellation logic
nicolasstucki May 1, 2023
859f6e6
Remove unnecessary quotation level change
nicolasstucki May 1, 2023
e4ddc88
Add missing change of staging level
nicolasstucki May 1, 2023
7e8d2b1
Simplify macroDependencies using level from context
nicolasstucki May 1, 2023
a3c657b
Fix typo
nicolasstucki May 1, 2023
be3cd48
Refactor use of Quote
nicolasstucki May 1, 2023
7bd7c92
Do not traverse type trees to find inline method calls
nicolasstucki May 1, 2023
b991b40
Remove post-condition that is already checked by Staging
nicolasstucki May 1, 2023
e611139
Refactor quote pickling case
nicolasstucki May 1, 2023
37200be
Cleanup
nicolasstucki May 1, 2023
e75cafe
Remove unnecessary widening
nicolasstucki May 1, 2023
9214daa
Apply suggestions from code review
nicolasstucki May 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions compiler/src/dotty/tools/dotc/CompilationUnit.scala
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,13 @@ object CompilationUnit {
var containsCaptureChecking = false
var containsMacroAnnotation = false
def traverse(tree: Tree)(using Context): Unit = {
if (tree.symbol.isQuote)
containsQuote = true
if tree.symbol.is(Flags.Inline) then
containsInline = true
tree match
case tpd.Quote(_, _) =>
containsQuote = true
case tree: tpd.Apply if tree.symbol == defn.QuotedTypeModule_of =>
containsQuote = true
case Import(qual, selectors) =>
tpd.languageImport(qual) match
case Some(prefix) =>
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/ast/Desugar.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1986,10 +1986,10 @@ object desugar {
trees foreach collect
case Block(Nil, expr) =>
collect(expr)
case Quote(expr) =>
case Quote(expr, _) =>
new UntypedTreeTraverser {
def traverse(tree: untpd.Tree)(using Context): Unit = tree match {
case Splice(expr) => collect(expr)
case Splice(expr, _) => collect(expr)
case _ => traverseChildren(tree)
}
}.traverse(expr)
Expand Down
18 changes: 2 additions & 16 deletions compiler/src/dotty/tools/dotc/ast/TreeInfo.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1026,33 +1026,19 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
case t => assert(t.span.exists, i"$t")
}

/** Extractors for quotes */
object Quoted {
object QuotedTypeOf {
/** Extracts the content of a quoted tree.
* The result can be the contents of a term or type quote, which
* will return a term or type tree respectively.
*/
def unapply(tree: tpd.Apply)(using Context): Option[tpd.Tree] =
if tree.symbol == defn.QuotedRuntime_exprQuote then
// quoted.runtime.Expr.quote[T](<body>)
Some(tree.args.head)
else if tree.symbol == defn.QuotedTypeModule_of then
if tree.symbol == defn.QuotedTypeModule_of then
// quoted.Type.of[<body>](quotes)
val TypeApply(_, body :: _) = tree.fun: @unchecked
Some(body)
else None
}

/** Extractors for splices */
object Spliced {
/** Extracts the content of a spliced expression tree.
* The result can be the contents of a term splice, which
* will return a term tree.
*/
def unapply(tree: tpd.Apply)(using Context): Option[tpd.Tree] =
if tree.symbol.isExprSplice then Some(tree.args.head) else None
}

/** Extractors for type splices */
object SplicedType {
/** Extracts the content of a spliced type tree.
Expand Down
60 changes: 60 additions & 0 deletions compiler/src/dotty/tools/dotc/ast/Trees.scala
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,46 @@ object Trees {
override def isType = expansion.isType
}

/** A tree representing a quote `'{ expr }`
* `Quote`s are created by the `Parser` with an empty `tpt`. In typer
* they can be typed as a `Quote` with a known `tpt` or desugared and
* typed as a quote pattern.
*
* `Quotes` are checked transformed in the `staging`, `splicing` and `pickleQuotes`
* phases. After `pickleQuotes` phase, the only quotes that exist are in `inline`
* methods. These are dropped when we remove the inline method implementations.
*
* The `tpt` will be transformed in `staging` and used in `pickleQuotes` to create the
* pickled representation of the quote.
*
* @param expr The tree that was quoted
* @param tpt The type of the tree that was quoted
*/
case class Quote[+T <: Untyped] private[ast] (expr: Tree[T], tpt: Tree[T])(implicit @constructorOnly src: SourceFile)
extends TermTree[T] {
type ThisTree[+T <: Untyped] = Quote[T]
}

/** A tree representing a splice `${ expr }`
*
* `Splice`s are created by the `Parser` with an empty `tpt`. In typer
* they can be typed as a `Splice` with a known `tpt` or desugared and
* typed as a quote pattern holes.
*
* `Splice` are checked transformed in the `staging` and `splicing` phases.
* After `splicing` phase, the only quotes that exist are in `inline`
* methods. These are dropped when we remove the inline method implementations.
*
* The `tpt` will be transformed in `staging` and used in `splicing` to create `Hole`s.
*
* @param expr The tree that was spliced
* @param tpt The type of the spliced tree
*/
case class Splice[+T <: Untyped] private[ast] (expr: Tree[T], tpt: Tree[T])(implicit @constructorOnly src: SourceFile)
extends TermTree[T] {
type ThisTree[+T <: Untyped] = Splice[T]
}

/** A type tree that represents an existing or inferred type */
case class TypeTree[+T <: Untyped]()(implicit @constructorOnly src: SourceFile)
extends DenotingTree[T] with TypTree[T] {
Expand Down Expand Up @@ -1087,6 +1127,8 @@ object Trees {
type SeqLiteral = Trees.SeqLiteral[T]
type JavaSeqLiteral = Trees.JavaSeqLiteral[T]
type Inlined = Trees.Inlined[T]
type Quote = Trees.Quote[T]
type Splice = Trees.Splice[T]
type TypeTree = Trees.TypeTree[T]
type InferredTypeTree = Trees.InferredTypeTree[T]
type SingletonTypeTree = Trees.SingletonTypeTree[T]
Expand Down Expand Up @@ -1257,6 +1299,14 @@ object Trees {
case tree: Inlined if (call eq tree.call) && (bindings eq tree.bindings) && (expansion eq tree.expansion) => tree
case _ => finalize(tree, untpd.Inlined(call, bindings, expansion)(sourceFile(tree)))
}
def Quote(tree: Tree)(expr: Tree, tpt: Tree)(using Context): Quote = tree match {
case tree: Quote if (expr eq tree.expr) && (tpt eq tree.tpt) => tree
case _ => finalize(tree, untpd.Quote(expr, tpt)(sourceFile(tree)))
}
def Splice(tree: Tree)(expr: Tree, tpt: Tree)(using Context): Splice = tree match {
case tree: Splice if (expr eq tree.expr) && (tpt eq tree.tpt) => tree
case _ => finalize(tree, untpd.Splice(expr, tpt)(sourceFile(tree)))
}
def SingletonTypeTree(tree: Tree)(ref: Tree)(using Context): SingletonTypeTree = tree match {
case tree: SingletonTypeTree if (ref eq tree.ref) => tree
case _ => finalize(tree, untpd.SingletonTypeTree(ref)(sourceFile(tree)))
Expand Down Expand Up @@ -1362,6 +1412,8 @@ object Trees {
TypeDef(tree: Tree)(name, rhs)
def Template(tree: Template)(using Context)(constr: DefDef = tree.constr, parents: List[Tree] = tree.parents, derived: List[untpd.Tree] = tree.derived, self: ValDef = tree.self, body: LazyTreeList = tree.unforcedBody): Template =
Template(tree: Tree)(constr, parents, derived, self, body)
def Splice(tree: Splice)(expr: Tree = tree.expr, tpt: Tree = tree.tpt)(using Context): Splice =
Splice(tree: Tree)(expr, tpt)
def Hole(tree: Hole)(isTerm: Boolean = tree.isTerm, idx: Int = tree.idx, args: List[Tree] = tree.args, content: Tree = tree.content, tpt: Tree = tree.tpt)(using Context): Hole =
Hole(tree: Tree)(isTerm, idx, args, content, tpt)

Expand Down Expand Up @@ -1494,6 +1546,10 @@ object Trees {
case Thicket(trees) =>
val trees1 = transform(trees)
if (trees1 eq trees) tree else Thicket(trees1)
case tree @ Quote(expr, tpt) =>
cpy.Quote(tree)(transform(expr), transform(tpt))
case tree @ Splice(expr, tpt) =>
cpy.Splice(tree)(transform(expr), transform(tpt))
case tree @ Hole(_, _, args, content, tpt) =>
cpy.Hole(tree)(args = transform(args), content = transform(content), tpt = transform(tpt))
case _ =>
Expand Down Expand Up @@ -1635,6 +1691,10 @@ object Trees {
this(this(x, arg), annot)
case Thicket(ts) =>
this(x, ts)
case Quote(expr, tpt) =>
this(this(x, expr), tpt)
case Splice(expr, tpt) =>
this(this(x, expr), tpt)
case Hole(_, _, args, content, tpt) =>
this(this(this(x, args), content), tpt)
case _ =>
Expand Down
6 changes: 6 additions & 0 deletions compiler/src/dotty/tools/dotc/ast/tpd.scala
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,12 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
def Inlined(call: Tree, bindings: List[MemberDef], expansion: Tree)(using Context): Inlined =
ta.assignType(untpd.Inlined(call, bindings, expansion), bindings, expansion)

def Quote(expr: Tree, tpt: Tree)(using Context): Quote =
ta.assignType(untpd.Quote(expr, tpt), tpt)

def Splice(expr: Tree, tpt: Tree)(using Context): Splice =
ta.assignType(untpd.Splice(expr, tpt), tpt)

def TypeTree(tp: Type, inferred: Boolean = false)(using Context): TypeTree =
(if inferred then untpd.InferredTypeTree() else untpd.TypeTree()).withType(tp)

Expand Down
22 changes: 2 additions & 20 deletions compiler/src/dotty/tools/dotc/ast/untpd.scala
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,6 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
override def isType: Boolean = !isTerm
}
case class Throw(expr: Tree)(implicit @constructorOnly src: SourceFile) extends TermTree
case class Quote(quoted: Tree)(implicit @constructorOnly src: SourceFile) extends TermTree
case class Splice(expr: Tree)(implicit @constructorOnly src: SourceFile) extends TermTree {
def isInBraces: Boolean = span.end != expr.span.end
}
case class ForYield(enums: List[Tree], expr: Tree)(implicit @constructorOnly src: SourceFile) extends TermTree
case class ForDo(enums: List[Tree], body: Tree)(implicit @constructorOnly src: SourceFile) extends TermTree
case class GenFrom(pat: Tree, expr: Tree, checkMode: GenCheckMode)(implicit @constructorOnly src: SourceFile) extends Tree
Expand Down Expand Up @@ -401,6 +397,8 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
def SeqLiteral(elems: List[Tree], elemtpt: Tree)(implicit src: SourceFile): SeqLiteral = new SeqLiteral(elems, elemtpt)
def JavaSeqLiteral(elems: List[Tree], elemtpt: Tree)(implicit src: SourceFile): JavaSeqLiteral = new JavaSeqLiteral(elems, elemtpt)
def Inlined(call: tpd.Tree, bindings: List[MemberDef], expansion: Tree)(implicit src: SourceFile): Inlined = new Inlined(call, bindings, expansion)
def Quote(expr: Tree, tpt: Tree)(implicit src: SourceFile): Quote = new Quote(expr, tpt)
def Splice(expr: Tree, tpt: Tree)(implicit src: SourceFile): Splice = new Splice(expr, tpt)
def TypeTree()(implicit src: SourceFile): TypeTree = new TypeTree()
def InferredTypeTree()(implicit src: SourceFile): TypeTree = new InferredTypeTree()
def SingletonTypeTree(ref: Tree)(implicit src: SourceFile): SingletonTypeTree = new SingletonTypeTree(ref)
Expand Down Expand Up @@ -622,14 +620,6 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
case tree: Throw if expr eq tree.expr => tree
case _ => finalize(tree, untpd.Throw(expr)(tree.source))
}
def Quote(tree: Tree)(quoted: Tree)(using Context): Tree = tree match {
case tree: Quote if quoted eq tree.quoted => tree
case _ => finalize(tree, untpd.Quote(quoted)(tree.source))
}
def Splice(tree: Tree)(expr: Tree)(using Context): Tree = tree match {
case tree: Splice if expr eq tree.expr => tree
case _ => finalize(tree, untpd.Splice(expr)(tree.source))
}
def ForYield(tree: Tree)(enums: List[Tree], expr: Tree)(using Context): TermTree = tree match {
case tree: ForYield if (enums eq tree.enums) && (expr eq tree.expr) => tree
case _ => finalize(tree, untpd.ForYield(enums, expr)(tree.source))
Expand Down Expand Up @@ -711,10 +701,6 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
cpy.Tuple(tree)(transform(trees))
case Throw(expr) =>
cpy.Throw(tree)(transform(expr))
case Quote(t) =>
cpy.Quote(tree)(transform(t))
case Splice(expr) =>
cpy.Splice(tree)(transform(expr))
case ForYield(enums, expr) =>
cpy.ForYield(tree)(transform(enums), transform(expr))
case ForDo(enums, body) =>
Expand Down Expand Up @@ -772,10 +758,6 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
this(x, trees)
case Throw(expr) =>
this(x, expr)
case Quote(t) =>
this(x, t)
case Splice(expr) =>
this(x, expr)
case ForYield(enums, expr) =>
this(this(x, enums), expr)
case ForDo(enums, body) =>
Expand Down
16 changes: 16 additions & 0 deletions compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,22 @@ class TreePickler(pickler: TastyPickler) {
pickleTree(hi)
pickleTree(alias)
}
case Quote(expr, tpt) =>
pickleTree(
// scala.quoted.runtime.Expr.quoted[<tpt>](<expr>)
ref(defn.QuotedRuntime_exprQuote)
.appliedToTypeTree(tpt)
.appliedTo(expr)
.withSpan(tree.span)
)
case Splice(expr, tpt) =>
pickleTree(
// scala.quoted.runtime.Expr.splice[<tpt>](<spliced>)
ref(defn.QuotedRuntime_exprSplice)
.appliedToTypeTree(tpt)
.appliedTo(expr)
.withSpan(tree.span)
)
case Hole(_, idx, args, _, tpt) =>
writeByte(HOLE)
withLength {
Expand Down
18 changes: 18 additions & 0 deletions compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1267,6 +1267,21 @@ class TreeUnpickler(reader: TastyReader,
res.withAttachment(SuppressedApplyToNone, ())
else res

def quotedExpr(fn: Tree, args: List[Tree]): Tree =
val TypeApply(_, targs) = fn: @unchecked
Quote(args.head, targs.head)

def splicedExpr(fn: Tree, args: List[Tree]): Tree =
val TypeApply(_, targs) = fn: @unchecked
Splice(args.head, targs.head)

def nestedSpliceExpr(fn: Tree, args: List[Tree]): Tree =
fn match
case Apply(TypeApply(_, targs), _ :: Nil) => // nestedSplice[T](quotes)(expr)
Splice(args.head, targs.head)
case _ => // nestedSplice[T](quotes)
tpd.Apply(fn, args)

def simplifyLub(tree: Tree): Tree =
tree.overwriteType(tree.tpe.simplified)
tree
Expand All @@ -1283,6 +1298,9 @@ class TreeUnpickler(reader: TastyReader,
val fn = readTree()
val args = until(end)(readTree())
if fn.symbol.isConstructor then constructorApply(fn, args)
else if fn.symbol == defn.QuotedRuntime_exprQuote then quotedExpr(fn, args)
else if fn.symbol == defn.QuotedRuntime_exprSplice then splicedExpr(fn, args)
else if fn.symbol == defn.QuotedRuntime_exprNestedSplice then nestedSpliceExpr(fn, args)
else tpd.Apply(fn, args)
case TYPEAPPLY =>
tpd.TypeApply(readTree(), until(end)(readTpt()))
Expand Down
43 changes: 25 additions & 18 deletions compiler/src/dotty/tools/dotc/inlines/Inliner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -815,30 +815,33 @@ class Inliner(val call: tpd.Tree)(using Context):
super.typedValDef(vdef1, sym)

override def typedApply(tree: untpd.Apply, pt: Type)(using Context): Tree =
def cancelQuotes(tree: Tree): Tree =
tree match
case Quoted(Spliced(inner)) => inner
case _ => tree
val locked = ctx.typerState.ownedVars
val res = cancelQuotes(constToLiteral(BetaReduce(super.typedApply(tree, pt)))) match {
case res: Apply if res.symbol == defn.QuotedRuntime_exprSplice
&& StagingLevel.level == 0
&& !hasInliningErrors =>
val expanded = expandMacro(res.args.head, tree.srcPos)
transform.TreeChecker.checkMacroGeneratedTree(res, expanded)
typedExpr(expanded) // Inline calls and constant fold code generated by the macro
case res =>
specializeEq(inlineIfNeeded(res, pt, locked))
}
res
specializeEq(inlineIfNeeded(constToLiteral(BetaReduce(super.typedApply(tree, pt))), pt, locked))

override def typedTypeApply(tree: untpd.TypeApply, pt: Type)(using Context): Tree =
val locked = ctx.typerState.ownedVars
val tree1 = inlineIfNeeded(constToLiteral(BetaReduce(super.typedTypeApply(tree, pt))), pt, locked)
if tree1.symbol.isQuote then
if tree1.symbol == defn.QuotedTypeModule_of then
ctx.compilationUnit.needsStaging = true
tree1

override def typedQuote(tree: untpd.Quote, pt: Type)(using Context): Tree =
super.typedQuote(tree, pt) match
case Quote(Splice(inner, _), _) => inner
case tree1 =>
ctx.compilationUnit.needsStaging = true
tree1

override def typedSplice(tree: untpd.Splice, pt: Type)(using Context): Tree =
super.typedSplice(tree, pt) match
case tree1 @ Splice(expr, tpt)
if StagingLevel.level == 0
&& !hasInliningErrors =>
val expanded = expandMacro(expr, tree1.srcPos)
transform.TreeChecker.checkMacroGeneratedTree(tree1, expanded)
typedExpr(expanded) // Inline calls and constant fold code generated by the macro
case tree1 => tree1

override def typedMatch(tree: untpd.Match, pt: Type)(using Context): Tree =
val tree1 =
if tree.isInline then
Expand Down Expand Up @@ -1067,11 +1070,15 @@ class Inliner(val call: tpd.Tree)(using Context):
else tree match {
case tree: RefTree if tree.isTerm && tree.symbol.isDefinedInCurrentRun && !tree.symbol.isLocal =>
foldOver(tree.symbol :: syms, tree)
case Quoted(body) =>
case Quote(body, _) =>
level += 1
try apply(syms, body)
finally level -= 1
case QuotedTypeOf(body) =>
level += 1
try apply(syms, body)
finally level -= 1
case Spliced(body) =>
case Splice(body, _) =>
level -= 1
try apply(syms, body)
finally level += 1
Expand Down
9 changes: 5 additions & 4 deletions compiler/src/dotty/tools/dotc/inlines/PrepareInlineable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ object PrepareInlineable {
}

private def stagingContext(tree: Tree)(using Context): Context = tree match
case tree: Apply if tree.symbol.isQuote => StagingLevel.quoteContext
case tree: Apply if tree.symbol.isExprSplice => StagingLevel.spliceContext
case tree: Quote => StagingLevel.quoteContext
case tree: Apply if tree.symbol eq defn.QuotedTypeModule_of => StagingLevel.quoteContext
case tree: Splice => StagingLevel.spliceContext
case _ => ctx
}

Expand Down Expand Up @@ -154,7 +155,7 @@ object PrepareInlineable {
val qual = qualifier(refPart)
inlining.println(i"adding receiver passing inline accessor for $tree/$refPart -> (${qual.tpe}, $refPart: ${refPart.getClass}, $argss%, %")

// Need to dealias in order to cagtch all possible references to abstracted over types in
// Need to dealias in order to catch all possible references to abstracted over types in
// substitutions
val dealiasMap = new TypeMap {
def apply(t: Type) = mapOver(t.dealias)
Expand Down Expand Up @@ -290,7 +291,7 @@ object PrepareInlineable {
if (inlined.is(Macro) && !ctx.isAfterTyper) {

def checkMacro(tree: Tree): Unit = tree match {
case Spliced(code) =>
case Splice(code, _) =>
if (code.symbol.flags.is(Inline))
report.error("Macro cannot be implemented with an `inline` method", code.srcPos)
Splicer.checkValidMacroBody(code)
Expand Down
Loading