-
-
Notifications
You must be signed in to change notification settings - Fork 419
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
Compiler crash on "_" as argument in match case expression. #1922
Comments
Prior to commit e84506d, this resulted in the error:
so, I think i tmakes sense to change the tutorial to a working example and also fix the regression caused by e84506d. /cc @jemc |
I can fix the crash, but note that this example would never have worked in Pony - you should be getting the error @SeanTAllen showed. The Pony tutorial examples should all still work - none of those examples try to call a constructor/method with "don't care" ( The core reason this doesn't work, is that when you use a value for pattern matching, Pony first has to evaluate the expression to create the value, then compare it to the match operand. The expression |
You may already know this, since you said "I know how to program around this", but for the benefit of anybody else that comes across this ticket, the correct approach here would be: class A
fun ref test(b' : (B ref | None) ) =>
match b'
| let _: B => None
else
None
end
class B
var i : U32
new create(i': U32) =>
i = i' |
When using patterns which test for values, as described in the tutorial in https://tutorial.ponylang.org/pattern-matching/match.html, the compiler crashes. I know how to program around this, but perhaps this section should be removed from the tutorial.
Here code:
Here the compiler output
The text was updated successfully, but these errors were encountered: