@@ -1943,7 +1943,7 @@ class Typer extends Namer
19431943 val quoted1 = typedExpr(quoted, quotedPt)(quoteContext.addMode(Mode .QuotedPattern ))
19441944 val (shape, splices) = splitQuotePattern(quoted1)
19451945 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) )
19471947 UnApply (
19481948 ref(defn.QuotedMatcher_unapplyR ).appliedToType(patType),
19491949 ref(defn.InternalQuoted_exprQuoteR ).appliedToType(shape.tpe).appliedTo(shape) :: givenReflection :: Nil ,
@@ -1960,10 +1960,10 @@ class Typer extends Namer
19601960 val patBuf = new mutable.ListBuffer [Tree ]
19611961 override def transform (tree : Tree )(implicit ctx : Context ) = tree match {
19621962 case Typed (Splice (pat), tpt) =>
1963- val exprTpt = ref( defn.QuotedExprType ).appliedToTypeTrees( tpt :: Nil )
1963+ val exprTpt = AppliedTypeTree ( TypeTree ( defn.QuotedExprType ), tpt :: Nil )
19641964 transform(Splice (Typed (pat, exprTpt)))
19651965 case Splice (pat) =>
1966- try holeForSplice (tree)
1966+ try patternHole (tree)
19671967 finally patBuf += pat
19681968 case _ =>
19691969 super .transform(tree)
@@ -1973,12 +1973,9 @@ class Typer extends Namer
19731973 (result, splitter.patBuf.toList)
19741974 }
19751975
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)
19821979
19831980 def givenReflection (implicit ctx : Context ): Tree = Literal (Constant (null )) // FIXME: fill in
19841981
0 commit comments