Skip to content

Don't force annotation unpickling when testing for SilentIntoAnnot #23506

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jul 11, 2025

Don't force completion of annotation unpickling when testing for SilentIntoAnnot

Fixes #23496

@odersky
Copy link
Contributor Author

odersky commented Jul 11, 2025

I should have seen error in the original commit.

@odersky odersky changed the title Don't force complete annotation unpickling when testing for SilentInt… Don't force annotation unpickling when testing for SilentInt… Jul 11, 2025
@odersky odersky changed the title Don't force annotation unpickling when testing for SilentInt… Don't force annotation unpickling when testing for SilentIntoAnnot Jul 11, 2025
@odersky
Copy link
Contributor Author

odersky commented Jul 11, 2025

The windows test was failing, presumably because it used a different file order in the compilation than the main test. I verified that the following order gives a cyclic reference error:

scalac annotations_1.scala Query_1.scala ScalaqlSyntax_1.scala package.scala_1.scala

The error under -explain-cylic is:

~/workspace/dotty/tests/pos/i23496> sc annotations_1.scala Query_1.scala ScalaqlSyntax_1.scala package.scala_1.scala -explain-cyclic
-- [E046] Cyclic Error: annotations_1.scala:5:35 -------------------------------
5 |class forbiddenInheritance extends StaticAnnotation
  |                                   ^
  |Cyclic reference involving val <import>
  |
  |The error occurred while trying to compute the signature of import scala.annotation.StaticAnnotation
  |  which required to compute the signature of package object scalaql
  |  which required to compute the base classes of trait ScalaqlSyntax
  |  which required to compute the signature of trait ScalaqlSyntax
  |  which required to compute the base classes of class forbiddenInheritance
  |  which required to compute the signature of class forbiddenInheritance
  |  which required to compute the signature of import scala.annotation.StaticAnnotation
  |
  | Run with both -explain-cyclic and -Ydebug-cyclic to see full stack trace.
  |
  | longer explanation available when compiling with `-explain`
-- Error: ScalaqlSyntax_1.scala:3:0 --------------------------------------------
3 |@scalaql.forbiddenInheritance
  |^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |class forbiddenInheritance is not a valid Scala annotation: it does not extend `scala.annotation.Annotation`

I thought of creating an issue for this. But then I noted that the project uses a package object inheritance of an inner trait which should be illegal:

import scalaql.syntax.ScalaqlSyntax

package object scalaql extends ScalaqlSyntax

So I guess we should work on making this illegal, instead of trying to fix the consequences to the typing.

The workaround is to not to use an import in forbiddenInheritance. That's the next commit.

Fixes the cyclic reference error observed when compiling files
using
sc annotations_1.scala Query_1.scala ScalaqlSyntax_1.scala package.scala_1.scala
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression in reading TASTy involving new cyclic references errors
2 participants