diff --git a/compiler/src/dotty/tools/dotc/ast/Trees.scala b/compiler/src/dotty/tools/dotc/ast/Trees.scala index 8ae79347fc0f..0c8972fff871 100644 --- a/compiler/src/dotty/tools/dotc/ast/Trees.scala +++ b/compiler/src/dotty/tools/dotc/ast/Trees.scala @@ -1325,7 +1325,8 @@ object Trees { this(this(x, arg), annot) case Thicket(ts) => this(x, ts) - case _ if ctx.mode.is(Mode.Interactive) => + case _ if ctx.reporter.errorsReported || ctx.mode.is(Mode.Interactive) => + // In interactive mode, errors might come from previous runs. // In case of errors it may be that typed trees point to untyped ones. // The IDE can still traverse inside such trees, either in the run where errors // are reported, or in subsequent ones. diff --git a/tests/neg/i3487.scala b/tests/neg/i3487.scala new file mode 100644 index 000000000000..8a28100c66d2 --- /dev/null +++ b/tests/neg/i3487.scala @@ -0,0 +1,4 @@ +object Test { + type &:[H, T] = Int + val a: F[Int] { type X = Int &: String } = ??? // error +}