Skip to content

Commit a00d184

Browse files
committed
Add test
1 parent e29c481 commit a00d184

File tree

2 files changed

+40
-0
lines changed

2 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
@@ -10,6 +10,7 @@ t3486
1010
t3612.scala
1111
reference
1212
scala-days-2019-slides
13+
i7048e.scala
1314

1415
# Stale symbol: package object scala
1516
seqtype-cycle

tests/pos/i7048e.scala

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import scala.quoted.{given, _}
2+
3+
abstract class Test {
4+
type T
5+
6+
val T: Type[T]
7+
val getT: Type[T] = T // need this to avoid getting `null`
8+
given getT.type = getT
9+
10+
def foo with QuoteContext: Expr[Any] = {
11+
12+
val r = '{Option.empty[T]}
13+
14+
{
15+
val t: Test = this
16+
import t.{given}
17+
println(summon[Type[t.T]].show)
18+
// val r = '{Option.empty[t.T]} // access to value t from wrong staging level
19+
val r2 = '{Option.empty[${t.T}]}
20+
}
21+
22+
{
23+
val r1 = '{Option.empty[${T}]} // works
24+
val r2 = '{Option.empty[List[${T}]]} // works
25+
// val r3 = '{summon[Type[${T}]]} // access to Test.this from wrong staging level
26+
val r4 = '{summon[${T} <:< Any]}
27+
}
28+
29+
{
30+
val s = '{Option.empty[${T}]}
31+
val r = '{identity($s)} // works
32+
val r2 = '{identity(${s: Expr[Option[T]]})}
33+
}
34+
35+
r
36+
}
37+
}
38+
39+
@main def main = ()

0 commit comments

Comments
 (0)