fix definition of TRY in the language specification#4257
fix definition of TRY in the language specification#4257adriaanm merged 1 commit intoscala:2.11.xfrom
Conversation
|
Thanks for the patch, but it isn't actually enough. Catch can also take a PartialFunction: scala> def pf: PartialFunction[Throwable, Unit] = { case e: Exception => println("Caught") }
pf: PartialFunction[Throwable,Unit]
scala> try throw new Exception catch pf
CaughtAny chance you can fix that also? |
|
@Ichoran Good catch! How about: Syntactically, it takes cases or Expr: |
|
Obligatory use case: |
|
is |
|
@193s for the try, no, as witnessed by: That's probably an unnecessary limitation, since it only needs to look ahead one token to see if cases or a block is coming. Compare: In fact, it does the look-ahead for catches, which is why it works. |
|
@som-snytt Thanks! |
|
Thanks, @193s! |
fix definition of TRY in the language specification
|
This PR changes it to Expr on 2.12. There was a related parsing bug SI-5887. One could argue about the generalization to It looks like 2.11 wasn't merged forward yet. |
No description provided.