Skip to content

Commit 64b4eb4

Browse files
authored
Merge pull request #7836 from dotty-staging/fix-#7808
Fix #7808: Weaken an assertion in Typer
2 parents 25fb86b + 3d708ac commit 64b4eb4

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2552,7 +2552,7 @@ class Typer extends Namer
25522552
adapt(tree, pt, ctx.typerState.ownedVars)
25532553

25542554
private def adapt1(tree: Tree, pt: Type, locked: TypeVars)(implicit ctx: Context): Tree = {
2555-
assert(pt.exists && !pt.isInstanceOf[ExprType])
2555+
assert(pt.exists && !pt.isInstanceOf[ExprType] || ctx.reporter.errorsReported)
25562556
def methodStr = err.refStr(methPart(tree).tpe)
25572557

25582558
def readapt(tree: Tree)(implicit ctx: Context) = adapt(tree, pt, locked)

tests/neg/i7808.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
object A {
2+
{
3+
val a: Int = 1
4+
object a { // error
5+
this match {
6+
case _ => ()
7+
}
8+
}
9+
}
10+
}

0 commit comments

Comments
 (0)