-
-
Notifications
You must be signed in to change notification settings - Fork 357
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
Improve faulty compilation - semantic error #12919
Improve faulty compilation - semantic error #12919
Conversation
Broken build, not related to this change:
|
8417bd7
to
181e142
Compare
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.
I think #isFaulty and #isError should go in #testing protocol and not #errors.
It is the standard in the Pharo image.
So, are comments useful if merged without answer ??? |
@demarey where is the standard/style guide about protocols/categories on Pharo? I did not find one. Personally, I prefer when methods are grouped by concerns, but if there are some rules I can follow them. |
@privat You have some rules encoded in the Method classifier. Foe example, you can see methods starting with
|
@demarey thank you for the pointer. Although a list of heuristics on substrings to determinate some default protocol is not what I envisioned for "rule" or a "standard" :) |
This PR extends AST API with basic methods for semantic error
addError:
to let compiler add semantic error information on NodeisError
to let AST user knows if the node is erroneousisFaulty
is extended to encompass both syntax error (RBParseErrorNode
) and other kind of errors (isError
)The internal implementation is to use a node property
#error
.Currently, (I'm not aware of a plan to add more semantic error, so this is not the better term) there seems to be only 2 semantic errors: unwritable variable (for some reason read-only and reserved are distinguished) and too much argument (for block and methods), the latter was moved from backend to the semantic analysis (because the whole point of semantic analysis is to get these errors before compilation).
The status of undeclared variable as error is unclear and seems to depend on UI related stuff (and possibly the humidity level).
The code is deliberately written as simple as possible, first attempts were too much complex for a limited gain.
A possible future improvement could be to unify and reify errors and warnings (strings are poor).
Maybe look at how critiques does the deal.
UI related concerns (like nice icons in the icon bar) will be added in a future PR.
Another question is how much people like (or rely) on the current semantic error/warnings exception hierarchy (
OCSemanticError
,OCStoreIntoReadOnlyVariableError
,OCStoreIntoReservedVariableError
,OCSemanticWarning
,OCShadowVariableWarning
,OCUndeclaredVariableWarning
)