|
1 | 1 |
|
2 |
| -## What is scala-helpful-compiler-errors? |
| 2 | +## Scala helpful compiler errors |
3 | 3 |
|
4 |
| -scala-helpful-compiler-errors is a list of Scala compiler errors that could be more helpful, especially for newcomers to Scala. |
| 4 | +A list of Scala compiler errors that could be more helpful, especially for newcomers to Scala. |
5 | 5 |
|
6 |
| -Experienced Scala programmers maintain a mental map of compiler error -> actual problem. In many cases a compiler error can't know the "actual" problem, but in many cases it can or make a helpful guess. |
| 6 | +The list is focused on Scala 3's Dotty compiler. One day this list could be used to help a [larger project](https://contributors.scala-lang.org/t/towards-better-error-messages-in-scalac/1470/31) around compiler errors. Such a project seems unlikely to occur for Scala 2.13's scalac, which is why this list is Dotty-specific. |
7 | 7 |
|
8 |
| -The list of compiler errors focused on Scala 3's Dotty compiler. The idea behind this project is to build up a list of compiler errors that could one day be an input into a [larger project](https://contributors.scala-lang.org/t/towards-better-error-messages-in-scalac/1470/31) to make compiler errors more helpful. Such a project seems unlikely to occur for Scala 2.13's scalac, which is why this list is Dotty-specific. |
9 |
| - |
10 |
| -## PRs Welcome |
| 8 | +## Pull requests welcome |
11 | 9 |
|
12 | 10 | Please submit pull requests with Dotty errors that could be more helpful, especially for newcomers to Scala.
|
13 | 11 |
|
14 |
| -## Template for new compiler errors or warnings |
| 12 | +Use this template: |
15 | 13 |
|
16 | 14 | #### $errorName
|
17 | 15 |
|
18 |
| -* Scastie link: $scastieLink (here's a [starter](https://scastie.scala-lang.org/G4zbEq5dTFqSnRryRnTzwg)) |
| 16 | +* [Scastie example](https://scastie.scala-lang.org/G4zbEq5dTFqSnRryRnTzwg) |
19 | 17 | * Current error msg:
|
20 | 18 | ```
|
21 | 19 | // paste output of dotty compiler error or warning
|
22 | 20 | ```
|
23 |
| -* Suggested helpful msg: `Oh no, it broke. Suggestion: don't break it` |
| 21 | +* Example helpful msg: `Oh no, it broke. Suggestion: don't break it` |
24 | 22 |
|
25 | 23 | ## List of Dotty compiler errors that could be more helpful
|
26 | 24 |
|
27 |
| -#### If statement missing an else branch |
| 25 | +### If statement missing an else branch |
28 | 26 |
|
29 |
| -* Scastie link: https://scastie.scala-lang.org/G4zbEq5dTFqSnRryRnTzwg |
| 27 | +* [Scastie example](https://scastie.scala-lang.org/G4zbEq5dTFqSnRryRnTzwg) |
30 | 28 | * Current error msg:
|
31 | 29 | ```
|
32 | 30 | Found: Unit
|
33 | 31 | Required: Int
|
34 | 32 | ```
|
35 |
| -* Suggested helpful msg: `The result type of this if statement must be an Int, but there's no else branch, so it returns Unit on else. Suggestion: add an else branch` |
| 33 | +* Example helpful msg: `The result type of this if statement must be an Int, but there's no else branch, so it returns Unit on else. Suggestion: add an else branch` |
0 commit comments