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
Deprecate top-level wildcard type parameters #9712
Conversation
3699aea
to
7a03d7a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes LGTM, but @som-snytt would you mind revising the PR description to be more self-contained and user-facing? current text seems more aimed at implementers and assumes familiarity with the ticket. (it's fine to include such reviewer-aimed commentary, but at the end, after the what-users-need-to-know part)
in particular, it wasn't obvious to me before I groveled through the diffs that this alters both default behaviors and under--Xsource:3
behaviors
@SethTisue let me check what they're doing at https://docs.scala-lang.org/scala3/reference/changed-features/wildcards.html I can't get that to work, and I haven't tried their advice to use |
It's already a month old, enough for a conflict in Parsers. |
|
679c98b
to
77387d7
Compare
@som-snytt do you mind if we reopen and merge this? |
If this is an obvious win to someone, it's OK. It may belong to the long tail of "smudges on the eyeglasses of Scala 2 which no one notices until you point it out". Maybe it helps align with Scala 3? |
@dwijnand final review(/merge)? |
The community build noticed that @lihaoyi's Fastparse library actually recommends top-level
But then what's peculiar is that the log doesn't merely show a deprecation warning being emitted, as one might have expected. Instead we see:
So, that's a regression, perhaps? (If so, then once again we discover that no good deed goes unpunished...) We'll need to do something about this before releasing 2.13.7, since fastparse is fairly widely used. @som-snytt are you interested in digging into this sometime this week? If not, I can dig into it. Simply reverting the entire PR for 2.13.7 and then perhaps revisiting for 2.13.8 is of course a perfectly fine fallback plan. |
It's peculiar that only a single test case in a big file full of tests is affected. And it's interesting that if we give names to all of the def leftTag[A: P] = P( "<" ~ (!">" ~ AnyChar).rep(1).! ~ ">")
def rightTag[B: P](s: String) = P( "</" ~ s.! ~ ">" )
def xml[C: P] = P( leftTag.flatMap(rightTag) ) then we still get the same "could not find implicit value" error, even on 2.13.6. This has me wondering if something actually progressed here, rather than regressed. |
changing |
I never got to the bottom of this, but I've decided that I've spent enough time on it and I'm comfortable letting this change stand for 2.13.7, because:
If actual fastparse users run afoul of this, they can report the problem to the maintainers of fastparse, and if those maintainers conclude that this PR contains a regression in Scala, it's up to them to provided a detailed substantiation of that. fyi @lrytz |
As an aside, I feel like I distinctly remember that Martin saw the fyi @lihaoyi |
Sounds to me like the underscores aren't the problem, and the real problem is the behavior of eta-expanding methods taking implicit parameters has changed? |
@lihaoyi I haven't observed any behavior difference unless type parameters named |
Got it, adding an explocit (_) seems easy enough |
@som-snytt
Maybe we could refine the wording to be more clear:
? |
The top of this page says: Deprecates using underscore (_) as a type parameter, except for "higher-order type parameters." Is top-level type param ever called first-order? I closed this PR, but someone else might be invested in editing the message. |
Yes, a PR on that would be welcome. |
Hi, Could anybody please explain, what is the proper way to use fastparse with 2.13.7? I get this kind of warning for each parser I have: |
@limansky I'm about to tweak the message (with a related fix) but compare
Also |
They should work - do they not? |
@som-snytt do you mean that only I can do is to suppress the warnings, but not to fix the root cause? |
Deprecates using underscore (
_
) as a type parameter, except for "higher-order type parameters."Under
-Xsource:3
, issue an error instead of merely warning.Fixes scala/bug#5606