Skip to content

Compiler crash after error message "@static members should have companion class" #1220

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
lrytz opened this issue Apr 15, 2016 · 0 comments
Closed

Comments

@lrytz
Copy link
Member

lrytz commented Apr 15, 2016

import annotation.static
object T {
  @static val foo = 10
}

gives

/Users/luc/scala/scala/sandbox/Test.scala:6: error: object that conatin @static members should have companion class
  @static val foo = 10 /* {
              ^
exception while transforming () extends Object() { this: T.type =>
  @annotation.static() val foo: Int = 10
} of class class dotty.tools.dotc.ast.Trees$Template # 81
exception while transforming final module class T$() extends Object() { this: T.type =>
  @annotation.static() val foo: Int = 10
} of class class dotty.tools.dotc.ast.Trees$TypeDef # 82
exception while transforming package <empty> {
  final lazy module val T: T$ = new T$()
  final module class T$() extends Object() { this: T.type =>
    @annotation.static() val foo: Int = 10
  }
} of class class dotty.tools.dotc.ast.Trees$PackageDef # 83
exception occurred while compiling /Users/luc/scala/scala/sandbox/Test.scala
Exception in thread "main" java.lang.ClassCastException: dotty.tools.dotc.core.Symbols$NoSymbol$ cannot be cast to dotty.tools.dotc.core.Symbols$ClassSymbol
    at dotty.tools.dotc.core.Symbols$Symbol.asClass(Symbols.scala:409)
    at dotty.tools.dotc.transform.CheckStatic$$anonfun$transformTemplate$1.apply(CheckStatic.scala:64)
...
DarkDimius added a commit to dotty-staging/dotty that referenced this issue Apr 18, 2016
DarkDimius added a commit to dotty-staging/dotty that referenced this issue Apr 18, 2016
DarkDimius added a commit to dotty-staging/dotty that referenced this issue Jun 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant