This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Bug? Problems declaring methods with @elidable

No replies
Jesse Eichar
Joined: 2008-12-20,
User offline. Last seen 42 years 45 weeks ago.
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

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland