Skip to content

Macro expansion failed with missing positions #6048

Closed
@liufengyun

Description

@liufengyun

The macro system should have set default positions to all trees, however when compile ScalaTest, we encountered the following exception:

[error] ## Exception when compiling 511 sources to /Users/fliu/Documents/scalatest-upstream/scalatest.dotty/target/scala-0.14/classes
[error] assertion failed: position not set for org.scalactic.anyvals.PosZInt.+$extension3(SizeParam.this.minSize)(
[error]   org.scalactic.anyvals.PosZInt.widenToInt(SizeParam.this.sizeRange)
[error] ) # 2326942 of class dotty.tools.dotc.ast.Trees$Apply in /Users/fliu/Documents/dotty/library/src-bootstrapped/scala/tasty/reflect/utils/TreeUtils.scala
[error] dotty.DottyPredef$.assertFail(DottyPredef.scala:16)
[error] dotty.tools.dotc.typer.Typer$.assertPositioned(Typer.scala:62)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2096)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2112)
[error] dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:1246)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:559)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2032)

These kind of errors will cause a lot of troubles to macro authors -- as there is no way to explain why it happens and how to avoid that.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions