-
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
Generate identifiers from conditions of match arms #380
Conversation
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.
Codecov Report
@@ Coverage Diff @@
## develop #380 +/- ##
===========================================
+ Coverage 87.00% 87.06% +0.06%
===========================================
Files 109 109
Lines 11950 12014 +64
===========================================
+ Hits 10397 10460 +63
- Misses 1553 1554 +1
|
@@ -0,0 +1,5 @@ | |||
match 10 | |||
n => | |||
print("10") |
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.
What about a test where we use an undefined variable in match arm body
Also one where we shadow a variable, but use it in the same manner as we would've the outer variable (e.g. assuming it is an Int
while it is a String
)
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.
No system for the second, though this is somewhat related to #375
* 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
Summary
Match arms treated same way as if arms:
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.
When we implementing pattern matching this system will need to be extended.
Added Tests
Happy
Sad
Started writing this while creating system of environment unions between match body arms.
However, I don't think that we actually want this behaviour.