Skip to content

Commit 7a17422

Browse files
authored
Merge pull request #8911 from dotty-staging/fix-#8896
Fix 8896: Add regression test
2 parents c47e06f + 8251b57 commit 7a17422

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)