Closed
Description
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)
...
Metadata
Metadata
Assignees
Labels
No labels