diff --git a/tests/neg/i19328.check b/tests/neg/i19328.check new file mode 100644 index 000000000000..357be5b2d530 --- /dev/null +++ b/tests/neg/i19328.check @@ -0,0 +1,4 @@ +-- [E172] Type Error: tests/neg/i19328.scala:14:5 ---------------------------------------------------------------------- +14 | bar // error: missing implicit (should not crash) + | ^ + | No given instance of type Boolean was found for parameter bool of method bar in object i19328 diff --git a/tests/neg/i19328.scala b/tests/neg/i19328.scala new file mode 100644 index 000000000000..246491e663bd --- /dev/null +++ b/tests/neg/i19328.scala @@ -0,0 +1,14 @@ +import scala.language.implicitConversions + +object i19328: + + trait Foo[B] + given foo[C]: Foo[C] = new Foo[C] {} + + type Id[A] = A + + implicit def wrapId[A](a: A): Id[A] = a + + def bar(using bool: Boolean): Unit = () + + bar // error: missing implicit (should not crash) diff --git a/tests/neg/i19328conversion.check b/tests/neg/i19328conversion.check new file mode 100644 index 000000000000..46d05211d43d --- /dev/null +++ b/tests/neg/i19328conversion.check @@ -0,0 +1,4 @@ +-- [E172] Type Error: tests/neg/i19328conversion.scala:13:5 ------------------------------------------------------------ +13 | bar // error: missing implicit (should not crash) + | ^ + | No given instance of type Boolean was found for parameter bool of method bar in object i19328conversion diff --git a/tests/neg/i19328conversion.scala b/tests/neg/i19328conversion.scala new file mode 100644 index 000000000000..46dd1058b579 --- /dev/null +++ b/tests/neg/i19328conversion.scala @@ -0,0 +1,13 @@ +object i19328conversion: + + trait Foo[B] + given foo[C]: Foo[C] = new Foo[C] {} + + type Id[A] = A + + given wrapId[A]: Conversion[A, Id[A]] with + def apply(x: A): Id[A] = x + + def bar(using bool: Boolean): Unit = () + + bar // error: missing implicit (should not crash)