Conversation
Local variables with a static type defined within a loop need repeated visits until a fixed point is reached. We did that correctly for method bodies in nitlang#1257 but attribute bodies were left out. Let's apply the same logic for both method bodies and attributes. This addresses miscompiles. Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Test Results 67 files 337 suites 15m 10s ⏱️ Results for commit bc40040. ♻️ This comment has been updated with latest results. |
Add another missing type-checking step to attribute blocks. The warnings on useless null tests, type tests and casts are reported by a visit after the typing. This visit was introduced for method bodies in nitlang#1524 but attributes were left out, so these warnings were never reported in attribute blocks or in the expressions of attribute initializers. Let's gather the fixed point and this visit in `visit_body`, shared by method and attribute bodies. Remove the dead `do_typing` and its call site to the old `visit_body`. Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Address two issues in the body block of an attribute: one miscompile and some missing diagnostics.
Local variables with a static type defined within a loop need repeated visits until a fixed point is reached. We did that correctly for method bodies in Fix type adaptation when there is loops #1257 but attribute bodies were left out.
The warnings on useless null tests, type tests and casts are reported by a visit after the typing. This was introduced for methods in Adaptive typing: fix buggy warning messages #1524 but attributes with a body never triggered it.
Both issues are addressed by sharing the logic visiting the body between methods and attributes, applying the correct method logic to attributes as well.