Exception while typechecking and compiling pattern matching with @
See original GitHub issueobject Fail {
case class So[+T]()
def main(args: Array[String]): Unit = {
So[Int]() match {
case p@So[_] => Console.println("Yep")
case _ => Console.println("Nope")
}
}
}
Compiler says,
exception occurred while typechecking /path/to/Src.scala
exception occurred while compiling /path/to/Src.scala
Works well if underscore in pattern matching is replaced with a specific type.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Clean code applied to .NET: avoid type checking with pattern ...
When data and methods are separate, you need other tools. The new pattern matching constructs enable cleaner syntax to examine data and ...
Read more >Pattern Matching Support #165 - microsoft/TypeScript - GitHub
I've seen some short notions about pattern matching on code plex, ... build in an Ometa-like library that allowed you to do pattern...
Read more >Typing and ML
constructs that restrict access to objects of a given type through a fixed set of ops defined for that type. Pattern matching. Function...
Read more >3.10. Exceptions — OCaml Programming - GitHub Pages
The exception pattern exception (Failure s) matches that value. So the above code will evaluate to "hd" . In general, exception patterns are...
Read more >Pattern Matching for Java — Semantics - OpenJDK
Type checking. Certain pattern matches can be rejected at compile time based strictly on static checks, such as: String s = "Hello"; if ......
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 FreeTop 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
Top GitHub Comments
@vuspenskiy Thanks for reporting, we’ll investigate the crash and why there’s no error message about syntax.
Regarding the syntax, we need to either use
p : So[_]
orp @ So(_)
in the code example.Following code has the same stack trace:
No worry @jvican , I’ll take care of it.