Skip to content

Commit 3d708ac

Browse files
committed
Fix #7808: Weaken an assertion in Typer
1 parent d45fea0 commit 3d708ac

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
@@ -2548,7 +2548,7 @@ class Typer extends Namer
25482548
adapt(tree, pt, ctx.typerState.ownedVars)
25492549

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

25542554
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)