Skip to content

Commit 2faa975

Browse files
committed
Split isSplice into isExprSplice and isTypeSlpice
1 parent 76d9eb7 commit 2faa975

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

compiler/src/dotty/tools/dotc/ast/TreeInfo.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
884884
* will return a term tree.
885885
*/
886886
def unapply(tree: tpd.Apply)(using Context): Option[tpd.Tree] =
887-
if tree.symbol.isSplice then Some(tree.args.head) else None
887+
if tree.symbol.isExprSplice then Some(tree.args.head) else None
888888
}
889889

890890
/** Extractors for type splices */
@@ -894,7 +894,7 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
894894
* will return a type tree.
895895
*/
896896
def unapply(tree: tpd.Select)(using Context): Option[tpd.Tree] =
897-
if tree.symbol.isSplice then Some(tree.qualifier) else None
897+
if tree.symbol.isTypeSplice then Some(tree.qualifier) else None
898898
}
899899

900900
/** Extractor for not-null assertions.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class PCPCheckAndHeal(@constructorOnly ictx: Context) extends TreeMapWithStages(
179179
tryHeal(tp.symbol, tp, pos)
180180
case prefix: ThisType if !tp.symbol.isStatic && level > levelOf(prefix.cls) =>
181181
tryHeal(tp.symbol, tp, pos)
182-
case prefix: TermRef if tp.symbol.isSplice =>
182+
case prefix: TermRef if tp.symbol.isTypeSplice =>
183183
prefix.symbol.info.argInfos match
184184
case (tb: TypeBounds) :: _ =>
185185
ctx.error(em"Cannot splice $tp because it is a wildcard type", pos)

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ class ReifyQuotes extends MacroTransform {
7878
tree match {
7979
case tree: RefTree if !Inliner.inInlineMethod =>
8080
assert(!tree.symbol.isQuote)
81-
assert(!tree.symbol.isSplice)
81+
assert(!tree.symbol.isExprSplice)
82+
assert(!tree.symbol.isTypeSplice)
8283
case _ : TypeDef =>
8384
assert(!tree.symbol.hasAnnotation(defn.InternalQuoted_QuoteTypeTagAnnot),
8485
s"${tree.symbol} should have been removed by PickledQuotes because it has a @quoteTypeTag")
@@ -329,7 +330,7 @@ class ReifyQuotes extends MacroTransform {
329330
/** Remove references to local types that will not be defined in this quote */
330331
def getTypeHoleType(using ctx: Context) = new TypeMap() {
331332
override def apply(tp: Type): Type = tp match
332-
case tp: TypeRef if tp.typeSymbol.isSplice =>
333+
case tp: TypeRef if tp.typeSymbol.isTypeSplice =>
333334
apply(tp.dealias)
334335
case tp @ TypeRef(pre, _) if pre == NoPrefix || pre.termSymbol.isLocal =>
335336
val hiBound = tp.typeSymbol.info match

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,13 @@ class SymUtils(val self: Symbol) extends AnyVal {
208208
def isQuote(using Context): Boolean =
209209
self == defn.InternalQuoted_exprQuote || self == defn.InternalQuoted_typeQuote
210210

211-
/** Is symbol a splice operation? */
212-
def isSplice(using Context): Boolean =
213-
self == defn.InternalQuoted_exprSplice || self == defn.InternalQuoted_exprNestedSplice || self == defn.QuotedType_splice
211+
/** Is symbol a term splice operation? */
212+
def isExprSplice(using Context): Boolean =
213+
self == defn.InternalQuoted_exprSplice || self == defn.InternalQuoted_exprNestedSplice
214+
215+
/** Is symbol a type splice operation? */
216+
def isTypeSplice(using Context): Boolean =
217+
self == defn.QuotedType_splice
214218

215219
/** Is symbol an extension method? Accessors are excluded since
216220
* after the getters phase collective extension objects become accessors

0 commit comments

Comments
 (0)