Skip to content

Commit 1180aba

Browse files
Merge pull request #10283 from dotty-staging/rename-type-apply-to-type-of
Align `quoted.Type` with `reflect.TypeRepr` and `reflect.TypeTree`
2 parents c3ac180 + bd19b84 commit 1180aba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+92
-91
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
395395
case New(_) | Closure(_, _, _) =>
396396
Pure
397397
case TypeApply(fn, _) =>
398-
if (fn.symbol.is(Erased) || fn.symbol == defn.QuotedTypeModule_apply || fn.symbol == defn.Predef_classOf) Pure else exprPurity(fn)
398+
if (fn.symbol.is(Erased) || fn.symbol == defn.QuotedTypeModule_of || fn.symbol == defn.Predef_classOf) Pure else exprPurity(fn)
399399
case Apply(fn, args) =>
400400
def isKnownPureOp(sym: Symbol) =
401401
sym.owner.isPrimitiveValueClass

compiler/src/dotty/tools/dotc/core/Definitions.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ class Definitions {
833833
@tu lazy val QuotedType_splice: Symbol = QuotedTypeClass.requiredType(tpnme.Underlying)
834834

835835
@tu lazy val QuotedTypeModule: Symbol = QuotedTypeClass.companionModule
836-
@tu lazy val QuotedTypeModule_apply: Symbol = QuotedTypeModule.requiredMethod("apply")
836+
@tu lazy val QuotedTypeModule_of: Symbol = QuotedTypeModule.requiredMethod("of")
837837

838838
@tu lazy val TastyReflectionClass: ClassSymbol = requiredClass("scala.tasty.Reflection")
839839

compiler/src/dotty/tools/dotc/quoted/TypeImpl.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ final class TypeImpl(val typeTree: tpd.Tree, val scopeId: Int) extends scala.quo
2424
throw new ScopeException("Cannot call `scala.quoted.staging.run(...)` within a macro or another `run(...)`")
2525

2626
override def hashCode: Int = typeTree.hashCode
27-
override def toString: String = "'[ ... ]"
27+
override def toString: String = "Type.of[...]"
2828
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class PickleQuotes extends MacroTransform {
128128
* core and splices as arguments.
129129
*/
130130
override protected def transformQuotation(body: Tree, quote: Tree)(using Context): Tree = {
131-
val isType = quote.symbol eq defn.QuotedTypeModule_apply
131+
val isType = quote.symbol eq defn.QuotedTypeModule_of
132132
if (level > 0) {
133133
val body1 = nested(isQuote = true).transform(body)(using quoteContext)
134134
super.transformQuotation(body1, quote)
@@ -472,7 +472,7 @@ class PickleQuotes extends MacroTransform {
472472
transform(tree)(using ctx.withSource(tree.source))
473473
else reporting.trace(i"Reifier.transform $tree at $level", show = true) {
474474
tree match {
475-
case Apply(Select(TypeApply(fn, (body: RefTree) :: Nil), _), _) if fn.symbol == defn.QuotedTypeModule_apply && isCaptured(body.symbol, level + 1) =>
475+
case Apply(Select(TypeApply(fn, (body: RefTree) :: Nil), _), _) if fn.symbol == defn.QuotedTypeModule_of && isCaptured(body.symbol, level + 1) =>
476476
// Optimization: avoid the full conversion when capturing `x`
477477
// in '{ x } to '{ ${x$1} } and go directly to `x$1`
478478
capturers(body.symbol)(body)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ object Splicer {
146146
case Apply(Select(Apply(fn, quoted :: Nil), nme.apply), _) if fn.symbol == defn.InternalQuoted_exprQuote =>
147147
// OK
148148

149-
case Apply(Select(TypeApply(fn, List(quoted)), nme.apply), _)if fn.symbol == defn.QuotedTypeModule_apply =>
149+
case Apply(Select(TypeApply(fn, List(quoted)), nme.apply), _)if fn.symbol == defn.QuotedTypeModule_of =>
150150
// OK
151151

152152
case Literal(Constant(value)) =>
@@ -230,7 +230,7 @@ object Splicer {
230230
}
231231
interpretQuote(quoted1)
232232

233-
case Apply(Select(TypeApply(fn, quoted :: Nil), _), _) if fn.symbol == defn.QuotedTypeModule_apply =>
233+
case Apply(Select(TypeApply(fn, quoted :: Nil), _), _) if fn.symbol == defn.QuotedTypeModule_of =>
234234
interpretTypeQuote(quoted)
235235

236236
case Literal(Constant(value)) =>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ object SymUtils:
223223

224224
/** Is symbol a quote operation? */
225225
def isQuote(using Context): Boolean =
226-
self == defn.InternalQuoted_exprQuote || self == defn.QuotedTypeModule_apply
226+
self == defn.InternalQuoted_exprQuote || self == defn.QuotedTypeModule_of
227227

228228
/** Is symbol a term splice operation? */
229229
def isExprSplice(using Context): Boolean =

compiler/src/dotty/tools/dotc/typer/Inliner.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(using Context) {
524524
case New(_) | Closure(_, _, _) =>
525525
true
526526
case TypeApply(fn, _) =>
527-
if (fn.symbol.is(Erased) || fn.symbol == defn.QuotedTypeModule_apply) true else apply(fn)
527+
if (fn.symbol.is(Erased) || fn.symbol == defn.QuotedTypeModule_of) true else apply(fn)
528528
case Apply(fn, args) =>
529529
def isKnownPureOp(sym: Symbol) =
530530
sym.owner.isPrimitiveValueClass

compiler/src/dotty/tools/dotc/typer/QuotesAndSplices.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ trait QuotesAndSplices {
6363
val msg = em"Consider using canonical type constructor scala.quoted.Type[${tree.quoted}] instead"
6464
if sourceVersion.isAtLeast(`3.1-migration`) then report.error(msg, tree.srcPos)
6565
else report.warning(msg, tree.srcPos)
66-
typedTypeApply(untpd.TypeApply(untpd.ref(defn.QuotedTypeModule_apply.termRef), tree.quoted :: Nil), pt)(using quoteContext).select(nme.apply).appliedTo(qctx)
66+
typedTypeApply(untpd.TypeApply(untpd.ref(defn.QuotedTypeModule_of.termRef), tree.quoted :: Nil), pt)(using quoteContext).select(nme.apply).appliedTo(qctx)
6767
else
6868
typedApply(untpd.Apply(untpd.ref(defn.InternalQuoted_exprQuote.termRef), tree.quoted), pt)(using pushQuoteContext(qctx)).select(nme.apply).appliedTo(qctx)
6969
tree1.withSpan(tree.span)
@@ -461,7 +461,7 @@ trait QuotesAndSplices {
461461
val quoteClass = if (tree.quoted.isTerm) defn.QuotedExprClass else defn.QuotedTypeClass
462462
val quotedPattern =
463463
if (tree.quoted.isTerm) ref(defn.InternalQuoted_exprQuote.termRef).appliedToType(defn.AnyType).appliedTo(shape).select(nme.apply).appliedTo(qctx)
464-
else ref(defn.QuotedTypeModule_apply.termRef).appliedToTypeTree(shape).select(nme.apply).appliedTo(qctx)
464+
else ref(defn.QuotedTypeModule_of.termRef).appliedToTypeTree(shape).select(nme.apply).appliedTo(qctx)
465465

466466
val matchModule = if tree.quoted.isTerm then defn.QuoteMatching_ExprMatch else defn.QuoteMatching_TypeMatch
467467
val unapplyFun = qctx.asInstance(defn.QuoteMatchingClass.typeRef).select(matchModule).select(nme.unapply)

library/src-bootstrapped/scala/quoted/Type.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ object Type:
2020
qctx.reflect.TypeTree.of[T].showAnsiColored
2121

2222
/** Return a quoted.Type with the given type */
23-
@compileTimeOnly("Reference to `scala.quoted.Type.apply` was not handled by PickleQuotes")
24-
given apply[T <: AnyKind] as (QuoteContext ?=> Type[T]) = ???
23+
@compileTimeOnly("Reference to `scala.quoted.Type.of` was not handled by PickleQuotes")
24+
given of[T <: AnyKind] as (QuoteContext ?=> Type[T]) = ???
2525

2626
end Type

library/src-non-bootstrapped/scala/quoted/Type.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ abstract class Type[T <: AnyKind] private[scala]:
77

88
object Type:
99
@compileTimeOnly("Reference to `scala.quoted.Type.apply` was not handled by PickleQuotes")
10+
given of[T <: AnyKind] as (QuoteContext ?=> Type[T]) = ???
1011
given apply[T <: AnyKind] as (QuoteContext ?=> Type[T]) = ???

tests/neg-macros/i4493-b.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import scala.quoted._
22
class Index[K]
33
object Index {
44
inline def succ[K](x: K): Unit = ${
5-
implicit val t: Type[K] = Type[K] // error
5+
implicit val t: Type[K] = Type.of[K] // error
66
'{new Index[K]} // error
77
}
88
}

tests/neg-macros/i4493.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import scala.quoted._
22
class Index[K]
33
object Index {
44
inline def succ[K]: Unit = ${
5-
implicit val t: Type[K] = Type[K] // error
5+
implicit val t: Type[K] = Type.of[K] // error
66
'{new Index[K]} // error
77
}
88
}

tests/neg-macros/i7121.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class Test()(implicit qtx: QuoteContext) {
77
@annot1('{4}) // error
88
def foo(str: String) = ()
99

10-
@annot2(4)(using Type[Int]) // error
10+
@annot2(4)(using Type.of[Int]) // error
1111
def foo2(str: String) = ()
1212

1313
}

tests/neg-macros/quotedPatterns-5.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import scala.quoted._
22
object Test {
33
def test(x: quoted.Expr[Int])(using QuoteContext): Unit = x match {
4-
case '{ type t; 4 } => Type[t]
4+
case '{ type t; 4 } => Type.of[t]
55
case '{ type t; poly[t]($x); 4 } => // error: duplicate pattern variable: t
66
case '{ type `t`; poly[`t`]($x); 4 } =>
7-
Type[t] // error
7+
Type.of[t] // error
88
case _ =>
99
}
1010

tests/patmat/i9489.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import scala.quoted._
22

3-
def summonTypedType[T : Type](using QuoteContext): String = Type[T] match {
3+
def summonTypedType[T : Type](using QuoteContext): String = Type.of[T] match {
44
case '[Boolean] => "Boolean"
55
case '[Byte] => "Byte"
66
case _ => "Other"

tests/pos-macros/i10050.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ def test[T: Type](x: Expr[Any])(using QuoteContext): Unit =
2424
case '{ type t; $x: `t` } => // match any `t` and bind it as a type variable
2525
'{ val y: t = $x; } // use `t` provided by previous match
2626

27-
Type[T] match
28-
case '[List[u]] => Type[u]
29-
case '[u] => Type[u]
27+
Type.of[T] match
28+
case '[List[u]] => Type.of[u]
29+
case '[u] => Type.of[u]

tests/pos-macros/i4539.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import scala.quoted._
22
def test(using QuoteContext) = {
3-
val q = Type[String]
4-
Type[String]
3+
val q = Type.of[String]
4+
Type.of[String]
55
}

tests/pos-macros/i4539b.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ import scala.quoted._
22
def test(using QuoteContext): Unit = {
33
def f = {
44
{
5-
Type[String]
6-
Type[String]
5+
Type.of[String]
6+
Type.of[String]
77
}
88

9-
Type[String] match { case _ => }
10-
try Type[String] catch { case _ => }
9+
Type.of[String] match { case _ => }
10+
try Type.of[String] catch { case _ => }
1111

12-
Type[String]
13-
Type[String]
12+
Type.of[String]
13+
Type.of[String]
1414
}
1515

1616
def bar[T](t: Type[T]) = ???
17-
bar(Type[String])
17+
bar(Type.of[String])
1818

1919
class Baz[T](t: Type[T])
20-
new Baz(Type[String])
20+
new Baz(Type.of[String])
2121

2222
}

tests/pos-macros/i6140.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ sealed trait Trait[T] {
44
}
55

66
object O {
7-
def fn[T:Type](t : Trait[T])(using QuoteContext): Type[T] = Type[t.t]
7+
def fn[T:Type](t : Trait[T])(using QuoteContext): Type[T] = Type.of[t.t]
88
}

tests/pos-macros/i6142.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ object O {
44
def foo(using QuoteContext) = {
55
type T
66
implicit val _: scala.quoted.Type[T] = ???
7-
Type[List[T]]
7+
Type.of[List[T]]
88
()
99
}
1010
}

tests/pos-macros/i6210/Macros_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ object Macro {
55
${ impl[A, B] }
66

77
def impl[A : Type, B : Type](using QuoteContext): Expr[Any] = {
8-
val t = Type[Map[A, B]]
8+
val t = Type.of[Map[A, B]]
99
'{
1010
new Object().asInstanceOf[t.Underlying]
1111
???.asInstanceOf[t.Underlying]

tests/pos-macros/i7048b.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ trait IsExpr {
77
val foo: IsExpr = ???
88

99
def g()(using QuoteContext): Unit = {
10-
val a = Type[foo.Underlying]
10+
val a = Type.of[foo.Underlying]
1111
()
1212
}

tests/pos-macros/i7264.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import scala.quoted._
22
class Foo {
33
def f[T2](t: Type[T2])(using QuoteContext) = t match {
44
case '[ *:[Int, t2] ] =>
5-
Type[ *:[Int, t2] ]
5+
Type.of[ *:[Int, t2] ]
66
}
77
}

tests/pos-macros/i7264b.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import scala.quoted._
22
class Foo {
33
def f[T2: Type](e: Expr[T2])(using QuoteContext) = e match {
44
case '{ $x: *:[Int, t] } =>
5-
Type[ *:[Int, t] ]
5+
Type.of[ *:[Int, t] ]
66
}
77
}

tests/pos-macros/i7264c.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import scala.quoted._
22
class Foo {
33
def f[T2: Type](e: Expr[T2])(using QuoteContext) = e match {
44
case '{ $x: t0 } =>
5-
Type[t0] match
5+
Type.of[t0] match
66
case '[ *:[Int, t] ] =>
7-
Type[ *:[Int, t] ]
7+
Type.of[ *:[Int, t] ]
88
}
99
}

tests/pos-macros/i7405.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class Foo {
55
type X = Int // Level 1
66
val x: X = ???
77
${
8-
val t: Type[X] = Type[X] // Level 0
8+
val t: Type[X] = Type.of[X] // Level 0
99
'{ val y: t.Underlying = x }
1010
}
1111
}

tests/pos-macros/i7405b.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Foo {
1010
val x: X = ???
1111
type Z = x.Y
1212
${
13-
val t: Type[Z] = Type[Z]
13+
val t: Type[Z] = Type.of[Z]
1414
'{ val y: Z = x.y }
1515
'{ val y: t.Underlying = x.y }
1616
}

tests/pos-macros/i8100.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ def f[T: Type](using QuoteContext) =
1010
'{
1111
val m = $mm
1212
type ME = m.E
13-
${ g[ME](using Type[ME]) }
14-
${ g[m.E](using Type[ME]) }
15-
${ g[ME](using Type[m.E]) }
16-
${ g[m.E](using Type[m.E]) }
13+
${ g[ME](using Type.of[ME]) }
14+
${ g[m.E](using Type.of[ME]) }
15+
${ g[ME](using Type.of[m.E]) }
16+
${ g[m.E](using Type.of[m.E]) }
1717
// ${ g[ME] } // FIXME: issue seems to be in PickleQuotes
1818
// ${ g[m.E] } // FIXME: issue seems to be in PickleQuotes
1919
}

tests/pos-macros/i8302.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import scala.quoted._
22
def foo[T](using qctx: QuoteContext, tpe: Type[T]): Expr[Any] =
33
'{ (using qctx: QuoteContext) =>
44
type TT = T
5-
val t = Type[TT]
5+
val t = Type.of[TT]
66
???
77
}
88

tests/pos-macros/i9518/Macro_1.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ def shiftTerm(using QuoteContext): Expr[Unit] = {
1010
val nTree = '{ ??? : CB[Int] }.unseal
1111
val tp1 = TypeRepr.of[CB[Int]]
1212
val tp2 = TypeRepr.of[([X] =>> CB[X])[Int]]
13-
val ta = Type[[X] =>> CB[X]]
14-
val tp3 = TypeRepr.of(using Type[ta.Underlying[Int]])
13+
val ta = Type.of[[X] =>> CB[X]]
14+
val tp3 = TypeRepr.of(using Type.of[ta.Underlying[Int]])
1515
val tp4 = TypeRepr.of[CB].appliedTo(TypeRepr.of[Int])
1616
assert(nTree.tpe <:< tp1)
1717
assert(nTree.tpe <:< tp2)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import scala.quoted._
22
object Macro {
3-
inline def ff: Unit = ${impl(Type[Int])}
3+
inline def ff: Unit = ${impl(Type.of[Int])}
44
def impl(t: Type[Int])(using QuoteContext): Expr[Unit] = '{}
55
}

tests/pos-macros/quote-1.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ class Test(using QuoteContext) {
77
val z = $x
88
}
99

10-
f('{2})(Type[Int])
11-
f('{ true })(Type[Boolean])
10+
f('{2})(Type.of[Int])
11+
f('{ true })(Type.of[Boolean])
1212

1313
def g(es: Expr[String], t: Type[String]) =
14-
f('{ ($es + "!") :: Nil })(Type[List[t.Underlying]])
14+
f('{ ($es + "!") :: Nil })(Type.of[List[t.Underlying]])
1515
}

tests/run-macros/i8007/Macro_1.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import scala.quoted._
55
object Macro1 {
66

77
def mirrorFields[T: Type](using qctx: QuoteContext): List[String] =
8-
Type[T] match {
8+
Type.of[T] match {
99
case '[field *: fields] => Type.show[field] :: mirrorFields[fields]
1010
case '[EmptyTuple] => Nil
1111
}
@@ -19,7 +19,7 @@ object Macro1 {
1919
def test1Impl[T: Type](value: Expr[T])(using qctx: QuoteContext): Expr[List[String]] = {
2020
import qctx.reflect._
2121

22-
val mirrorTpe = Type[Mirror.Of[T]]
22+
val mirrorTpe = Type.of[Mirror.Of[T]]
2323

2424
Expr.summon(using mirrorTpe).get match {
2525
case '{ $m: Mirror.ProductOf[T]{ type MirroredElemLabels = elems } } => {

tests/run-macros/i8007/Macro_2.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ object Macro2 {
4545
def test2Impl[T: Type](value: Expr[T])(using qctx: QuoteContext): Expr[Unit] = {
4646
import qctx.reflect._
4747

48-
val mirrorTpe = Type[Mirror.Of[T]]
48+
val mirrorTpe = Type.of[Mirror.Of[T]]
4949
val mirrorExpr = Expr.summon(using mirrorTpe).get
5050
val derivedInstance = JsonEncoder.derived(mirrorExpr)
5151

tests/run-macros/i8007/Macro_3.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ object Eq {
3535
given derived[T: Type](using qctx: QuoteContext) as Expr[Eq[T]] = {
3636
import qctx.reflect._
3737

38-
val ev: Expr[Mirror.Of[T]] = Expr.summon(using Type[Mirror.Of[T]]).get
38+
val ev: Expr[Mirror.Of[T]] = Expr.summon(using Type.of[Mirror.Of[T]]).get
3939

4040
ev match {
4141
case '{ $m: Mirror.ProductOf[T] { type MirroredElemTypes = elementTypes }} =>

tests/run-macros/quote-indexed-map-by-name/quoted_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ object Index {
55

66
implicit def zero[K, T]: Index[K, (K, T)] = new Index(0)
77

8-
implicit inline def succ[K, H, T](implicit prev: => Index[K, T]): Index[K, (H, T)] = ${succImpl(Type[K], Type[H], Type[T])}
8+
implicit inline def succ[K, H, T](implicit prev: => Index[K, T]): Index[K, (H, T)] = ${succImpl(Type.of[K], Type.of[H], Type.of[T])}
99

1010
def succImpl[K, H, T](k: Type[K], h: Type[H], t: Type[T])(using QuoteContext): Expr[Index[K, (H, T)]] = {
1111
implicit val kk: Type[K] = k

tests/run-macros/string-context-implicits/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ private def showMeExpr(sc: Expr[StringContext], argsExpr: Expr[Seq[Any]])(using
88
case Varargs(argExprs) =>
99
val argShowedExprs = argExprs.map {
1010
case '{ $arg: tp } =>
11-
val showTp = Type[Show[tp]]
11+
val showTp = Type.of[Show[tp]]
1212
Expr.summon(using showTp) match {
1313
case Some(showExpr) => '{ $showExpr.show($arg) }
1414
case None => report.error(s"could not find implicit for ${Type.show[Show[tp]]}", arg); '{???}

0 commit comments

Comments
 (0)