Skip to content

Some usability improvements relating to errors #23370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jun 15, 2025

The changes in this PR were motivated by a very nice live coding session of Nicolas Rinaudo at the Scala User's group meetup in Krakow. We identified 4 areas where the feed-back of the compiler could be clearer:

  1. Trying to add a capture set to a pure type, such as in Int^ should give an error.
  2. Don't complain about inferred type not conforming to external type if the definition in question is in the empty package. Improve the error message for the remaining definitions.
  3. Don't show expected types as dependent function types if they were generic function types originally
  4. Don't print "box" unless we are in -Ycc-verbose mode.

odersky added 6 commits June 14, 2025 13:08
We now assume that all members of the empty package are meant to be used
alone or in projects without separate compilation. So the warning that an
inferred type does not conform to a type seen in separate compilation is
dropped because it was a hassle for experimentation.
Aligning an expected function type to be dependent gives the false expression that
we could have the parameter in a local capture. To avoid that misinterpretation,
convert an aligned dependent function as the expected type back to a generic functions
before displaying it in the error message.
Copy link
Contributor

@Linyxus Linyxus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

One next step, I guess, is to explain box adaptation errors without "actually" talking about boxes.

@Linyxus Linyxus assigned odersky and unassigned Linyxus Jun 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:experimental:cc Capture checking related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants