Skip to content

Commit ff42223

Browse files
committed
Add run tests
1 parent 6a898ad commit ff42223

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

tests/run/i9928.check

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
In foo
2+
In foo

tests/run/i9928.scala

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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

0 commit comments

Comments
 (0)