-
Notifications
You must be signed in to change notification settings - Fork 57
Draft: Support for throw new Exception encoded as assert(false)
fixes #1512
#1521
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
Conversation
assert(false)
assert(false)
TODO:
|
Also rebase so we see changes more easily. :) |
@@ -31,10 +31,8 @@ class ExceptionLifting(override val s: Trees, override val t: imperative.Trees) | |||
|
|||
override def transform(e: s.Expr): t.Expr = e match { | |||
case s.Throw(exc) => | |||
println("SAM IN TRANSFORM THROW CASE") | |||
t.Assert(t.BooleanLiteral(false), Some(f"throw $exc"), t.UnitLiteral()) | |||
t.Assert(t.BooleanLiteral(false).setPos(e), Some(f"throw $exc unreachable"), t.NoTree(transform(fd.returnType)).setPos(e)).setPos(e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mario-bucev can you have a look at these setPos
? When we only do setPos
on the outer tree, the position is not reported. Hence this puts it everywhere, but that seems a bit brute force. Is there some guideline which position needs to be set for assert to report a meaningful line number?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the VC position, it's the condition position that matters. However, it's also a good practice to put the position on the outer tree as well since later phases will rely on its position (not only that, but it's also easier to debug).
assert(false)
assert(false)
fixes #1512
assert(false)
fixes #1512assert(false)
assert(false)
assert(false)
fixes #1512
6a1104e
to
c7b14a1
Compare
c7b14a1
to
de795bf
Compare
core/src/main/scala/stainless/extraction/imperative/Trees.scala
Outdated
Show resolved
Hide resolved
You need to fix i800b.scala since the message for |
No description provided.