File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ In foo
2+ In foo
Original file line number Diff line number Diff line change 1+ trait Magic [F ]:
2+ extension (x : Int ) def read : F
3+
4+ trait LowPrio :
5+ given Magic [String ]:
6+ extension(x : Int ) def read : String =
7+ println(" In string" )
8+ s " $x"
9+
10+ object test1 :
11+ object Magic extends LowPrio
12+
13+ opaque type Foo = String
14+ object Foo extends LowPrio :
15+ import Magic .{given _ }
16+ def apply (s : String ): Foo = s
17+
18+ given Magic [Foo ]:
19+ extension (x : Int ) def read : Foo =
20+ println(" In foo" )
21+ Foo (s " $x" )
22+
23+ def test : Unit =
24+ (3 .read: Foo )
25+
26+ object test2 :
27+ object Magic extends LowPrio :
28+ given Magic [Foo ]:
29+ extension (x : Int ) def read : Foo =
30+ println(" In foo" )
31+ Foo (s " $x" )
32+
33+ opaque type Foo = String
34+ object Foo extends LowPrio :
35+ import Magic .{given _ }
36+ def apply (s : String ): Foo = s
37+
38+ def test : Unit =
39+ (3 .read: Foo )
40+
41+
42+ @ main def Test =
43+ test1.Foo .test
44+ test2.Foo .test
You can’t perform that action at this time.
0 commit comments