Skip to content

Commit 5ba994f

Browse files
committed
added regression tests for scala#11251
1 parent 47c463d commit 5ba994f

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed

compiler/test/dotty/tools/dotc/BootstrappedOnlyCompilationTests.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class BootstrappedOnlyCompilationTests {
2828
compileFilesInDir("tests/pos-macros", defaultOptions),
2929
compileFilesInDir("tests/pos-custom-args/semanticdb", defaultOptions.and("-Xsemanticdb")),
3030
compileDir("tests/pos-special/i7592", defaultOptions.and("-Yretain-trees")),
31+
compileDir("tests/pos-special/i11251", defaultOptions.and("-Ycheck:macros")),
32+
//compileDir("tests/pos-special/i11331", defaultOptions),
3133
).checkCompile()
3234
}
3335

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package i11251
2+
3+
import scala.quoted._
4+
5+
class SL:
6+
7+
inline def foo(inline step: Int => Int): SL =
8+
val f = step
9+
this
10+
11+
def run1(): Unit = ???
12+
13+
inline def run(): Unit =
14+
run1()
15+
16+
// works
17+
//object SL
18+
19+
object X:
20+
21+
inline def process[T](inline f:T) = ${
22+
processImpl[T]('f)
23+
}
24+
25+
def processImpl[T:Type](t:Expr[T])(using Quotes):Expr[T] =
26+
import quotes.reflect._
27+
val checker = new TreeMap() {}
28+
checker.transformTerm(t.asTerm)(Symbol.spliceOwner)
29+
t
30+
31+
32+

tests/pos-special/i11251/Test_2.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package i11251
2+
3+
4+
object Main {
5+
6+
def main(args:Array[String]):Unit =
7+
val sl = new SL()
8+
X.process(
9+
sl.foo(x=>x+1).run()
10+
)
11+
12+
}
13+
14+
15+

0 commit comments

Comments
 (0)