Skip to content

Commit

Permalink
Add regression test
Browse files Browse the repository at this point in the history
Fixes #15475
  • Loading branch information
nicolasstucki committed Feb 13, 2023
1 parent 1fce02e commit 00d3079
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/pos-macros/i15475.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
def test =
transform {
val a: Seq[Generic[?]] = ???
a.foreach { to =>
to.mthd()
}
}

transparent inline def transform[T](expr: T): T = ???

trait Generic[+T] {
def mthd(): Generic[T] = ???
}
17 changes: 17 additions & 0 deletions tests/pos-macros/i15475a/Macro_1.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package x

import scala.quoted.*


transparent inline def xtransform[T](inline expr:T) = ${
X.transform('expr)
}

object X {

def transform[T:Type](x: Expr[T])(using Quotes):Expr[T] = {
import quotes.reflect.*
x
}

}
15 changes: 15 additions & 0 deletions tests/pos-macros/i15475a/Test_2.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package x

def hello = {
xtransform {
val a: Seq[Generic[?]] = null
a
.foreach { to =>
to.mthd()
}
}
}

trait Generic[+T] {
def mthd(): Generic[T] = this
}

0 comments on commit 00d3079

Please sign in to comment.