-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Unable to discard non-unit value using : Unit
#21557
Comments
Scala 2 PR: scala/scala#7563 |
@som-snytt in 2.13.15, iirc you removed the "(add |
I consider that "warn allowance" to be a relic of pre-nowarn, pre-Wconf years. In particular, it bestows extra semantics on ordinary syntax used in a weird way. |
hmm.
the design discussion at scala/scala#7563 is worth reviewing. Adriaan made some pretty persuasive arguments in favor of bare and writing out a more targeted so my initial reaction is that #7563 wasn't just a mistake or an artifact of |
I wonder if Worth adding that we use phrases "ascription" and "annotation" interchangeably, which suggests these are the same use case, but just different syntaxes. |
I think I recently found out that you can have multiple |
@dwijnand that works in Scala 2. I think in Scala 3 it is ignored as local store, but in Scala 2 introduces a field (result is retained).
in Scala 2
|
I remember some "already named _" errors, but who knows. Maybe they're 2.12 or something. |
Yes, it was "improved". But I sympathize with your cognitive dissonance. You have led so many Scala lives. |
If we decide to implement this, it seems like it could be a nice Spree-sized issue. What is needed to take decision? Should this be further discussed here, or during a compiler or core meeting? |
It seems small and innocent and has been a part of the Scala 2 language for a while, so unless @odersky come around and strongly argues against this before the next spree, I think we can go ahead and propose a PR for this. |
I am not sure what exactly is proposed here. |
We discussed this today during the compiler meeting and decided we should implement this. Let's tackle it during the next Spree 🥳 |
Sorry I have no insight, but "if it makes Seth happy, it can't be that baaad." |
Scala 2 allows to discard non-unit value using
: Unit
, however this behaviour seems to be missing in Scala 3.Compiler version
All Scala 3 versions
Minimized code
Output
Expectation
Should ignore non-uni statements with explicit
:Unit
When
: Unit
is missing compiler should hint how to silence the warning similarly as it's done in Scala 2The text was updated successfully, but these errors were encountered: