File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change 10
10
t3612.scala
11
11
reference
12
12
scala-days-2019-slides
13
+ i7048e.scala
13
14
14
15
# Stale symbol: package object scala
15
16
seqtype-cycle
Original file line number Diff line number Diff line change
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 = ()
You can’t perform that action at this time.
0 commit comments