Skip to content

Commit 34f68f5

Browse files
committed
Add tests to verify that crash is fixed elsewhere. Fixes #19328
1 parent beaf7b4 commit 34f68f5

6 files changed

+66
-0
lines changed

tests/neg/i19328.check

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-- [E172] Type Error: tests/neg/i19328.scala:14:5 ----------------------------------------------------------------------
2+
14 | bar // error: missing implicit (should not crash)
3+
| ^
4+
| No given instance of type Boolean was found for parameter bool of method bar in object i19328

tests/neg/i19328.scala

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import scala.language.implicitConversions
2+
3+
object i19328:
4+
5+
trait Foo[B]
6+
given foo[C]: Foo[C] = new Foo[C] {}
7+
8+
type Id[A] = A
9+
10+
implicit def wrapId[A](a: A): Id[A] = a
11+
12+
def bar(using bool: Boolean): Unit = ()
13+
14+
bar // error: missing implicit (should not crash)

tests/neg/i19328conversion.check

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-- [E172] Type Error: tests/neg/i19328conversion.scala:13:5 ------------------------------------------------------------
2+
13 | bar // error: missing implicit (should not crash)
3+
| ^
4+
| No given instance of type Boolean was found for parameter bool of method bar in object i19328conversion

tests/neg/i19328conversion.scala

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
object i19328conversion:
2+
3+
trait Foo[B]
4+
given foo[C]: Foo[C] = new Foo[C] {}
5+
6+
type Id[A] = A
7+
8+
given wrapId[A]: Conversion[A, Id[A]] with
9+
def apply(x: A): Id[A] = x
10+
11+
def bar(using bool: Boolean): Unit = ()
12+
13+
bar // error: missing implicit (should not crash)

tests/pos/i19328.scala

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import scala.language.implicitConversions
2+
3+
object i19328:
4+
5+
trait Foo[B]
6+
given foo[C]: Foo[C] = new Foo[C] {}
7+
8+
type Id[A] = A
9+
10+
implicit def wrapId[A](a: A): Id[A] = a
11+
12+
def bar(using bool: Boolean): Unit = ()
13+
14+
given Boolean = true
15+
16+
bar

tests/pos/i19328conversion.scala

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
object i19328conversion:
2+
3+
trait Foo[B]
4+
given foo[C]: Foo[C] = new Foo[C] {}
5+
6+
type Id[A] = A
7+
8+
given wrapId[A]: Conversion[A, Id[A]] with
9+
def apply(x: A): Id[A] = x
10+
11+
def bar(using bool: Boolean): Unit = ()
12+
13+
given Boolean = true
14+
15+
bar

0 commit comments

Comments
 (0)