- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Bug? Problems declaring methods with @elidable
Wed, 2010-03-24, 08:43
I am trying to use the elidable annotation in my code but for some reason it is not working as I would expect. If you look in main you can see the "warning" method is being called as is the assert method from Predef. When I compile with:
scalac -Xelide-level 3000 ElidableExamples.scala
The assertion is not called (as I would expect) but warning is called. What am I doing wrong? Or is there a bug here?
package example
import scala.annotation.elidableimport scala.annotation.elidable._
object ElidableExamples { @elidable(WARNING) def warning = println("warning is being called")}
object Main extends Application { println("starting") ElidableExamples.warning println("ending")
assert(false, "assertion error")}
Output of scalac -Xelide-level 3000 ElidableExamples.scala
startingwarning is being calledending
Output of scalac -Xelide-level 10 ElidableExamples.scala
startingwarning is being called endingjava.lang.AssertionError: assertion failed: assertion error at scala.Predef$.assert(Predef.scala:79) at example.Main$.<init>(elidable.scala:16) at example.Main$.<clinit>(elidable.scala) .....
Jesse
scalac -Xelide-level 3000 ElidableExamples.scala
The assertion is not called (as I would expect) but warning is called. What am I doing wrong? Or is there a bug here?
package example
import scala.annotation.elidableimport scala.annotation.elidable._
object ElidableExamples { @elidable(WARNING) def warning = println("warning is being called")}
object Main extends Application { println("starting") ElidableExamples.warning println("ending")
assert(false, "assertion error")}
Output of scalac -Xelide-level 3000 ElidableExamples.scala
startingwarning is being calledending
Output of scalac -Xelide-level 10 ElidableExamples.scala
startingwarning is being called endingjava.lang.AssertionError: assertion failed: assertion error at scala.Predef$.assert(Predef.scala:79) at example.Main$.<init>(elidable.scala:16) at example.Main$.<clinit>(elidable.scala) .....
Jesse