Commit cf135dc
committed
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
```1 parent 7208bd8 commit cf135dc
File tree
3 files changed
+4
-4
lines changed- compiler/src/dotty/tools/dotc
- ast
- reporting
- typer
3 files changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1869 | 1869 | | |
1870 | 1870 | | |
1871 | 1871 | | |
1872 | | - | |
| 1872 | + | |
1873 | 1873 | | |
1874 | 1874 | | |
1875 | 1875 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
738 | 738 | | |
739 | 739 | | |
740 | 740 | | |
741 | | - | |
| 741 | + | |
742 | 742 | | |
743 | | - | |
| 743 | + | |
744 | 744 | | |
745 | 745 | | |
746 | 746 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2115 | 2115 | | |
2116 | 2116 | | |
2117 | 2117 | | |
2118 | | - | |
| 2118 | + | |
2119 | 2119 | | |
2120 | 2120 | | |
2121 | 2121 | | |
| |||
0 commit comments