Skip to content

Simple snippet crashing when Ycheck:all #18901

Closed
@szymon-rd

Description

@szymon-rd

Compiler version

3.4.0-RC1-bin-20231109-c7b3d7b-NIGHTLY

Minimized code

//> using options -Ycheck:all

trait B(val y: Int)

class C extends B(20)  {
  def foo(): Unit = println(y)
}

This code comes from tests/init/neg/trait1. More snippets like this are crashing. After implementing #18634 the pipeline goes on instead of failing on the first warn, and the compiler crashes.

Output (click arrow to expand)

Fatal compiler crash when compiling: tests/init/neg/trait1.scala:
assertion failed: bad type (C.this.y : (): Int) for C.this.y # -1
	at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedIdent(TreeChecker.scala:435)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3100)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3215)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:398)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3293)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3297)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:381)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3409)
	at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:958)
	at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1118)
	at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:352)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedApply(TreeChecker.scala:515)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3132)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3216)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:398)
	at dotty.tools.dotc.typer.ProtoTypes$FunProto.$anonfun$7(ProtoTypes.scala:509)
	at dotty.tools.dotc.typer.ProtoTypes$FunProto.cacheTypedArg(ProtoTypes.scala:432)
	at dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:510)
	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:914)
	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:914)
	at dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:606)
	at dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:670)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions