Skip to content

Commit 43b80df

Browse files
committed
Add regreession test
1 parent 4868e41 commit 43b80df

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

compiler/test/dotc/pos-test-pickling.blacklist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,5 @@ i6142.scala
5252
i7519.scala
5353
i7264.scala
5454
i7264c.scala
55+
i8651b.scala
5556
macro-docs.scala

tests/pos/i8651a.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import scala.quoted._
2+
def coroutineImpl(using QuoteContext): Expr[Any] =
3+
'{
4+
new {
5+
def state: Int = 0
6+
${identity('state)}
7+
}
8+
}

tests/pos/i8651b.scala

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
abstract class Coroutine[+T] {
2+
def continue: Option[T]
3+
}
4+
5+
object Macros {
6+
7+
import scala.quoted._
8+
import scala.quoted.matching._
9+
10+
11+
inline def coroutine[T](inline body: Any): Coroutine[T] = ${ coroutineImpl('{body}) }
12+
13+
def coroutineImpl[T: Type](expr: Expr[_ <: Any])(implicit qtx: QuoteContext): Expr[Coroutine[T]] = {
14+
import qtx.tasty.{_, given _}
15+
16+
'{
17+
new Coroutine[T] {
18+
var state: Int = 0
19+
20+
def continue: Option[T] = ${
21+
'{
22+
state = 1 //if this line is commented there are no compile errors anymore!!!
23+
None
24+
}
25+
}
26+
27+
}
28+
}
29+
30+
}
31+
}

0 commit comments

Comments
 (0)