Skip to content

Commit a3d3cf8

Browse files
Add tests to verify that crash is fixed elsewhere. Fixes #19328 (#19329)
Adding tests for crash reproduction #19328 that I reported, that was already fixed in nightly. I added the `pos` ones just in case, as protection against potential regressions. So far I managed to reproduce the crash only when the implicit was missing, as in `neg` tests. I can remove the `pos` tests if you think these are excessive. I ran only my own tests locally, they passed. Fixes #19328 cc @soronpo
2 parents c80333e + 8d7eda4 commit a3d3cf8

File tree

4 files changed

+35
-0
lines changed

4 files changed

+35
-0
lines changed

tests/neg/i19328.check

Lines changed: 4 additions & 0 deletions
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

Lines changed: 14 additions & 0 deletions
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

Lines changed: 4 additions & 0 deletions
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

Lines changed: 13 additions & 0 deletions
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)

0 commit comments

Comments
 (0)