Skip to content

Commit 4cab7b2

Browse files
committed
Add README.md
0 parents  commit 4cab7b2

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
## What is scala-helpful-compiler-errors?
3+
4+
scala-helpful-compiler-errors is a list of Scala compiler errors that could be more helpful, especially for newcomers to Scala.
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.
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
11+
12+
Please submit pull requests with Dotty errors that could be more helpful, especially for newcomers to Scala.
13+
14+
## Template for new compiler errors or warnings
15+
16+
#### $errorName
17+
18+
* Scastie link: $scastieLink (here's a [starter](https://scastie.scala-lang.org/G4zbEq5dTFqSnRryRnTzwg))
19+
* Current error msg:
20+
```
21+
// paste output of dotty compiler error or warning
22+
```
23+
* Suggested helpful msg: `Oh no, it broke. Suggestion: don't break it`
24+
25+
## List of Dotty compiler errors that could be more helpful
26+
27+
#### If statement missing an else branch
28+
29+
* Scastie link: https://scastie.scala-lang.org/G4zbEq5dTFqSnRryRnTzwg
30+
* Current error msg:
31+
```
32+
Found: Unit
33+
Required: Int
34+
```
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`

0 commit comments

Comments
 (0)