Skip to content

Commit 8b300a7

Browse files
committed
Add more tests
1 parent d2f14e6 commit 8b300a7

File tree

8 files changed

+115
-0
lines changed

8 files changed

+115
-0
lines changed

tests/run/i8577a.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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 mac"$x" = 1
14+
assert(x == 1)

tests/run/i8577b.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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 mac"$x" = 1
14+
assert(x == 1)

tests/run/i8577c.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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 mac"$x" = 1
14+
assert(x == 1)

tests/run/i8577d.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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 mac"$x" = 1
14+
assert(x == 1)

tests/run/i8577e.scala

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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 mac"$x" = (1, 2)
14+
assert(x == (1, 2))
15+
16+
val mac"$y" = (1, "a")
17+
assert(y == (1, "a"))

tests/run/i8577f.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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 mac"$x" = 1
14+
assert(x == 1)

tests/run/i8577g.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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 mac"$x" = 1
14+
assert(x == 1)

tests/run/i8577h.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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 mac"$x" = 1
14+
assert(x == 1)

0 commit comments

Comments
 (0)