Skip to content

Commit 38f0b57

Browse files
committed
1 parent d9df0a2 commit 38f0b57

File tree

12 files changed

+178
-0
lines changed

12 files changed

+178
-0
lines changed

tests/pos-macros/i7110/Macro_1.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import scala.quoted._
2+
3+
object Macros {
4+
5+
inline def m[R](sym: Symantics[R]) : R = ${ mImpl[R]('{sym}) }
6+
7+
def mImpl[R: Type](using qctx: QuoteContext)(sym: Expr[Symantics[R]]): Expr[R] = '{
8+
$sym.Meth(42)
9+
}
10+
}
11+
12+
trait Symantics[R] {
13+
def Meth(exp: Int): R
14+
def Meth(): R
15+
}

tests/pos-macros/i7110/Test_2.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import scala.quoted._
2+
import Macros._
3+
4+
object Test {
5+
def main(args: Array[String]): Unit = {
6+
7+
val sym = new Symantics[Int] {
8+
def Meth(exp: Int): Int = exp
9+
def Meth(): Int = 42
10+
}
11+
12+
val test = m[Int](sym)
13+
}
14+
}

tests/pos-macros/i7110b/Macro_1.scala

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import scala.quoted._
2+
3+
object Macros {
4+
5+
inline def m[T](sym: Symantics {type R = T}) : T = ${ mImpl[T]('{sym}) }
6+
7+
def mImpl[T: Type](using qctx: QuoteContext)(sym: Expr[Symantics { type R = T }]): Expr[T] = '{
8+
$sym.Meth(42)
9+
}
10+
}
11+
12+
trait Symantics {
13+
type R
14+
def Meth(exp: Int): R
15+
def Meth(): R
16+
}

tests/pos-macros/i7110b/Test_2.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import scala.quoted._
2+
import Macros._
3+
4+
object Test {
5+
def main(args: Array[String]): Unit = {
6+
7+
val sym = new Symantics {
8+
type R = Int
9+
def Meth(exp: Int): Int = exp
10+
def Meth(): Int = 42
11+
}
12+
13+
val test = m(sym)
14+
}
15+
}

tests/pos-macros/i7110c/Macro_1.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 Macros {
4+
5+
inline def m[R](sym: Symantics[R]) : R = ${ mImpl[R]('{sym}) }
6+
7+
def mImpl[R: Type](using qctx: QuoteContext)(sym: Expr[Symantics[R]]): Expr[R] = '{
8+
$sym.Meth(42)
9+
}
10+
}
11+
12+
trait Symantics[R] {
13+
def Meth(exp: Int): R
14+
}

tests/pos-macros/i7110c/Test_2.scala

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import scala.quoted._
2+
import Macros._
3+
4+
object Test {
5+
def main(args: Array[String]): Unit = {
6+
7+
val sym = new Symantics2
8+
9+
val test = m[Int](sym)
10+
}
11+
}
12+
13+
class Symantics2 extends Symantics[Int] {
14+
def Meth(exp: Int): Int = exp
15+
def Meth(): Int = 42
16+
}

tests/pos-macros/i7110d/Macro_1.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 Macros {
4+
5+
inline def m(sym: Symantics) : Int = ${ mImpl('sym) }
6+
7+
def mImpl(using qctx: QuoteContext)(sym: Expr[Symantics]): Expr[Int] = '{
8+
$sym.Meth(42)
9+
}
10+
}
11+
12+
trait Symantics {
13+
def Meth(exp: Int): Int
14+
}

tests/pos-macros/i7110d/Test_2.scala

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import scala.quoted._
2+
import Macros._
3+
4+
object Test {
5+
def main(args: Array[String]): Unit = {
6+
7+
val sym = new Symantics2
8+
9+
val test = m(sym)
10+
}
11+
}
12+
13+
class Symantics2 extends Symantics {
14+
def Meth(exp: Int): Int = exp
15+
def Meth(): Int = 42
16+
}

tests/pos-macros/i7110e/Macro_1.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import scala.quoted._
2+
3+
object Macros {
4+
5+
inline def m(sym: Symantics, x: Int) : Int = ${ mImpl('sym, 'x) }
6+
7+
def mImpl(using qctx: QuoteContext)(sym: Expr[Symantics], x: Expr[Int]): Expr[Int] = '{
8+
$sym.Meth($x)
9+
}
10+
}
11+
12+
trait Symantics {
13+
def Meth[R](exp: R): Int
14+
def Meth(): Int
15+
}

tests/pos-macros/i7110e/Test_2.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import scala.quoted._
2+
import Macros._
3+
4+
object Test {
5+
def main(args: Array[String]): Unit = {
6+
7+
val sym = new Symantics {
8+
def Meth[R](exp: R): Int = 2
9+
def Meth(): Int = 42
10+
}
11+
12+
val test = m(sym, 3)
13+
}
14+
}

tests/pos-macros/i7110f/Macro_1.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import scala.quoted._
2+
3+
object Macros {
4+
5+
inline def m[R](sym: Symantics[R]) : R = ${ mImpl[R]('{sym}) }
6+
7+
def mImpl[R: Type](using qctx: QuoteContext)(sym: Expr[Symantics[R]]): Expr[R] = '{
8+
$sym.Meth(42)
9+
}
10+
}
11+
12+
trait Symantics[R] {
13+
def Meth(exp: Int): R
14+
def Meth(): R
15+
}

tests/pos-macros/i7110f/Test_2.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import scala.quoted._
2+
import Macros._
3+
4+
object Test {
5+
def main(args: Array[String]): Unit = {
6+
7+
val sym = new Symantics[Int] {
8+
def Meth(exp: Int): Int = exp
9+
def Meth(): Int = 42
10+
}
11+
12+
val test = m[Int](sym)
13+
}
14+
}

0 commit comments

Comments
 (0)