-
Notifications
You must be signed in to change notification settings - Fork 4
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
v0.3.5 | Error handling #388
Merged
Merged
Conversation
This file contains 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
* Scan top-level imports and create dummy classes In future we will need a system to get the actual signature of these classes as well. This is a future milestone. * Add sad test for too many aliases
* Add rule for parsing comments * Filter out comments in input when parsing Also remove all references to comments in parser, check, and generate stages. * Revert parse_statement default logic No need to change in this PR. * Remove parse comment logic from parse_statements
* Generate ids for variables in match arm conds Match arms treated same way as if arms: - For each new arm create new constraint set - Use similar logic to for loop variable initialisation. In future should have way to have some sort of union between constraints, much like env. This allows us to type check all possible execution paths. * Test undefined variable in match arm
* Update logic for raises in handle We now check in the generate stage whether a raise is covered correctly. Looks like we might not even need it in the unification stage. * Add expr type to covered expressions in handle - Fix generate stage to insert return (and assign) in proper locations within try except. * Check whether parents of exception covered Which is also valid. Remove `Raises` `Expect`, which gets rid of a lot of unnecessary logic in the unification stage. * Cleanup * Restore logic for same value of two types * Move shared logic match, handle to constrain_cases * Dynamically add raises to Environment Useful if exceptions in Mamba are not dealt with locally, but say in the function signature, which is allowed. * Add return in nested_exception_check.py The fact that the test still passed means that something is going wrong here under the hood. An issue has been made: #386
* Don't return copy of ConstraintBuilder Also fix a lot of environment contamination issues. * Fix nested exception test * Fun body must be expr if ret type present * Uncomment function with stmt body test * Don't preserve environment in condition - Remove unnecessary Environment references - Use variables directly in format! where in files from diff as suggested by clippy.
Codecov Report
@@ Coverage Diff @@
## main #388 +/- ##
==========================================
+ Coverage 87.00% 87.52% +0.52%
==========================================
Files 109 109
Lines 11950 12035 +85
==========================================
+ Hits 10397 10534 +137
+ Misses 1553 1501 -52
|
- Don't allow return outside function
* Isa logic takes class identifier * Test that isa expects identifier
* [ci skip] Primitives take union of types - Define input function as part of std Don't get why primitives_ast_fails. Somehow the argument types get leaked out. The class and constructor are properly created so something is likely going wrong with positional information. * Remove unnecessary same value expect logic This for some reason caused call to primitive constructors to trip up. * Proper constraint generation for call sit args * Define is_digit for string * Verify call super right way round
Noticed that the error messages looked weird. Turns out return token is 6 wide not 5.
* [ci skip] Add test assign to nullable class field * [ci skip] Fix field access constraint generation However now we have an issue that primitive comparisons seems to trip up. Something is up with how we generate constraints on the fly for field access in conjunction with function access. If we flip back the field_ty_exp, then we no longer get the failed definition_ast_verify test. It seems that if we fix the issue with the Union, we get nullability check issues and vice versa. * Some cleanup * Substitute also assumes constraints mutable ref - reinsert also assumes constraint mutable ref - Improve Position Display - Improve Constraint Display - Improve access logic * [ci skip] Field type super in field access gen * Add exception that Name may be super of any This means that in certain situations, a Name is a superset of another if it is a superset of just one of the types of other. For now, this is useful at a function call site where we generate such constraints on the fly. There, we only need the current expression to be super of one. However, seeing as we only have one use case at the moment, I'm not sure this logic belongs in Name itself. Perhaps this might be useful in future for fixing other issues. Issues such as #296 come to mind. - Unignore certain mutability test. * Cleanup
* Generate constr for match expression and arm conds * Do not propagate for handle - Add factorial test from README
* Don't generate access for equality check Also inherit constraints when entering class. Useful if you have defined variables you use within the class outside the class. * Add test for equality of different types
* Add tests for files in README Test readme examples to make sure: - Language is at the point where we expect it to be. - And that the examples themselves are correct. This servers as a baseline for current hotfixes. We will also update the examples in the README accordingly so that it conforms the current grammar. * Rename factorial check file * Update some README examples * is a logic excepts class identifier * [ci skip] is a logic excepts class identifier Bunch of other small modifications uncovered while trying to fix the README examples. * Fix handle test * Update version numbers in README
* Run test, quality, coverage on push to any branch * Run test on release
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.
Relevant issues
Closes milestone 0.3.5 | Error handling.
Executive Summary
isa
now properly expects an identifier, which identifies a class Isa logic takes class identifier #391