Skip to content
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

Null pointer exception raised when variable has not yet been declared #218

Open
agilot opened this issue Mar 20, 2024 · 1 comment
Open

Comments

@agilot
Copy link
Collaborator

agilot commented Mar 20, 2024

The following code snippet causes a NullPointerException.

object A extends lisa.Main{
  val f = x === x
  val x = variable
}
object C extends lisa.Main {
  A.x
}

This is due to the fact that x is declared after f. In more substantial pieces of code, this is not always obvious to spot, especially when objects start to be nested and variables imported from other files. In those cases, we may want to hint the user that the variable has not been declared yet.

@sankalpgambhir
Copy link
Member

sankalpgambhir commented Mar 20, 2024

I'm not sure if there is a good solution to this. Initialization of objects is generally out of our hands.

We can (and did) use the compiler option to ensure good initialization orders, but it makes compilation much slower, and for larger proofs, fails and prints very very long warnings.

So a while ago, we disabled the option again (I forget what it's called) :/

If you know of a better solution, we can look at it.

Edit: the option is -Ysafe-init

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants