Skip to content

Commit 695c996

Browse files
committed
Tweak neg-macro test
1 parent de7d413 commit 695c996

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

tests/neg-macros/i19842-a.check

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
|Inline stack trace
1818
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1919
|This location contains code that was inlined from Test.scala:5
20-
5 | implicit inline def implicitMakeSerializer[T]: Serializer[T] = ${ Macros.makeSerializer[T] }
21-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
20+
5 | inline given [T] => Serializer[T] = ${ Macros.makeSerializer[T] }
21+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2222
---------------------------------------------------------------------------------------------------------------------

tests/neg-macros/i19842-a/Macro.scala

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import scala.annotation.{experimental, targetName}
22
import scala.quoted.*
33
import scala.util.Try
44

5-
object Macros {
6-
def makeSerializer[T: Type](using Quotes): Expr[Serializer[T]] = {
5+
object Macros:
6+
def makeSerializer[T: Type](using Quotes): Expr[Serializer[T]] =
77
import quotes.reflect.*
88

99
val tpe: TypeRepr = TypeRepr.of[T]
@@ -12,7 +12,7 @@ object Macros {
1212
val modSym: Symbol = Symbol.newModule(
1313
Symbol.spliceOwner,
1414
name,
15-
Flags.Implicit,
15+
Flags.Given,
1616
Flags.EmptyFlags,
1717
_ => List(TypeRepr.of[Object], TypeRepr.of[Serializer[T]]),
1818
_ => Nil,
@@ -23,5 +23,3 @@ object Macros {
2323
ClassDef.module(modSym, List(TypeTree.of[Serializer[T]]), Nil)
2424

2525
Block(List(modValDef, modClassDef), Ref(modSym)).asExprOf[Serializer[T]]
26-
}
27-
}

tests/neg-macros/i19842-a/Test.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
trait Serializer[@specialized T]
33

44
object Serializer:
5-
implicit inline def implicitMakeSerializer[T]: Serializer[T] = ${ Macros.makeSerializer[T] }
5+
inline given [T] => Serializer[T] = ${ Macros.makeSerializer[T] }
66

77
case class ValidationCls(string: String)
88

9-
@main def Test = summon[Serializer[ValidationCls]] // error
9+
@main def Test = summon[Serializer[ValidationCls]] // error

0 commit comments

Comments
 (0)