Skip to content

Commit

Permalink
add blog post about feedback for error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
bishabosha committed Oct 17, 2023
1 parent c0c9020 commit 90efa8b
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions blog/_posts/2023-10-17-feedback-wanted-error-messages.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
layout: blog-detail
post-type: blog
by: Jamie Thompson (Scala Center)
title: "We want to know which errors bug you the most"
description: "Feedback is wanted on confusing or unhelpful error messages"
---

## We want your feedback to improve error reporting

![example error message for a non-exhaustive pattern in a for-comprehension]({{ site.baseurl }}/resources/img/blog/2023-10-error-messages/splash-image.jpg)
**TL;DR: [click here][issue-template] to tell the Scala 3 core maintainers which error messages are unhelpful, confusing or otherwise suboptimal.**

### Why are we asking you

From [suggesting to import missing extension methods](https://docs.scala-lang.org/scala3/book/ca-extension-methods.html#import-extension-method) and more, Scala 3 tries to improve the ways that warnings and errors are reported to the user.
The idea being that when the user engages with reported problems, it should feel like having a conversation with a helpful tutor. By helping users to get back on track, we can make Scala easier to learn and make Scala friendlier to newcomers, and also keep experienced users more productive.

We know there is much more that can be done to continually improve the situation. As well as working to [expose diagnostics programatically](https://github.com/lampepfl/dotty/issues/14904), we are starting a new campaign to seek out confusing, annoying or unhelpful error/warning messages.

As compiler authors, we do try to provide good messages, but its possible for there to be shortcomings.
For example, the message may correctly report a problem, but not provide enough information to actually help the user.

A good example is reported in [this issue][lambda-issue], which documents how to improve the following sub-optimal error message:
```scala
val f: (Int, Int) => Int = Integer.compare(_ + 1, _)
// ^^^^^^^^^^^^^^^^^^^^^^^^^
// Wrong number of parameters, expected: 2
```

### How you can help

To help collect problematic errors, we have made a [new issue template][issue-template] to fill in on the Scala 3 repository.

The template helps you to write the report, by asking what was so confusing/unhelpful about the message, and then gives the option for you to suggest what would make the error more helpful, actionable, etc.

The improvement may be anywhere from more explicit explanation of the source of error, to even [adding a quick fix](https://github.com/lampepfl/dotty/pull/18314) that can be applied automatically. Again you can read [this issue][lambda-issue] for inspiration.

**Please [click here][issue-template] to open a new issue!**

### Results so far

We also opened similar threads last week on [Scala Users](https://users.scala-lang.org/t/feedback-wanted-confusing-or-unhelpful-error-messages/9553/5) and [Scala Contributors](https://contributors.scala-lang.org/t/feedback-wanted-confusing-unhelpful-error-messages/6346/2), asking for feedback. So far since we have recieved four reports from the community:
1. [lampepfl/dotty#18686: Better error message when accessing private members](https://github.com/lampepfl/dotty/issues/18686)
2. [lampepfl/dotty#18685: lazy val parameters and overrides](https://github.com/lampepfl/dotty/issues/18685)
3. [lampepfl/dotty#18684: confusing "Not found" error when I change "def foo()" to "val foo()"](https://github.com/lampepfl/dotty/issues/18684)
4. [lampepfl/dotty#18682: Can we have "did you mean..." for top-level names rather than just methods](https://github.com/lampepfl/dotty/issues/18682)

<br/>
And we already have a fix for `1.` thanks to Nicolas Stucki from EPFL, [see PR lampepfl/dotty#18690](https://github.com/lampepfl/dotty/pull/18690).

[lambda-issue]: https://github.com/lampepfl/dotty/issues/18657
[issue-template]: https://github.com/lampepfl/dotty/issues/new?assignees=&labels=itype%3Aenhancement%2C+area%3Areporting%2C+better-errors%2C+stat%3Aneeds+triage&projects=&template=improve-error.md&title=
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 90efa8b

Please sign in to comment.