File tree Expand file tree Collapse file tree 8 files changed +115
-0
lines changed Expand file tree Collapse file tree 8 files changed +115
-0
lines changed Original file line number Diff line number Diff line change
1
+ import scala .quoted ._
2
+
3
+ object Macro :
4
+ opaque type StrCtx = StringContext
5
+ def apply (ctx : StringContext ): StrCtx = ctx
6
+ def unapply (ctx : StrCtx ): Option [StringContext ] = Some (ctx)
7
+
8
+ extension (ctx : StringContext ) def mac : Macro .StrCtx = Macro (ctx)
9
+ extension (inline ctx : Macro .StrCtx ) inline def unapplySeq (inline input : Int ): Option [Seq [Int ]] =
10
+ Some (Seq (input))
11
+
12
+ @ main def Test : Unit =
13
+ val ma c" $x" = 1
14
+ assert(x == 1 )
Original file line number Diff line number Diff line change
1
+ import scala .quoted ._
2
+
3
+ object Macro :
4
+ opaque type StrCtx = StringContext
5
+ def apply (ctx : StringContext ): StrCtx = ctx
6
+ def unapply (ctx : StrCtx ): Option [StringContext ] = Some (ctx)
7
+
8
+ extension (ctx : StringContext ) def mac : Macro .StrCtx = Macro (ctx)
9
+ extension (inline ctx : Macro .StrCtx ) inline def unapplySeq [U ](inline input : U ): Option [Seq [U ]] =
10
+ Some (Seq (input))
11
+
12
+ @ main def Test : Unit =
13
+ val ma c" $x" = 1
14
+ assert(x == 1 )
Original file line number Diff line number Diff line change
1
+ import scala .quoted ._
2
+
3
+ object Macro :
4
+ opaque type StrCtx = StringContext
5
+ def apply (ctx : StringContext ): StrCtx = ctx
6
+ def unapply (ctx : StrCtx ): Option [StringContext ] = Some (ctx)
7
+
8
+ extension (ctx : StringContext ) def mac : Macro .StrCtx = Macro (ctx)
9
+ extension [T ] (inline ctx : Macro .StrCtx ) inline def unapplySeq (inline input : T ): Option [Seq [T ]] =
10
+ Some (Seq (input))
11
+
12
+ @ main def Test : Unit =
13
+ val ma c" $x" = 1
14
+ assert(x == 1 )
Original file line number Diff line number Diff line change
1
+ import scala .quoted ._
2
+
3
+ object Macro :
4
+ opaque type StrCtx = StringContext
5
+ def apply (ctx : StringContext ): StrCtx = ctx
6
+ def unapply (ctx : StrCtx ): Option [StringContext ] = Some (ctx)
7
+
8
+ extension (ctx : StringContext ) def mac : Macro .StrCtx = Macro (ctx)
9
+ extension [T ] (inline ctx : Macro .StrCtx ) inline def unapplySeq [U ](inline input : T ): Option [Seq [T ]] =
10
+ Some (Seq (input))
11
+
12
+ @ main def Test : Unit =
13
+ val ma c" $x" = 1
14
+ assert(x == 1 )
Original file line number Diff line number Diff line change
1
+ import scala .quoted ._
2
+
3
+ object Macro :
4
+ opaque type StrCtx = StringContext
5
+ def apply (ctx : StringContext ): StrCtx = ctx
6
+ def unapply (ctx : StrCtx ): Option [StringContext ] = Some (ctx)
7
+
8
+ extension (ctx : StringContext ) def mac : Macro .StrCtx = Macro (ctx)
9
+ extension [T ] (inline ctx : Macro .StrCtx ) inline def unapplySeq [U ](inline input : (T , U )): Option [Seq [(T , U )]] =
10
+ Some (Seq (input))
11
+
12
+ @ main def Test : Unit =
13
+ val ma c" $x" = (1 , 2 )
14
+ assert(x == (1 , 2 ))
15
+
16
+ val ma c" $y" = (1 , " a" )
17
+ assert(y == (1 , " a" ))
Original file line number Diff line number Diff line change
1
+ import scala .quoted ._
2
+
3
+ object Macro :
4
+ opaque type StrCtx = StringContext
5
+ def apply (ctx : StringContext ): StrCtx = ctx
6
+ def unapply (ctx : StrCtx ): Option [StringContext ] = Some (ctx)
7
+
8
+ @ main def Test : Unit =
9
+ extension (ctx : StringContext ) def mac : Macro .StrCtx = Macro (ctx)
10
+ extension (inline ctx : Macro .StrCtx ) inline def unapplySeq [U ](inline input : U ): Option [Seq [U ]] =
11
+ Some (Seq (input))
12
+
13
+ val ma c" $x" = 1
14
+ assert(x == 1 )
Original file line number Diff line number Diff line change
1
+ import scala .quoted ._
2
+
3
+ object Macro :
4
+ opaque type StrCtx = StringContext
5
+ def apply (ctx : StringContext ): StrCtx = ctx
6
+ def unapply (ctx : StrCtx ): Option [StringContext ] = Some (ctx)
7
+
8
+ extension (ctx : StringContext ) def mac : Macro .StrCtx = Macro (ctx)
9
+ extension [T ] (inline ctx : Macro .StrCtx ) inline def unapplySeq [U ](inline input : T | U ): Option [Seq [T | U ]] =
10
+ Some (Seq (input))
11
+
12
+ @ main def Test : Unit =
13
+ val ma c" $x" = 1
14
+ assert(x == 1 )
Original file line number Diff line number Diff line change
1
+ import scala .quoted ._
2
+
3
+ object Macro :
4
+ opaque type StrCtx = StringContext
5
+ def apply (ctx : StringContext ): StrCtx = ctx
6
+ def unapply (ctx : StrCtx ): Option [StringContext ] = Some (ctx)
7
+
8
+ extension (ctx : StringContext ) def mac : Macro .StrCtx = Macro (ctx)
9
+ extension [T ] (inline ctx : Macro .StrCtx ) inline def unapplySeq [U ](inline input : U | T ): Option [Seq [T | U ]] =
10
+ Some (Seq (input))
11
+
12
+ @ main def Test : Unit =
13
+ val ma c" $x" = 1
14
+ assert(x == 1 )
You can’t perform that action at this time.
0 commit comments