Skip to content

crash with compilable code: "java.lang.IllegalArgumentException: requirement failed" #2032

Closed
@helloqirun

Description

@helloqirun

scalac can compile but dotc crashes.

$ cat abc.scala

class foo(annotation: Any) extends annotation.StaticAnnotation
@foo(new AnyRef {}) trait A

$ dotc abc.scala

-- [E008] Member Not Found Error: abc.scala ------------------------------------
1 |class foo(annotation: Any) extends annotation.StaticAnnotation
  |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |                type `StaticAnnotation` is not a member of Any(annotation)

exception occurred while typechecking abc.scala

exception occurred while compiling abc.scala
Exception in thread "main" java.lang.IllegalArgumentException: requirement failed
	at scala.Predef$.require(Predef.scala:207)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.enterNoReplace(SymDenotations.scala:1538)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.enter(SymDenotations.scala:1528)
	at dotty.tools.dotc.typer.NamerContextOps$class.enter(Namer.scala:36)
	at dotty.tools.dotc.core.Contexts$Context.enter(Contexts.scala:57)
	at dotty.tools.dotc.typer.Namer.enterSymbol(Namer.scala:339)
	at dotty.tools.dotc.typer.Namer.dotty$tools$dotc$typer$Namer$$recur$1(Namer.scala:437)
<snipped>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions