From 6c29e3a87e40f2b2e9b19c8ab2e072bda4cf1dad Mon Sep 17 00:00:00 2001 From: odersky Date: Fri, 11 Jul 2025 11:56:17 +0200 Subject: [PATCH 1/2] Don't force complete annotation unpickling when testing for SilentIntoAnnot Fixes #23496 --- compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala | 2 +- tests/pos/i23496/BaseLineSpec_2.scala | 2 ++ tests/pos/i23496/Query_1.scala | 3 +++ tests/pos/i23496/ScalaqlSyntax_1.scala | 4 ++++ tests/pos/i23496/annotations_1.scala | 5 +++++ tests/pos/i23496/fixture_2.scala | 1 + tests/pos/i23496/package.scala_1.scala | 3 +++ 7 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 tests/pos/i23496/BaseLineSpec_2.scala create mode 100644 tests/pos/i23496/Query_1.scala create mode 100644 tests/pos/i23496/ScalaqlSyntax_1.scala create mode 100644 tests/pos/i23496/annotations_1.scala create mode 100644 tests/pos/i23496/fixture_2.scala create mode 100644 tests/pos/i23496/package.scala_1.scala diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala index a7b02a287f6d..9e6f4ec45c7e 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala @@ -668,7 +668,7 @@ class TreeUnpickler(reader: TastyReader, val annotOwner = if sym.owner.isClass then newLocalDummy(sym.owner) else sym.owner var annots = annotFns.map(_(annotOwner)) - if annots.exists(_.symbol == defn.SilentIntoAnnot) then + if annots.exists(_.hasSymbol(defn.SilentIntoAnnot)) then // Temporary measure until we can change TastyFormat to include an INTO tag sym.setFlag(Into) annots = annots.filterNot(_.symbol == defn.SilentIntoAnnot) diff --git a/tests/pos/i23496/BaseLineSpec_2.scala b/tests/pos/i23496/BaseLineSpec_2.scala new file mode 100644 index 000000000000..71e731a11b1b --- /dev/null +++ b/tests/pos/i23496/BaseLineSpec_2.scala @@ -0,0 +1,2 @@ +package scalaql +import scalaql.fixture.* diff --git a/tests/pos/i23496/Query_1.scala b/tests/pos/i23496/Query_1.scala new file mode 100644 index 000000000000..f142e6086328 --- /dev/null +++ b/tests/pos/i23496/Query_1.scala @@ -0,0 +1,3 @@ +package scalaql + +import scala.annotation.unchecked.uncheckedVariance // unused diff --git a/tests/pos/i23496/ScalaqlSyntax_1.scala b/tests/pos/i23496/ScalaqlSyntax_1.scala new file mode 100644 index 000000000000..9fc0fba46030 --- /dev/null +++ b/tests/pos/i23496/ScalaqlSyntax_1.scala @@ -0,0 +1,4 @@ +package scalaql.syntax + +@scalaql.forbiddenInheritance +trait ScalaqlSyntax diff --git a/tests/pos/i23496/annotations_1.scala b/tests/pos/i23496/annotations_1.scala new file mode 100644 index 000000000000..3e1a040e589e --- /dev/null +++ b/tests/pos/i23496/annotations_1.scala @@ -0,0 +1,5 @@ +package scalaql + +import scala.annotation.StaticAnnotation + +class forbiddenInheritance extends StaticAnnotation diff --git a/tests/pos/i23496/fixture_2.scala b/tests/pos/i23496/fixture_2.scala new file mode 100644 index 000000000000..aa564742ec25 --- /dev/null +++ b/tests/pos/i23496/fixture_2.scala @@ -0,0 +1 @@ +package scalaql.fixture diff --git a/tests/pos/i23496/package.scala_1.scala b/tests/pos/i23496/package.scala_1.scala new file mode 100644 index 000000000000..46ada0b9bb94 --- /dev/null +++ b/tests/pos/i23496/package.scala_1.scala @@ -0,0 +1,3 @@ +import scalaql.syntax.ScalaqlSyntax + +package object scalaql extends ScalaqlSyntax From 410cb1f229550b19682c8298b38f7aa026fbf86a Mon Sep 17 00:00:00 2001 From: odersky Date: Fri, 11 Jul 2025 13:30:10 +0200 Subject: [PATCH 2/2] Use direct parent reference instead of importing it Fixes the cyclic reference error observed when compiling files using sc annotations_1.scala Query_1.scala ScalaqlSyntax_1.scala package.scala_1.scala --- tests/pos/i23496/annotations_1.scala | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/pos/i23496/annotations_1.scala b/tests/pos/i23496/annotations_1.scala index 3e1a040e589e..d96737787b51 100644 --- a/tests/pos/i23496/annotations_1.scala +++ b/tests/pos/i23496/annotations_1.scala @@ -1,5 +1,3 @@ package scalaql -import scala.annotation.StaticAnnotation - -class forbiddenInheritance extends StaticAnnotation +class forbiddenInheritance extends scala.annotation.StaticAnnotation