Skip to content

Commit 93e78dc

Browse files
authored
Merge pull request #7773 from dotty-staging/fix-#7750
Fix #7750: Circumvent an assertion failure for erroneous code
2 parents 56f467a + 9515da1 commit 93e78dc

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

compiler/src/dotty/tools/dotc/typer/Checking.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -716,9 +716,9 @@ trait Checking {
716716
def checkImplicitConversionUseOK(sym: Symbol, posd: Positioned)(implicit ctx: Context): Unit =
717717
if (sym.exists) {
718718
val conv =
719-
if (sym.isOneOf(GivenOrImplicit)) sym
719+
if (sym.isOneOf(GivenOrImplicit) || sym.info.isErroneous) sym
720720
else {
721-
assert(sym.name == nme.apply)
721+
assert(sym.name == nme.apply || ctx.reporter.errorsReported)
722722
sym.owner
723723
}
724724
val conversionOK =

tests/neg/i7750.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package object A extends runtime.A {
2+
implicit def a( : ) = 1() // error // error // error
3+
}

tests/neg/i7750a.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
def foo: Unit = {
2+
val a = (x: Int, y: String) => x + + y // error
3+
implicit def f[X](x: (X, String) => String) = (z: X) => (z, null) // error
4+
a(1)
5+
}

0 commit comments

Comments
 (0)