Skip to content

"exception occurred while typechecking" using "typeChecks" under ScalaTest #10366

@flomebul

Description

@flomebul

Minimized code

The crash occured when compiling thus with 3.0.0-M1 and ScalaTest 3.2.3

import scala.compiletime.testing._
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers

class ABug4Spec extends AnyFlatSpec with Matchers {
  "SealedTrait" should "be sealed" in {
    typeChecks("trait ExtendTrait extends Some") shouldBe false
  }
}

Output (click arrow to expand)

[info] exception occurred while typechecking D:\Users\Luc\Documents\Home\ProjSbts\Scala_3.0\asuivre\src\test\scala\asuivre\IssueBug4.scala
[info] exception occurred while compiling D:\Users\Luc\Documents\Home\ProjSbts\Scala_3.0\asuivre\src\test\scala\asuivre\IssueBug4.scala
java.lang.AssertionError: assertion failed: position not set for this.convertToAnyShouldWrapper(false) # -1 of class dotty.tools.dotc.ast.Trees$Apply in D:\Users\Luc\Documents\Home\ProjSbts\Scala_3.0\asuivre\src\test\scala\asuivre\IssueBug4.scala while compiling D:\Users\Luc\Documents\Home\ProjSbts\Scala_3.0\asuivre\src\test\scala\asuivre\IssueBug4.scala
[error] ## Exception when compiling 1 sources to D:\Users\Luc\Documents\Home\ProjSbts\Scala_3.0\asuivre\target\scala-3.0.0-M1\test-classes
[error] java.lang.AssertionError: assertion failed: position not set for this.convertToAnyShouldWrapper(false) # -1 of class dotty.tools.dotc.ast.Trees$Apply in D:\Users\Luc\Documents\Home\ProjSbts\Scala_3.0\asuivre\src\test\scala\asuivre\IssueBug4.scala
[error] dotty.DottyPredef$.assertFail(DottyPredef.scala:17)
[error] dotty.tools.dotc.typer.Typer$.assertPositioned(Typer.scala:64)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2584)
....

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions