-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Prefer internal.Reporter #6635
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
Prefer internal.Reporter #6635
Conversation
936804b
to
97b9eb8
Compare
This oughta be fun:
|
Unrelatedly, I wanted to benchmark for refactor AbstractReporter to a filter, but managed to get jmh to fail with a VerifyError. I don't know if this is a usual interaction? When I'm more comfortable with jmh I'll update.
I guess it happens sometimes. |
30a5fb7
to
2da1f8c
Compare
I did a quickie to restore the previous [test] [error] - macroAnnot/compile:compileIncremental failed: java.lang.NoSuchMethodError: xsbt.CachedCompiler0$Compiler.reporter_$eq(Lscala/tools/nsc/reporters/Reporter;)V I guess I'll cross that bridge, too, now that I've come to it. |
2da1f8c
to
8e628c9
Compare
I guess that was it. Not sure exactly what is different for sbt about macro-annot, or what a migration path would be; but maybe just leave it as-is. |
@adriaanm re: scala/bug#10869 (comment) This takes A custom reporter could filter The compiler (after previous refactor) tests I think the simplicity will benefit any solution for "warning suppression", in avoiding the "where is my output?" moments you get with logging systems. |
Regarding macroAnnot, Lukas diagnosed it as a limitation with the sbt compiler interface. The macro annot project uses the quick compiler for its scala instance, but the rest of the project uses starr. The macroAnnot tests should be ported to partest, and the quick scalaInstance dropped. |
@adriaanm thx for the xplanation. Also, my previous pun, "cross that bridge [method]", was a good one. Maybe an old one. |
I'm not sure what to think of this PR. Maybe I misunderstand it / its goals. The PR adds casts and type tests, and IMO doesn't make the code easier to understand, while |
@lrytz I see there are two commits, one to address the TODO about fixing internal.Reporter when partest is fixed (which is possible now); the second refactors the AbstractReporter/ConsoleReporter. The comments about sbt/ide/partest now just say sbt/ide. If you can't do anything because sbt, then I'd give up. I could let |
That sounds better. Let's do the actual cleanups, but not anticipate future ones by adding more code. |
4c84848
to
fa805ee
Compare
833a906
to
20e895b
Compare
My broom broke. |
605c4d8
to
1604aa7
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.
Looks good, thank you!
Ah, merge conflict.. Also maybe @adriaanm wants to take a quick scan of the change (maybe not). |
Complete the reporting refactor to use internal.Reporter. The partest blocker was fixed in v1.0.14. sbt and IDE are not validated, so reporters.Reporter is not removed. There are internal dependencies on cancel and comment functionality, which is resolved here by typecasing. Both features need to be implemented otherwise. ConsoleReporter is still a reporter.Reporter.
Let legacy Reporter handle adaptations. Reporter knows how to adapt new API and enforce maxerrs. The onus of supporting legacy reporter is on legacy reporter. Keep new reporters simple enough. Old reporters remain legacy reporters. Some tests expect to downcast to the reporter they assigned to `global.reporter`. Also avoid delegating to `NoReporter`.
The extended explanation attached to the first feature warning would fool the reporter if the feature is reported again at the same position. Use a conventional leading `"----"` to demarcate the explanation, and use only the prefix to see if the error has already been issued at a position.
1604aa7
to
7ca0a7f
Compare
Rebased, accommodated recent change to avoid |
Interesting failure in https://scala-ci.typesafe.com/job/scala-2.13.x-validate-main/2311/testReport/junit/scala.collection/FloatFormatTest/toOption/ Could this be due to recent changes to LazyList? |
/cc @szeiger could you take a look? |
I think it's just a bug in #6726 /cc @martijnhoekstra |
/rebuild |
Noting that this PR did not change the default for |
I noticed that in the 2.13.x branch, the benchmark harness which sets |
@retronym I'll take a look. I also neglected to update ReplReporter, which I'm doing now. |
@retronym Don't be mad, but apparently it was intentional to provide a minimal reporter for displaying errors before the compiler is built. Normally the real reporter is created with Global, and then Driver.process adopts global.reporter, replacing the temporary. In this case, Global is created with the current, minimal reporter; the benchmark global wouldn't respect I'll do the obvious thing and revert to creating a full-featured reporter for that start-up sequence. Not sure if there's a reason not to use Global.reporter (on the companion) right away. |
Complete the reporting refactor to use internal.Reporter.
The partest blocker was fixed in v1.0.14. sbt and IDE
are not validated, so reporters.Reporter is not removed.
Edit: Global takes
reporting.Reporter
so clients of Global are safe, including sbt's cancel and scaladoc's comment, and including macroAnnot.internal.Reporter
is adapted inreporting.Reporter
companion.AbstractReporter
andConsoleReporter
innards are refactored to handy traits, which are used in the new paradigm.Follow-up to scala/scala-partest#56