Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use correct ErrorMessageID for EmptyCatchOrFinallyBlock
Previously we were always assigning this to `EmptyCatchOrFinallyBlockID` but both `EmptyCatchBlock` and `EmptyCatchAndFinallyBlock` both use this class and pass in their corresponding `ErrorMessageID`. This caused the following two code samples to give the same `ErrorMessageID` when they should have been different than they currently are: ```scala try {} ``` ```scala try {} catch {} finally {} ``` The second one gave this as an error: ``` scala> try {} catch {} finally {} -- [E000] Syntax Error: -------------------------------------------------------- 1 |try {} catch {} finally {} | ^^^^^^^^ | The catch block does not contain a valid expression, try | adding a case like - case e: Exception => to the block | | longer explanation available when compiling with `-explain` ``` When the ID should `E001`, `EmptyCatchBlockId`. Now this correctly returns: ``` scala> try {} catch{} finally {} -- [E001] Syntax Error: -------------------------------------------------------- 1 |try {} catch{} finally {} | ^^^^^^^ | The catch block does not contain a valid expression, try | adding a case like - case e: Exception => to the block | | longer explanation available when compiling with `-explain` ``` The first example with the missing catch and finally block should actually be `[E002]`.
- Loading branch information