@@ -1943,7 +1943,7 @@ class Typer extends Namer
1943
1943
val quoted1 = typedExpr(quoted, quotedPt)(quoteContext.addMode(Mode .QuotedPattern ))
1944
1944
val (shape, splices) = splitQuotePattern(quoted1)
1945
1945
val splicePat = typed(untpd.Tuple (splices.map(untpd.TypedSplice (_))).withSpan(quoted.span))
1946
- val patType = TypeOps .tupleOf(splices.tpes)
1946
+ val patType = TypeOps .tupleOf(splices.tpes.map(_.widen) )
1947
1947
UnApply (
1948
1948
ref(defn.QuotedMatcher_unapplyR ).appliedToType(patType),
1949
1949
ref(defn.InternalQuoted_exprQuoteR ).appliedToType(shape.tpe).appliedTo(shape) :: givenReflection :: Nil ,
@@ -1960,10 +1960,10 @@ class Typer extends Namer
1960
1960
val patBuf = new mutable.ListBuffer [Tree ]
1961
1961
override def transform (tree : Tree )(implicit ctx : Context ) = tree match {
1962
1962
case Typed (Splice (pat), tpt) =>
1963
- val exprTpt = ref( defn.QuotedExprType ).appliedToTypeTrees( tpt :: Nil )
1963
+ val exprTpt = AppliedTypeTree ( TypeTree ( defn.QuotedExprType ), tpt :: Nil )
1964
1964
transform(Splice (Typed (pat, exprTpt)))
1965
1965
case Splice (pat) =>
1966
- try holeForSplice (tree)
1966
+ try patternHole (tree)
1967
1967
finally patBuf += pat
1968
1968
case _ =>
1969
1969
super .transform(tree)
@@ -1973,12 +1973,9 @@ class Typer extends Namer
1973
1973
(result, splitter.patBuf.toList)
1974
1974
}
1975
1975
1976
- // TODO: Currently, a hole is expressed as interal.quoted.ExprSplice[T](???)
1977
- // Settle on a different representation and apply Stagin
1978
- def holeForSplice (splice : Tree )(implicit ctx : Context ): Tree = {
1979
- val Apply (fn, arg) = splice
1980
- tpd.cpy.Apply (splice)(fn, ref(defn.Predef_undefined ) :: Nil )
1981
- }
1976
+ /** A hole the shape pattern of a quoted.Matcher.unapply, representing a splice */
1977
+ def patternHole (splice : Tree )(implicit ctx : Context ): Tree =
1978
+ ref(defn.InternalQuoted_patternHoleR ).appliedToType(splice.tpe).withSpan(splice.span)
1982
1979
1983
1980
def givenReflection (implicit ctx : Context ): Tree = Literal (Constant (null )) // FIXME: fill in
1984
1981
0 commit comments