-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Adopt the configurable warning mechanism from Scala 2.13.2 #8908
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
Comments
Is the way it's designed for scalac in that PR a good fit for the dotty codebase? I'm wondering to what extent implementing this for dotty will be able to crib code and design, beyond replicating the functionality itself. |
Our reporting mechanisms are fairly similar, so I would say yes, but I haven't looked at it in details. |
Dotty has one extra interesting thing: messages which are written as case classes (#1589) get a unique ID (https://github.com/lampepfl/dotty/blob/master/compiler/src/dotty/tools/dotc/reporting/ErrorMessageID.scala), this could be used to filter messages precisely. |
That sounds like a really nice augmentation of what the warnings suppression system can already do. From using it in 2.13.2, one of the biggest awkwardnesses is that warnings are printed after errors for some types of compilation error. I'd imagine dotty doesn't need to maintain CLI output parity, and hence can potentially do better in this regard? |
Normally, the order in which errors/warnings are reported is the order in which the compiler encounter them in both scalac and dotty. Does the configurable warning suppression mechanism affect that? |
Due to the design of the functionality, the suppression mechanism doesn't always work and you get unexpected output: From scala/scala#8373
|
Hmm, but even when there are parser errors, both scalac and dotty try to recover from them (e.g., by inserting "null") and run the typer anyway, not sure in what situation that wouldn't work. But it's true that if you need to wait until typer to know if a warning should be displayed, then all parser warnings need to be buffered so I see why they could appear after parser errors. The alternative would be to handle |
@lrytz For scala/scala#8373, did you consider treating |
I think it was code involving macros where I saw it, but I can't remember exactly. |
I did consider it, but decided for the symbolic approach for correctness (eg import rename). But I agree it's a trade off, and the other approach is also vaible. You'd have to know the position range of the subtree covered by a
Are there scanner warnings? |
It does sound like keeping the existing approach taken in Scala 2 is the best one for correctness, then. |
It's almost the weekend and school is out for the summer (or forever), so I'll take a look. I see there is already interest in keeping awesome messages as simple as possible, and I'm also interested in minimal ceremony around kinds/categories. I would also be interested in backporting to Scala 2. Next weekend. Sample previous comment on rendering, custom linting, tool advice such as Probably I've jinxed myself and it will be another two years before I remember to do this. |
There is interest in getting rid of them. These messages are a pain to maintain and pretty low quality at the moment. IMO "-explain" is not a nice mechanism to get help on an error message. That's better solved by a Google/StackOverflow query or even an IDE tooltip... |
For me, the awesome part is the awesome sauce, namely, the formatting. I didn't know there were strong opinions over here about the messages. Or wait, I did read "heavy and impractical" at the end of the ticket. I tried |
Yes, we discussed it several times during in-person meeting. The conclusion is that editing your sbt build to get extra info about an error message is a terrible workflow, and that the dotty team does not have the bandwidth to create and maintain these extra explanations. If somebody makes a PR that gets rid of all these extra error messages and the infrastructure that comes with them it would get merged. |
I'm taking advantage of the pandemic heat wave and long weekend to look at this. Summer isn't over until it falls below 40C. |
@som-snytt are you currently working on this issue? If not then I might take it over |
I gave it more thought -- it looks like I have a branch. Oh, I see the requisite "multivalued setting" thing was merged, so I could take this up again. The branch says I introduced the There are two takes: compiler should not be in the business of emitting warnings; but if third-party linters are popular, the standard reporter could filter their noise in a standard way. I have not yet thought about the My other question (in this area) was whether dotty wants to adopt scala 2.13 convention of
|
When in doubt, aligning ourselves with Scala 2 is a good idea I think. |
I think adoption of So yes, we still consider the new forms the gold standard for Scala 2, and we hope that Scala 3 will follow suit. I think it would be super if Scala 3 started actively suggesting the new forms, and personally I'd support a PR that made Scala 2 start to do it, too, though I don't know what the rest of the Lightbend team thinks about that. |
Nothing takes your mind off the US electoral process like a dotty issue, so I'll try to PR something that someone can adopt if desired. I noted (#7575 (comment)) that the unfortunate position on |
|
@som-snytt what's the status of this? Is choosing the proper compiler setting name the only blocker? |
The sooner the better of course, but I don't think it's critical for RC1. |
@prolativ I did a little bit on |
@som-snytt have you pushed the changes to some branch? Then maybe I could have a look |
@prolativ sorry for the delay responding, I had a bout of illness. Also sorry, now I see you asked me a month ago. I will PR #10236 with the wconf from september. Edit: I rebased those couple of commits, in case it's useful. Feel free to use it without attribution. I'm having trouble finding time to get back to it; I might during the holidays. https://github.com/som-snytt/dotty/tree/issue/10236 |
Thanks @som-snytt, this looks really useful! |
Rebased: https://github.com/lampepfl/dotty/compare/master...lrytz:wconf?expand=1 I'm planning to work on wconf in the next days. |
@lrytz thanks. The three plates (in the air) were compiler options and addressing "heavy weight" of error messages and wconf categories. I don't know if there was consensus on option style; I noticed sadly that the migration tool just normalizes your build if you were using the -VW style. I did not give much design thought to making the wconf lighter weight in terms of introducing categories; is there consensus that it's great when you know the wconf string to use, less great if you don't, or you're introducing a category when adding an error. |
See scala/scala#8373
The text was updated successfully, but these errors were encountered: