Skip to content

Commit ce21f5a

Browse files
committed
Give up typechecking class definitions if basic type info is missing
1 parent c966be0 commit ce21f5a

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1447,7 +1447,11 @@ class Typer extends Namer
14471447
assignType(cpy.TypeDef(tdef)(name, rhs1), sym)
14481448
}
14491449

1450-
def typedClassDef(cdef: untpd.TypeDef, cls: ClassSymbol)(implicit ctx: Context) = track("typedClassDef") {
1450+
def typedClassDef(cdef: untpd.TypeDef, cls: ClassSymbol)(implicit ctx: Context): Tree = track("typedClassDef") {
1451+
if (!cls.info.isInstanceOf[ClassInfo]) {
1452+
assert(ctx.reporter.errorsReported)
1453+
return cdef.withType(UnspecifiedErrorType)
1454+
}
14511455
val TypeDef(name, impl @ Template(constr, parents, self, _)) = cdef
14521456
val superCtx = ctx.superCallContext
14531457

tests/neg/parser-stability-11.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package x0 {
2+
case class x0
3+
}
4+
package x0
5+
class x0

0 commit comments

Comments
 (0)