A goto to a different scope where a variable is declared before the label crashes when the variable is touched.
This is not totally unexpected behaviour to me, and is probably low-priority, but it might be nice to have an actual error, or even disallow this somehow.
Example:
method crash() {
var b: Bool
if (b) {
goto l
} else {
var x: Bool := true
label l
assert x
}
}
Output:
An exception was thrown while verifying method `crash`.
Verification aborted exceptionally: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: java.util.NoSuchElementException: java.util.NoSuchElementException: key not found: x
[TRUNCATED]
An exception occurred:
java.util.NoSuchElementException: java.util.NoSuchElementException: key not found: x
at [TRUNCATED]
[0] Verification aborted exceptionally (java.util.NoSuchElementException: java.util.NoSuchElementException: key not found: x, java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502))
A goto to a different scope where a variable is declared before the label crashes when the variable is touched.
This is not totally unexpected behaviour to me, and is probably low-priority, but it might be nice to have an actual error, or even disallow this somehow.
Example:
Output: