Skip to content

Commit 4f331a3

Browse files
authored
Add regression tests (#17388)
Closes #13376
2 parents 4d53eab + fdfa1e4 commit 4f331a3

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

tests/neg-macros/i13376a.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import scala.quoted.*
2+
trait C:
3+
type T
4+
def foo: T
5+
inline def makro(inline x: C): x.T = ${ impl[x.type]('x) } // error // error
6+
def impl[CC <: C](xp: Expr[CC])(using Quotes): Expr[CC#T] = '{ $xp.foo }

tests/neg-macros/i13376b.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import scala.quoted.*
2+
trait C:
3+
type T
4+
def foo: T
5+
inline def makro(x: C): x.T = ${ impl[x.type]('x) }
6+
def impl[CC <: C](xp: Expr[CC])(using Quotes): Expr[CC#T] = '{ $xp.foo } // error

tests/pos-macros/i13376a.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import scala.quoted.*
2+
trait C:
3+
type T
4+
def foo: T
5+
inline def makro(x: C): x.T = ${ impl[x.T]('x) }
6+
def impl[U: Type](xp: Expr[C { def foo: U }])(using Quotes): Expr[U] =
7+
'{ $xp.foo }

tests/pos-macros/i13376b.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import scala.quoted.*
2+
trait C:
3+
type T
4+
def foo: T
5+
inline def makro(inline x: C): C#T = ${ impl('x) }
6+
def impl[U: Type](xp: Expr[C { def foo: U }])(using Quotes): Expr[U] =
7+
'{ $xp.foo }

0 commit comments

Comments
 (0)