Semicolon does not parse in match types
See original GitHub issueCompiler version
3.0.1
Minimized code
def Choice = (_: Any) match { case Int => Long; case Long => Int } // ok
type Choice[A] = A match { case Int => Long ; case Long => Int } // error
https://scastie.scala-lang.org/popPHRHGRTmfZ9n41Un3fQ
Output
'}' expected, but ';' found
Illegal start of toplevel definition
Expectation
Expected the semicolon to separate match type cases the same as for value matches. Couldn’t find a previous discussion on this, so I assume this is not intended?
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (11 by maintainers)
Top Results From Across the Web
Regex to match strings if a line doesnot contain semicolon at ...
I want to match some strings that doesnot contain any semicolon at the end of a line or middle of the matched Strings....
Read more >Guidelines For Using Semicolons & commas - Rust Users Forum
The comma is just for separating multiple cases in the match. Note that this match actually produces a value.
Read more >python - Regex to parse semicolon-delimited fields is too slow
As a general rule if you can, try to avoid non-greedy matches(i.e. the ? in .*? ). The regexes are easier to match...
Read more >SyntaxError: missing ; before statement - JavaScript | MDN
The JavaScript exception "missing ; before statement" occurs when there is a semicolon ( ; ) missing somewhere and can't be added by...
Read more >The revised syntax - The Caml language
In revised syntax, simple semicolons end the items of structures, signatures and objects. These semicolons are mandatory. The double semicolon is no more...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I agree, but I was also surprised because I’ve had an intuition that semicolons and newlines were usually interchangeable as separators. The semicolon in a term match being a property of the block and not a separator on its own wasn’t something I thought about.
I agree, but the reason I’ve tried this is because that’s the only way to write a match in one line in REPL.
But the BlockResult is itself optional.