Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information