Improve faulty compilation - unify handling of undeclared variables#13007
Conversation
|
CI logs say yeah, I understand that The question is more, how this PR can achieve that? |
|
I get it, the method called is |
62367bf to
4e332ae
Compare
1ef1d7f to
b96efe1
Compare
…able should be reused in the same function
…e full reparation
|
I hope I found the bug. I had to dig in the bootstrap and semi-blindly isolate faulty situations with handwritten |
|
Tests are ok minus a unrelated windows test |
Note: This is another attempt on #12935.
Previously, running
{ OpalCompiler new evaluate: 'a := 1. a'. OpalCompiler new evaluate: 'a'. OpalCompiler new options: #(+optionSkipSemanticWarnings); evaluate: 'a := 2. a'. OpalCompiler new options: #(+optionSkipSemanticWarnings); evaluate: 'a'. }gave #{1 1 nil nil} (and no exception or nothing).
That is not nice.
I have no clue but if I try to guess "why?" such different behavior exists, I suppose it because optionSkipSemanticWarnings might be circumstantially used on frontend-only (parse for highlighting for instance) instead of on full compilation.
With optionSkipSemanticWarnings, undeclared variables are not registered, so do not fill the global
Undeclaredwith garbage. (but maybe that's not the reason and I'm thinking too much)Nevertheless, this is bad.
In the PR I propose to
Now
{ OpalCompiler new evaluate: 'a := 1. a'. OpalCompiler new evaluate: 'a'. OpalCompiler new options: #(+optionSkipSemanticWarnings); evaluate: 'a := 2. a'. OpalCompiler new options: #(+optionSkipSemanticWarnings); evaluate: 'a'. }give #{1 1 2 2 }, it's still discutable but at least it is consistent (and memory efficient).
the PR will also help future and more aggressive PR by reducing the initial behavioral space.