Skip to content

Definitions in annotation parameters crash the compiler with Ycheck:all #7740

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sir-wabbit opened this issue Dec 13, 2019 · 0 comments
Closed

Comments

@sir-wabbit
Copy link

minimized code

class A(a: Any) extends annotation.StaticAnnotation
@A({val x = 0}) trait B
class A(a: Any) extends annotation.StaticAnnotation
@A({def x = 0}) trait B
Stack trace
checking testing/Test.scala after phase frontend
exception while typing @A(
  {
    def a: Int = 1
    ()
  }
) trait B() extends Object {} of class class dotty.tools.dotc.ast.Trees$TypeDef # 1125
exception while typing package <empty> {
  class A(a: Any) extends scala.annotation.Annotation(), annotation.
    StaticAnnotation
   {
    private[this] val a: Any
  }
  @A(
    {
      def a: Int = 1
      ()
    }
  ) trait B() extends Object {}
} of class class dotty.tools.dotc.ast.Trees$PackageDef # 1126
*** error while checking testing/Test.scala after phase frontend ***
exception occurred while compiling testing/Test.scala
Exception in thread "main" java.lang.AssertionError: assertion failed:  trait B tree does not define methods: method a
expected: Set(method <init>, method a)%, %
defined:
java.lang.AssertionError: assertion failed:  trait B tree does not define methods: method a
expected: Set(method <init>, method a)%, %
defined:  while compiling testing/Test.scala
	at dotty.DottyPredef$.assertFail(DottyPredef.scala:17)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedClassDef(TreeChecker.scala:410)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2089)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2156)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:123)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:301)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2193)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2205)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:286)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2232)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2276)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedStats(TreeChecker.scala:475)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1890)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2130)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2157)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:123)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:301)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2193)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2205)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:286)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2290)
	at dotty.tools.dotc.transform.TreeChecker.check(TreeChecker.scala:121)
	at dotty.tools.dotc.transform.TreeChecker.run(TreeChecker.scala:94)
	at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:315)
	at scala.collection.immutable.List.map(List.scala:219)
	at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:316)
	at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:161)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
	at dotty.tools.dotc.Run.runPhases$5(Run.scala:171)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:179)
	at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:65)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:186)
	at dotty.tools.dotc.Run.compileSources(Run.scala:123)
	at dotty.tools.dotc.Run.compile(Run.scala:106)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:36)
	at dotty.tools.dotc.Driver.process(Driver.scala:189)
	at dotty.tools.dotc.Driver.process(Driver.scala:158)
	at dotty.tools.dotc.Driver.process(Driver.scala:170)
	at dotty.tools.dotc.Driver.main(Driver.scala:197)
	at dotty.tools.dotc.Main.main(Main.scala)
anatoliykmetyuk added a commit to dotty-staging/dotty that referenced this issue Jul 3, 2020
anatoliykmetyuk added a commit that referenced this issue Jul 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant