Skip to content
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

Improve error message when using experimental definitions #19782

Conversation

nicolasstucki
Copy link
Contributor

When an experimental definition is used, the error message shows how to enable the experimental mode. Previously we only did this for experimental language features, but not for experimental definitions.

@nicolasstucki nicolasstucki self-assigned this Feb 26, 2024
@hamzaremmal

This comment was marked as outdated.

@nicolasstucki nicolasstucki marked this pull request as ready for review February 26, 2024 15:30
@nicolasstucki nicolasstucki force-pushed the improve-feedback-of-experimental-error-message branch from 3ad054c to ed991f5 Compare February 27, 2024 09:37
Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

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

Otherwise LTGM

7 |def bar: Int = foo // error
| ^^^
| Experimental definition may only be used under experimental mode:
| 1. In a definition marked as @experimental
Copy link
Contributor

Choose a reason for hiding this comment

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

We can make that clearer like this:

Experimental definition may only be used under experimental mode:
  |                 1. in a definition marked as @experimental, or
  |                 2. compiling with the -experimental compiler flag, or
  |                 3. with a nightly or snapshot version of the compiler.

Otherwise it could also be interpreted as "and".

@odersky odersky assigned nicolasstucki and unassigned odersky Feb 27, 2024
@nicolasstucki nicolasstucki force-pushed the improve-feedback-of-experimental-error-message branch from ed991f5 to 76f6c6e Compare February 28, 2024 09:00
When an experimental definition is used, the error message shows how to
enable the experimental mode. Previously we only did this for experimental
language features, but not for experimental definitions.
@nicolasstucki nicolasstucki force-pushed the improve-feedback-of-experimental-error-message branch from 76f6c6e to 89d6104 Compare February 28, 2024 16:09
@nicolasstucki nicolasstucki requested a review from odersky March 1, 2024 07:53
@nicolasstucki nicolasstucki merged commit 35a4a2b into scala:main Mar 1, 2024
19 checks passed
@nicolasstucki nicolasstucki deleted the improve-feedback-of-experimental-error-message branch March 1, 2024 13:24
@Kordyjan Kordyjan added this to the 3.4.2 milestone Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants