Skip to content

Commit 8251b57

Browse files
committed
Fix 8896: Add regression test
1 parent 9f49639 commit 8251b57

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

tests/neg/i8896-a.scala

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import scala.language.`3.0`
2+
3+
trait Foo[A]
4+
5+
object Example {
6+
7+
given as Foo[Int] {
8+
}
9+
10+
def foo0[A: Foo]: A => A = identity
11+
def foo1[A](implicit foo: Foo[A]): A => A = identity
12+
def foo2[A](using Foo[A]): A => A = identity
13+
14+
def test(): Unit = {
15+
foo0(32) // error
16+
foo1(32) // error
17+
foo2(32)
18+
}
19+
20+
}

tests/neg/i8896-b.scala

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import scala.language.`3.1`
2+
3+
trait Foo[A]
4+
5+
object Example {
6+
7+
given as Foo[Int] {
8+
}
9+
10+
def foo0[A: Foo]: A => A = identity
11+
def foo1[A](implicit foo: Foo[A]): A => A = identity
12+
def foo2[A](using Foo[A]): A => A = identity
13+
14+
def test(): Unit = {
15+
foo0(32)
16+
foo1(32) // error
17+
foo2(32)
18+
}
19+
20+
}

0 commit comments

Comments
 (0)