You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: use existing IllegalVariableInPatternAlternative message
We have a `IllegalVariableInPatternAlternative` message that already
exists and was used in `Desugar`, but not in the more common place
people will see it in `Typer`. This just changes the message to align
with the one that people are used to seeing, but also adds in the
`explain` since we're re-using the existing message.
_Example before_
```
scala> Option((1, 2)) match
| case (1, n) | (n, 1) => "got a one!"
|
-- Error: ----------------------------------------------------------------------
2 | case (1, n) | (n, 1) => "got a one!"
| ^
| Illegal variable n in pattern alternative
-- Error: ----------------------------------------------------------------------
2 | case (1, n) | (n, 1) => "got a one!"
| ^
| Illegal variable n in pattern alternative
2 errors found
```
_Example after_
```
scala> Option((1, 2)) match
| case (1, n) | (n, 1) => "got a one!"
|
-- [E024] Syntax Error: --------------------------------------------------------
2 | case (1, n) | (n, 1) => "got a one!"
| ^
| Illegal variable n in pattern alternative
|
| longer explanation available when compiling with `-explain`
-- [E024] Syntax Error: --------------------------------------------------------
2 | case (1, n) | (n, 1) => "got a one!"
| ^
| Illegal variable n in pattern alternative
|
| longer explanation available when compiling with `-explain`
2 errors found
```
0 commit comments