@@ -38,8 +38,6 @@ trait QuotesAndSplices {
3838 tree.quoted match {
3939 case untpd.Splice (innerExpr) if tree.isTerm && ! ctx.mode.is(Mode .Pattern ) =>
4040 report.warning(" Canceled splice directly inside a quote. '{ ${ XYZ } } is equivalent to XYZ." , tree.srcPos)
41- case untpd.TypSplice (innerType) if tree.isType =>
42- report.warning(" Canceled splice directly inside a quote. '[ ${ XYZ } ] is equivalent to XYZ." , tree.srcPos)
4341 case _ =>
4442 }
4543 val qctx = inferImplicitArg(defn.QuotesClass .typeRef, tree.span)
@@ -52,11 +50,12 @@ trait QuotesAndSplices {
5250 if ctx.mode.is(Mode .Pattern ) then
5351 typedQuotePattern(tree, pt, qctx).withSpan(tree.span)
5452 else if tree.quoted.isType then
55- val msg = em " Consider using canonical type constructor scala.quoted.Type.of[ ${tree.quoted}] instead "
56- if sourceVersion.isAtLeast(`future-migration`) then report.error(msg, tree.srcPos)
57- else report.warning(msg, tree.srcPos)
58- val typeOfTree = untpd.TypeApply (untpd.ref(defn.QuotedTypeModule_of .termRef), tree.quoted :: Nil ).withSpan(tree.span)
59- makeInlineable(typedTypeApply(typeOfTree, pt)(using quoteContext).select(nme.apply).appliedTo(qctx).withSpan(tree.span))
53+ val msg = em """ Quoted types `'[..]` can only be used in patterns.
54+ |
55+ |Hint: To get a scala.quoted.Type[T] use scala.quoted.Type.of[T] instead.
56+ | """ .stripMargin
57+ report.error(msg, tree.srcPos)
58+ EmptyTree
6059 else
6160 val exprQuoteTree = untpd.Apply (untpd.ref(defn.QuotedRuntime_exprQuote .termRef), tree.quoted)
6261 makeInlineable(typedApply(exprQuoteTree, pt)(using pushQuotes(qctx)).select(nme.apply).appliedTo(qctx).withSpan(tree.span))
@@ -135,7 +134,7 @@ trait QuotesAndSplices {
135134 case arg : untpd.Ident =>
136135 typedExpr(arg)
137136 case arg =>
138- report.error(" Open patttern exprected an identifier" , arg.srcPos)
137+ report.error(" Open pattern expected an identifier" , arg.srcPos)
139138 EmptyTree
140139 }
141140 if args.isEmpty then
@@ -145,30 +144,6 @@ trait QuotesAndSplices {
145144 ref(defn.QuotedRuntimePatterns_patternHigherOrderHole ).appliedToType(pt).appliedTo(typedPat, SeqLiteral (typedArgs, TypeTree (defn.AnyType )))
146145 }
147146
148- /** Translate ${ t: Type[T] }` into type `t.splice` while tracking the quotation level in the context */
149- def typedTypSplice (tree : untpd.TypSplice , pt : Type )(using Context ): Tree = {
150- record(" typedTypSplice" )
151- checkSpliceOutsideQuote(tree)
152- tree.expr match {
153- case untpd.Quote (innerType) if innerType.isType =>
154- report.warning(" Canceled quote directly inside a splice. ${ '[ XYZ ] } is equivalent to XYZ." , tree.srcPos)
155- case _ =>
156- }
157-
158- if ctx.mode.is(Mode .QuotedPattern ) && level == 1 then
159- report.error(
160- """ `$` for quote pattern variable is not supported anymore.
161- |Use lower cased variable name without the `$` instead.""" .stripMargin,
162- tree.srcPos)
163- ref(defn.NothingType )
164- else
165- val tree1 = typedSelect(untpd.Select (tree.expr, tpnme.Underlying ), pt)(using spliceContext).withSpan(tree.span)
166- val msg = em " Consider using canonical type reference ${tree1.tpe} instead "
167- if sourceVersion.isAtLeast(`future-migration`) then report.error(msg, tree.srcPos)
168- else report.warning(msg, tree.srcPos)
169- tree1
170- }
171-
172147 /** Type a pattern variable name `t` in quote pattern as `${given t$giveni: Type[t @ _]}`.
173148 * The resulting pattern is the split in `splitQuotePattern`.
174149 */
0 commit comments