Skip to content

Commit 9d69f39

Browse files
committed
Tweak neg-macro test
1 parent d43b993 commit 9d69f39

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

tests/neg-macros/i19842-a.check

+2-2
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

+3-5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import scala.annotation.{experimental, targetName}
44
import scala.quoted.*
55
import scala.util.Try
66

7-
object Macros {
8-
def makeSerializer[T: Type](using Quotes): Expr[Serializer[T]] = {
7+
object Macros:
8+
def makeSerializer[T: Type](using Quotes): Expr[Serializer[T]] =
99
import quotes.reflect.*
1010

1111
val tpe: TypeRepr = TypeRepr.of[T]
@@ -14,7 +14,7 @@ object Macros {
1414
val modSym: Symbol = Symbol.newModule(
1515
Symbol.spliceOwner,
1616
name,
17-
Flags.Implicit,
17+
Flags.Given,
1818
Flags.EmptyFlags,
1919
_ => List(TypeRepr.of[Object], TypeRepr.of[Serializer[T]]),
2020
_ => Nil,
@@ -25,5 +25,3 @@ object Macros {
2525
ClassDef.module(modSym, List(TypeTree.of[Serializer[T]]), Nil)
2626

2727
Block(List(modValDef, modClassDef), Ref(modSym)).asExprOf[Serializer[T]]
28-
}
29-
}

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

+2-2
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)