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
Simplify reporters #8338
Simplify reporters #8338
Conversation
cc @ghik. cc @som-snytt let me know what you think. I think preferring |
This can be handy for retaining source compatibility. Or for when you just know better. Fixes scala/bug#8908
ContextReporter no longer extends Reporter. The ContextReporter is only used in the context, and it reports through Global.reporter. But it's never assigned to Global.reporter. So better keep the two separate. This also saves the inherited fields (ContextReporters are allocated manies, type checking every Apply uses silent). Remove most reporter mixins to get to a linear inheritance structure, no more delegating reporters. Ignore the `force` parameter of `info0`. Some quirks to remain source compatible with the sbt compiler interface. `nsc.reporters.Reporter` only exists for sbt compatibility, Global has a `FilteringReporter`. `-Xreporter` must be a FilteringReporter.
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.
Nice cleanup! A few small comments.
@@ -566,7 +566,7 @@ class PipelineMainClass(argFiles: Seq[Path], pipelineSettings: PipelineMain.Pipe | |||
diagnostic.getKind match { | |||
case Kind.ERROR => reporter.error(position, msg) | |||
case Kind.WARNING | Kind.MANDATORY_WARNING => reporter.warning(position, msg) |
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.
For future reference, should this distinction be captured in the FilteringReporter interface?
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.
Is the question whether we should have multiple kinds of warnings? I personally think simpler is better.
src/compiler/scala/tools/nsc/reporters/ForwardingReporter.scala
Outdated
Show resolved
Hide resolved
* global.reporter = myReporter | ||
* }}} | ||
*/ | ||
class ForwardingReporter(delegate: FilteringReporter) extends FilteringReporter { |
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.
Can/should we seal this class?
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.
It's not actually used or subclassed in the compiler, the idea is to provide it as a utility to compiler plugins like silencer, maybe other tools.
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.
The thing I was going to try today was how easy to customize. I remember the whole point of blowing the functionality into traits was that the old AbstractReporter was too rigid.
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.
OK, let me know!
If you could leave this open another day, I may have comments. I unsquashed the last commit so I could follow along. |
@@ -85,20 +86,24 @@ class Global(var currentSettings: Settings, reporter0: LegacyReporter) | |||
|
|||
override def settings = currentSettings | |||
|
|||
private[this] var currentReporter: LegacyReporter = { reporter = reporter0 ; currentReporter } |
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.
I guess you didn't like this trick. BTW, this usage of locally
is what inspired the recent PR. I just took this up again, and sbt tells me that this is where I left off...
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.
you didn't like this trick
Not that I didn't like it, it made me smile
* - positions (only one error at a position, no duplicate messages on a position) | ||
*/ | ||
abstract class FilteringReporter extends Reporter { | ||
def settings: Settings |
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.
It seemed obvious that FilteringReporter should take settings as a ctor param, as all reporters are required to have that ctor sig, but InteractiveReporter has an abstract compiler from which it derives settings.
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.
I was literally just thinking, Nobody has to muck with settings at construction time, but:
/**
* Called before instantiating the presentation compiler's instance.
* You should provide an implementation of this method if you need
* to customize the `settings` used to instantiate the presentation compiler.
* */
protected def prepareSettings(settings: Settings): Unit = ()
Well, how about you take the compiler as an arg and they can do all their mucking about before they call you?
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.
FilteringReporter should take settings as a ctor param
Either way is fine with me, but I don't see a reason to prefer one or the other.
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.
It's a clear signal or reminder to customizers that you must provide this constructor. Otherwise it's just documented somewhere, or not documented. I did spend a minute wondering if there is a reason to have a preference.
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.
I didn't mean to persuade you!
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.
I'm not sure you did :-) But as I said, either way is fine with me.
[edit. reverted because]
Also it caused
+Caused by: java.lang.NullPointerException
+ at scala.tools.nsc.interactive.tests.InteractiveTestSettings.prepareSettings(InteractiveTestSettings.scala:50)
+ at scala.tools.nsc.interactive.tests.InteractiveTestSettings.prepareSettings$(InteractiveTestSettings.scala:39)
+ at scala.tools.nsc.interactive.tests.InteractiveTest.prepareSettings(InteractiveTest.scala:50)
+ at scala.tools.nsc.interactive.tests.core.PresentationCompilerInstance.compiler(PresentationCompilerInstance.scala:28)
+ at scala.tools.nsc.interactive.tests.core.PresentationCompilerInstance.compiler$(PresentationCompilerInstance.scala:27)
+ at scala.tools.nsc.interactive.tests.InteractiveTest.compiler$lzycompute(InteractiveTest.scala:50)
+ at scala.tools.nsc.interactive.tests.InteractiveTest.compiler(InteractiveTest.scala:50)
+ at scala.tools.nsc.interactive.tests.core.PresentationCompilerInstance.$init$(PresentationCompilerInstance.scala:23)
+ at scala.tools.nsc.interactive.tests.InteractiveTest.<init>(InteractiveTest.scala:51)
+ at Test$.<init>(Test.scala:3)
+ at Test$.<clinit>(Test.scala:3)
case API_WARNING => reporter.warning(info.pos, info.msg) | ||
case API_ERROR => reporter.error(info.pos, info.msg) | ||
} | ||
|
||
def interactive(): Unit = reporter match { | ||
case reporter: AbstractReporter => reporter.displayPrompt() | ||
case reporter: PrintReporter => reporter.displayPrompt() |
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.
It's lunch time, just confirming that interactive
was intentionally removed.
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.
Yes, i missed this one. The method is unused.
I'll go through the diff between your and my PR and push (probably most of) the changes here, then we can merge? |
2ccb12d
to
0ff56aa
Compare
I'll let Stefan decide, but good to go for me. |
I was too busy to notice this went in. Thanks! |
Now that `Typer.stabilize` ends up checking for `@uncheckedStable` annotations to support defs's as stable paths, new opportunities arise for cyclic errors. The enclosed test case started to fail since scala#8338 with: ``` |-- object Test BYVALmode-EXPRmode (site: package <empty>) | |-- super APPSELmode-EXPRmode-POLYmode-QUALmode (silent: <init> in Test) | | |-- this EXPRmode (silent: <init> in Test) | | | \-> Test.type | | \-> Test.type | |-- def foo BYVALmode-EXPRmode (site: object Test) | | |-- attr EXPRmode (site: method foo in Test) | | | |-- Int TYPEmode (site: method attr in Test) | | | | \-> Int | | | |-- new anno APPSELmode-BYVALmode-EXPRmode-FUNmode-POLYmode (site: object Test) | | | | |-- new anno APPSELmode-EXPRmode-POLYmode-QUALmode (site: object Test) | | | | | |-- anno FUNmode-TYPEmode (site: object Test) | | | | | | \-> anno | | | | | \-> anno | | | | \-> (a: Any): anno | | | |-- (a: Any): anno : pt=anno EXPRmode (site: value <local Test> in Test) | | | | |-- foo : pt=Any BYVALmode-EXPRmode (site: value <local Test> in Test) | | | | | caught scala.reflect.internal.Symbols$CyclicReference: illegal cyclic reference involving method foo: while typing foo /Users/jz/code/scala/sandbox/test.scala:7: error: recursive method foo needs result type @anno(foo) def attr: Int = foo ^ | | | | \-> anno ``` Another variant detailed in scala/bug#12216 fails only on 2.12.x (after the backport of scala#8338). Backporting this fix will fix that problem, too. This reduces the likelihood of cycles by typechecking the only core of an annotation (_not_ the full application to the annotation argumnets) to determine its type symbol.
Now that `Typer.stabilize` ends up checking for `@uncheckedStable` annotations to support defs's as stable paths, new opportunities arise for cyclic errors. This PR reduces the likelihood of cycles by typechecking the only core of an annotation (_not_ the full application to the annotation argumnets) to determine its type symbol. pos/unchecked-stable-cyclic-error.scala test case started to fail since scala#8338 with: ``` |-- object Test BYVALmode-EXPRmode (site: package <empty>) | |-- super APPSELmode-EXPRmode-POLYmode-QUALmode (silent: <init> in Test) | | |-- this EXPRmode (silent: <init> in Test) | | | \-> Test.type | | \-> Test.type | |-- def foo BYVALmode-EXPRmode (site: object Test) | | |-- attr EXPRmode (site: method foo in Test) | | | |-- Int TYPEmode (site: method attr in Test) | | | | \-> Int | | | |-- new anno APPSELmode-BYVALmode-EXPRmode-FUNmode-POLYmode (site: object Test) | | | | |-- new anno APPSELmode-EXPRmode-POLYmode-QUALmode (site: object Test) | | | | | |-- anno FUNmode-TYPEmode (site: object Test) | | | | | | \-> anno | | | | | \-> anno | | | | \-> (a: Any): anno | | | |-- (a: Any): anno : pt=anno EXPRmode (site: value <local Test> in Test) | | | | |-- foo : pt=Any BYVALmode-EXPRmode (site: value <local Test> in Test) | | | | | caught scala.reflect.internal.Symbols$CyclicReference: illegal cyclic reference involving method foo: while typing foo /Users/jz/code/scala/sandbox/test.scala:7: error: recursive method foo needs result type @anno(foo) def attr: Int = foo ^ | | | | \-> anno ``` Another variant, pos/annotation-cycle.scala, fails only on 2.12.x (after the backport of scala#8338). Backporting this fix makes that test start passing on 2.12.x.
Now that `Typer.stabilize` ends up checking for `@uncheckedStable` annotations to support defs's as stable paths, new opportunities arise for cyclic errors. This PR reduces the likelihood of cycles by typechecking the only core of an annotation (_not_ the full application to the annotation argumnets) to determine its type symbol. pos/unchecked-stable-cyclic-error.scala test case started to fail since scala#8338 with: ``` |-- object Test BYVALmode-EXPRmode (site: package <empty>) | |-- super APPSELmode-EXPRmode-POLYmode-QUALmode (silent: <init> in Test) | | |-- this EXPRmode (silent: <init> in Test) | | | \-> Test.type | | \-> Test.type | |-- def foo BYVALmode-EXPRmode (site: object Test) | | |-- attr EXPRmode (site: method foo in Test) | | | |-- Int TYPEmode (site: method attr in Test) | | | | \-> Int | | | |-- new anno APPSELmode-BYVALmode-EXPRmode-FUNmode-POLYmode (site: object Test) | | | | |-- new anno APPSELmode-EXPRmode-POLYmode-QUALmode (site: object Test) | | | | | |-- anno FUNmode-TYPEmode (site: object Test) | | | | | | \-> anno | | | | | \-> anno | | | | \-> (a: Any): anno | | | |-- (a: Any): anno : pt=anno EXPRmode (site: value <local Test> in Test) | | | | |-- foo : pt=Any BYVALmode-EXPRmode (site: value <local Test> in Test) | | | | | caught scala.reflect.internal.Symbols$CyclicReference: illegal cyclic reference involving method foo: while typing foo /Users/jz/code/scala/sandbox/test.scala:7: error: recursive method foo needs result type @anno(foo) def attr: Int = foo ^ | | | | \-> anno ``` Another variant, pos/annotation-cycle.scala, fails only on 2.12.x (after the backport of scala#8338). Backporting this fix makes that test start passing on 2.12.x.
Now that `Typer.stabilize` ends up checking for `@uncheckedStable` annotations to support defs's as stable paths, new opportunities arise for cyclic errors. This PR reduces the likelihood of cycles by typechecking the only core of an annotation (_not_ the full application to the annotation argumnets) to determine its type symbol. pos/unchecked-stable-cyclic-error.scala test case started to fail since scala#8338 with: ``` |-- object Test BYVALmode-EXPRmode (site: package <empty>) | |-- super APPSELmode-EXPRmode-POLYmode-QUALmode (silent: <init> in Test) | | |-- this EXPRmode (silent: <init> in Test) | | | \-> Test.type | | \-> Test.type | |-- def foo BYVALmode-EXPRmode (site: object Test) | | |-- attr EXPRmode (site: method foo in Test) | | | |-- Int TYPEmode (site: method attr in Test) | | | | \-> Int | | | |-- new anno APPSELmode-BYVALmode-EXPRmode-FUNmode-POLYmode (site: object Test) | | | | |-- new anno APPSELmode-EXPRmode-POLYmode-QUALmode (site: object Test) | | | | | |-- anno FUNmode-TYPEmode (site: object Test) | | | | | | \-> anno | | | | | \-> anno | | | | \-> (a: Any): anno | | | |-- (a: Any): anno : pt=anno EXPRmode (site: value <local Test> in Test) | | | | |-- foo : pt=Any BYVALmode-EXPRmode (site: value <local Test> in Test) | | | | | caught scala.reflect.internal.Symbols$CyclicReference: illegal cyclic reference involving method foo: while typing foo /Users/jz/code/scala/sandbox/test.scala:7: error: recursive method foo needs result type @anno(foo) def attr: Int = foo ^ | | | | \-> anno ``` Another variant, pos/annotation-cycle.scala, fails only on 2.12.x (after the backport of scala#8338). Backporting this fix makes that test start passing on 2.12.x.
Now that `Typer.stabilize` ends up checking for `@uncheckedStable` annotations to support defs's as stable paths, new opportunities arise for cyclic errors. This PR reduces the likelihood of cycles by typechecking the only core of an annotation (_not_ the full application to the annotation argumnets) to determine its type symbol. pos/unchecked-stable-cyclic-error.scala test case started to fail since scala#8338 with: ``` |-- object Test BYVALmode-EXPRmode (site: package <empty>) | |-- super APPSELmode-EXPRmode-POLYmode-QUALmode (silent: <init> in Test) | | |-- this EXPRmode (silent: <init> in Test) | | | \-> Test.type | | \-> Test.type | |-- def foo BYVALmode-EXPRmode (site: object Test) | | |-- attr EXPRmode (site: method foo in Test) | | | |-- Int TYPEmode (site: method attr in Test) | | | | \-> Int | | | |-- new anno APPSELmode-BYVALmode-EXPRmode-FUNmode-POLYmode (site: object Test) | | | | |-- new anno APPSELmode-EXPRmode-POLYmode-QUALmode (site: object Test) | | | | | |-- anno FUNmode-TYPEmode (site: object Test) | | | | | | \-> anno | | | | | \-> anno | | | | \-> (a: Any): anno | | | |-- (a: Any): anno : pt=anno EXPRmode (site: value <local Test> in Test) | | | | |-- foo : pt=Any BYVALmode-EXPRmode (site: value <local Test> in Test) | | | | | caught scala.reflect.internal.Symbols$CyclicReference: illegal cyclic reference involving method foo: while typing foo /Users/jz/code/scala/sandbox/test.scala:7: error: recursive method foo needs result type @anno(foo) def attr: Int = foo ^ | | | | \-> anno ``` Another variant, pos/annotation-cycle.scala, fails only on 2.12.x (after the backport of scala#8338). Backporting this fix makes that test start passing on 2.12.x. (cherry picked from commit db2b8f6)
Now that `Typer.stabilize` ends up checking for `@uncheckedStable` annotations to support defs's as stable paths, new opportunities arise for cyclic errors. This PR reduces the likelihood of cycles by typechecking the only core of an annotation (_not_ the full application to the annotation arguments) to determine its type symbol. pos/unchecked-stable-cyclic-error.scala test case started to fail since scala#8338 with: ``` |-- object Test BYVALmode-EXPRmode (site: package <empty>) | |-- super APPSELmode-EXPRmode-POLYmode-QUALmode (silent: <init> in Test) | | |-- this EXPRmode (silent: <init> in Test) | | | \-> Test.type | | \-> Test.type | |-- def foo BYVALmode-EXPRmode (site: object Test) | | |-- attr EXPRmode (site: method foo in Test) | | | |-- Int TYPEmode (site: method attr in Test) | | | | \-> Int | | | |-- new anno APPSELmode-BYVALmode-EXPRmode-FUNmode-POLYmode (site: object Test) | | | | |-- new anno APPSELmode-EXPRmode-POLYmode-QUALmode (site: object Test) | | | | | |-- anno FUNmode-TYPEmode (site: object Test) | | | | | | \-> anno | | | | | \-> anno | | | | \-> (a: Any): anno | | | |-- (a: Any): anno : pt=anno EXPRmode (site: value <local Test> in Test) | | | | |-- foo : pt=Any BYVALmode-EXPRmode (site: value <local Test> in Test) | | | | | caught scala.reflect.internal.Symbols$CyclicReference: illegal cyclic reference involving method foo: while typing foo /Users/jz/code/scala/sandbox/test.scala:7: error: recursive method foo needs result type @anno(foo) def attr: Int = foo ^ | | | | \-> anno ``` Another variant, pos/annotation-cycle.scala, fails only on 2.12.x (after the backport of scala#8338). Backporting this fix makes that test start passing on 2.12.x.
Now that `Typer.stabilize` ends up checking for `@uncheckedStable` annotations to support defs's as stable paths, new opportunities arise for cyclic errors. This PR reduces the likelihood of cycles by typechecking the only core of an annotation (_not_ the full application to the annotation arguments) to determine its type symbol. pos/unchecked-stable-cyclic-error.scala test case started to fail since scala#8338 with: ``` |-- object Test BYVALmode-EXPRmode (site: package <empty>) | |-- super APPSELmode-EXPRmode-POLYmode-QUALmode (silent: <init> in Test) | | |-- this EXPRmode (silent: <init> in Test) | | | \-> Test.type | | \-> Test.type | |-- def foo BYVALmode-EXPRmode (site: object Test) | | |-- attr EXPRmode (site: method foo in Test) | | | |-- Int TYPEmode (site: method attr in Test) | | | | \-> Int | | | |-- new anno APPSELmode-BYVALmode-EXPRmode-FUNmode-POLYmode (site: object Test) | | | | |-- new anno APPSELmode-EXPRmode-POLYmode-QUALmode (site: object Test) | | | | | |-- anno FUNmode-TYPEmode (site: object Test) | | | | | | \-> anno | | | | | \-> anno | | | | \-> (a: Any): anno | | | |-- (a: Any): anno : pt=anno EXPRmode (site: value <local Test> in Test) | | | | |-- foo : pt=Any BYVALmode-EXPRmode (site: value <local Test> in Test) | | | | | caught scala.reflect.internal.Symbols$CyclicReference: illegal cyclic reference involving method foo: while typing foo /Users/jz/code/scala/sandbox/test.scala:7: error: recursive method foo needs result type @anno(foo) def attr: Int = foo ^ | | | | \-> anno ``` Another variant, pos/annotation-cycle.scala, fails only on 2.12.x (after the backport of scala#8338). Backporting this fix makes that test start passing on 2.12.x.
Now that `Typer.stabilize` ends up checking for `@uncheckedStable` annotations to support defs's as stable paths, new opportunities arise for cyclic errors. This PR reduces the likelihood of cycles by typechecking the only core of an annotation (_not_ the full application to the annotation arguments) to determine its type symbol. pos/unchecked-stable-cyclic-error.scala test case started to fail since scala#8338 with: ``` |-- object Test BYVALmode-EXPRmode (site: package <empty>) | |-- super APPSELmode-EXPRmode-POLYmode-QUALmode (silent: <init> in Test) | | |-- this EXPRmode (silent: <init> in Test) | | | \-> Test.type | | \-> Test.type | |-- def foo BYVALmode-EXPRmode (site: object Test) | | |-- attr EXPRmode (site: method foo in Test) | | | |-- Int TYPEmode (site: method attr in Test) | | | | \-> Int | | | |-- new anno APPSELmode-BYVALmode-EXPRmode-FUNmode-POLYmode (site: object Test) | | | | |-- new anno APPSELmode-EXPRmode-POLYmode-QUALmode (site: object Test) | | | | | |-- anno FUNmode-TYPEmode (site: object Test) | | | | | | \-> anno | | | | | \-> anno | | | | \-> (a: Any): anno | | | |-- (a: Any): anno : pt=anno EXPRmode (site: value <local Test> in Test) | | | | |-- foo : pt=Any BYVALmode-EXPRmode (site: value <local Test> in Test) | | | | | caught scala.reflect.internal.Symbols$CyclicReference: illegal cyclic reference involving method foo: while typing foo /Users/jz/code/scala/sandbox/test.scala:7: error: recursive method foo needs result type @anno(foo) def attr: Int = foo ^ | | | | \-> anno ``` Another variant, pos/annotation-cycle.scala, fails only on 2.12.x (after the backport of scala#8338). Backporting this fix makes that test start passing on 2.12.x. (cherry picked from commit 9d9635d)
Now that `Typer.stabilize` ends up checking for `@uncheckedStable` annotations to support defs's as stable paths, new opportunities arise for cyclic errors. This PR reduces the likelihood of cycles by typechecking the only core of an annotation (_not_ the full application to the annotation arguments) to determine its type symbol. pos/unchecked-stable-cyclic-error.scala test case started to fail since scala#8338 with: ``` |-- object Test BYVALmode-EXPRmode (site: package <empty>) | |-- super APPSELmode-EXPRmode-POLYmode-QUALmode (silent: <init> in Test) | | |-- this EXPRmode (silent: <init> in Test) | | | \-> Test.type | | \-> Test.type | |-- def foo BYVALmode-EXPRmode (site: object Test) | | |-- attr EXPRmode (site: method foo in Test) | | | |-- Int TYPEmode (site: method attr in Test) | | | | \-> Int | | | |-- new anno APPSELmode-BYVALmode-EXPRmode-FUNmode-POLYmode (site: object Test) | | | | |-- new anno APPSELmode-EXPRmode-POLYmode-QUALmode (site: object Test) | | | | | |-- anno FUNmode-TYPEmode (site: object Test) | | | | | | \-> anno | | | | | \-> anno | | | | \-> (a: Any): anno | | | |-- (a: Any): anno : pt=anno EXPRmode (site: value <local Test> in Test) | | | | |-- foo : pt=Any BYVALmode-EXPRmode (site: value <local Test> in Test) | | | | | caught scala.reflect.internal.Symbols$CyclicReference: illegal cyclic reference involving method foo: while typing foo /Users/jz/code/scala/sandbox/test.scala:7: error: recursive method foo needs result type @anno(foo) def attr: Int = foo ^ | | | | \-> anno ``` Another variant, pos/annotation-cycle.scala, fails only on 2.12.x (after the backport of scala#8338). Backporting this fix makes that test start passing on 2.12.x. (cherry picked from commit 9d9635d)
Now that `Typer.stabilize` ends up checking for `@uncheckedStable` annotations to support defs's as stable paths, new opportunities arise for cyclic errors. This PR reduces the likelihood of cycles by typechecking the only core of an annotation (_not_ the full application to the annotation arguments) to determine its type symbol. pos/unchecked-stable-cyclic-error.scala test case started to fail since scala#8338 with: ``` |-- object Test BYVALmode-EXPRmode (site: package <empty>) | |-- super APPSELmode-EXPRmode-POLYmode-QUALmode (silent: <init> in Test) | | |-- this EXPRmode (silent: <init> in Test) | | | \-> Test.type | | \-> Test.type | |-- def foo BYVALmode-EXPRmode (site: object Test) | | |-- attr EXPRmode (site: method foo in Test) | | | |-- Int TYPEmode (site: method attr in Test) | | | | \-> Int | | | |-- new anno APPSELmode-BYVALmode-EXPRmode-FUNmode-POLYmode (site: object Test) | | | | |-- new anno APPSELmode-EXPRmode-POLYmode-QUALmode (site: object Test) | | | | | |-- anno FUNmode-TYPEmode (site: object Test) | | | | | | \-> anno | | | | | \-> anno | | | | \-> (a: Any): anno | | | |-- (a: Any): anno : pt=anno EXPRmode (site: value <local Test> in Test) | | | | |-- foo : pt=Any BYVALmode-EXPRmode (site: value <local Test> in Test) | | | | | caught scala.reflect.internal.Symbols$CyclicReference: illegal cyclic reference involving method foo: while typing foo /Users/jz/code/scala/sandbox/test.scala:7: error: recursive method foo needs result type @anno(foo) def attr: Int = foo ^ | | | | \-> anno ``` Another variant, pos/annotation-cycle.scala, fails only on 2.12.x (after the backport of scala#8338). Backporting this fix makes that test start passing on 2.12.x. Backports scala#9302
Problem ======= Upgrade source to https://github.com/scala/scala/releases/tag/v2.12.13 from https://github.com/scala/scala/releases/tag/v2.12.12. This upgrade includes a highlighted feature of configurable warnings and errors (https://www.scala-lang.org/2021/01/12/configuring-and-suppressing-warnings.html / scala/scala#9248). Other noticable changes our code based will experience * Exhaustivity warnings for patterns involving tuples * Better type checking for `CharSequence` arguments scala/scala#9292 * Simplified Reporters scala/scala#8338 * Promotion of `-deprecation` to `-Xlint:deprecation` scala/scala#7714 * Improves performance of building `immutable.{TreeMap,TreeSet}` by using mutation within the builder scala/scala#8794 Full list of changes can be found at https://github.com/scala/scala/pulls?q=is%3Amerged+milestone%3A2.12.13+ Solution ======== * Bump `BUILD` file `SCALA_REV` && `SCALAC_REV_FOR_DEPS`. * Depdnencies which are not built for scala 2.12.13 needed to be bumped `SEMANTICDB_PLUGIN_REV` && `SEMANTICDB_REV` && `SCALAFIX_REV`. * Include `-S-Xlint:-deprecation` to `pants.ini` preventing build failures on deprecated annotations (existing behavior) * Bump `cache_key_gen_version` in `pants.ini` for newly built artifacts on different scala version. * Removed scalafix plugin (`scalac-profiling`) which is not built for 2.12.13. `scalac-profiling` code looks abandoned by ~3 years. * Updated all failing tests that could have depended or expected ordered sequences when the sequence was generated from non ordered collections. Notes ===== It seems a few tests and golden files in source have depended or tested against a stable sort order when sorted order is not guaranteed. This has been seen in a few places such as output json objects (map key fields), code that uses `groupBy` for rekeying results to the user and transforming into sequences, strings built from sequences or maps that are not guaranteed to be ordered. The following PR are related to this change in expectations scala/scala#8794 scala/scala#8948 scala/scala#9218 scala/scala#9376 scala/scala#9091 scala/scala#9216 We took the liberty updating tests with what the current map order would be or updating the test in a way that wouldn't depend on order. Since we may not fully understand all the context of the tests we are hoping this either signals to the owners that there might be some issue with assumed order or signal that upgrading might break implementations due to bug in scala 2.12.13. {D611202} will improve the files changed for workflow builder outside of this change. Please feel to reach out directly and discuss the changes here or bring up issues with this upgrade. Slack [[https://app.slack.com/client/T86S8GHEG/C01NZAFRLFK|#scala-upgrade-2-12-13]] JIRA Issues: SCALA-25 Differential Revision: https://phabricator.twitter.biz/D607826
Messages are counted in the reporter, not in the Severity objects.
The Severity class is moved out of the reporter to the package, with
an
@uncheckedStable
trick to make pattern matching on severitiessource-compatbile (Fixes scala/bug#8908).
ContextReporter no longer extends Reporter. The ContextReporter is
only used in the context, and it reports through Global.reporter. But
it's never assigned to Global.reporter. So better keep the two
separate. This also saves the inherited fields (ContextReporters are
allocated manies, type checking every Apply uses silent).
Remove most reporter mixins to get to a linear inheritance structure,
no more delegating reporters.
Ignore the
force
parameter ofinfo0
.Restores support for
-Xprompt
in the repl.Some quirks to remain source compatible with the sbt compiler interface.
nsc.reporters.Reporter
only exists for sbt compatibility, Globalhas a
FilteringReporter
.-Xreporter
must be a FilteringReporter.