@@ -98,7 +98,7 @@ trait QuotesAndSplices {
9898 case _ =>
9999 }
100100 if (ctx.mode.is(Mode .QuotedPattern ) && level == 1 )
101- if (isFullyDefined(pt, ForceDegree .all)) {
101+ if (false && isFullyDefined(pt, ForceDegree .all)) {
102102 ctx.error(i " Spliced type pattern must not be fully defined. Consider using $pt directly " , tree.expr.sourcePos)
103103 tree.withType(UnspecifiedErrorType )
104104 }
@@ -111,7 +111,10 @@ trait QuotesAndSplices {
111111 ctx.error(" expected a name binding" , expr.sourcePos)
112112 " $error" .toTypeName
113113 }
114- val typeSym = ctx.newSymbol(spliceOwner(ctx), name, EmptyFlags , TypeBounds .empty, NoSymbol , tree.expr.span)
114+ val typeSymInfo = pt match
115+ case pt : TypeBounds => pt
116+ case _ => TypeBounds .empty
117+ val typeSym = ctx.newSymbol(spliceOwner(ctx), name, EmptyFlags , typeSymInfo, NoSymbol , tree.expr.span)
115118 typeSym.addAnnotation(Annotation (New (ref(defn.InternalQuoted_patternBindHoleAnnot .typeRef)).withSpan(tree.expr.span)))
116119 val pat = typedPattern(tree.expr, defn.QuotedTypeClass .typeRef.appliedTo(typeSym.typeRef))(
117120 spliceContext.retractMode(Mode .QuotedPattern ).withOwner(spliceOwner(ctx)))
@@ -317,13 +320,16 @@ trait QuotesAndSplices {
317320 ctx.error(missingArgMsg(qctx, defn.QuoteContextClass .typeRef, " " ), ctx.source.atSpan(tree.span))
318321
319322 val quoted = tree.quoted
320- val exprPt = pt.baseType(defn.QuotedExprClass )
323+ val exprPt = pt.baseType(if quoted.isType then defn. QuotedTypeClass else defn.QuotedExprClass )
321324 val quotedPt = exprPt.argInfos.headOption match {
322325 case Some (argPt : ValueType ) => argPt // excludes TypeBounds
323326 case _ => defn.AnyType
324327 }
325328 val quoted0 = desugar.quotedPattern(quoted, untpd.TypedSplice (TypeTree (quotedPt)))
326- val quoted1 = typedExpr(quoted0, WildcardType )(quoteContext.addMode(Mode .QuotedPattern ))
329+ val quoteCtx = quoteContext.addMode(Mode .QuotedPattern )
330+ val quoted1 =
331+ if quoted.isType then typedType(quoted0, quotedPt)(quoteCtx)
332+ else typedExpr(quoted0, quotedPt)(quoteCtx)
327333
328334 val (typeBindings, shape, splices) = splitQuotePattern(quoted1)
329335
0 commit comments