-
Notifications
You must be signed in to change notification settings - Fork 659
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
Negative numbers in pattern matches are syntax errors #1261
Comments
Workaround: wrap the |
Thanks for the SSCCE. Follow along in #1374 |
Okay, making this it's own thing again because all the other things in the meta issue are done. For my future reference: I think it should only be possible to match on |
Haskell allows it if it's parenthesized:
OCaml works with or without parenthesis. |
F# (and Fable) and Scala (Scala.js) allow negative numbers in patterns as well. |
Rust also allows negatives: https://play.rust-lang.org/?gist=017c59b66ce0a3b5f080dad3cf9d2999&version=stable&mode=debug&edition=2015 . |
An update for 0.19: the workaround at #1261 (comment) no longer works. As far as I can tell, negative numbers aren't allowed in pattern matches as either the first or non-first pattern, and the presence/absence of parentheses does not make them allowed either. |
This is an sscce version of #1259
Gives a syntax error.
If you swap the
-1
pattern with the previous line, everything compiles, so the problem seems to affect only patterns after the first one.The text was updated successfully, but these errors were encountered: