Skip to content

Regression in reading TASTy involving new cyclic references errors #23496

Open
@WojciechMazur

Description

@WojciechMazur

Based on failure in OpenCB for vitaliihonta/scala-ql - build logs

Compiler version

Last good release: 3.7.2-RC1-bin-20250528-457a463-NIGHTLY
First bad release: 3.7.2-RC1-bin-20250601-45ecc31-NIGHTLY
Bisect points to 3ad6fe0 / #23014

Works in 3.7.1
Fails in 3.7.2-RC1

Minimized code

Zip with sources: repro_scalaql.zip

// main/scalaql/Query.scala

package scalaql
import scala.annotation.unchecked.uncheckedVariance // unused
// main/scalaql/annotations.scala

package scalaql
import scala.annotation.StaticAnnotation
class forbiddenInheritance extends StaticAnnotation
// /main/scalaql/package.scala

import scalaql.syntax.ScalaqlSyntax
package object scalaql extends ScalaqlSyntax
// main/scalaql/syntax/ScalaqlSyntax.scala
package scalaql.syntax

@scalaql.forbiddenInheritance
trait ScalaqlSyntax

In seperate compilation unit (eq. using scala compile --test):

// test/scalaql/BaseLineSpec.scala

//> using target.scope test

package scalaql
import scalaql.fixture.*
// test/scalaql/fixture/fixture.scala

//> using target.scope test

package scalaql.fixture

Output

exception caught when loading trait ScalaqlSyntax: Could not read definition trait ScalaqlSyntax in /Users/wmazur/projects/scala/community-build3/repo/scala-ql/target/jvm-3/classes/scalaql/syntax/ScalaqlSyntax.tasty. Caused by the following exception:
java.util.NoSuchElementException: key not found: Addr(18)

Run with -Ydebug-unpickling to see full stack trace.
[error] -- Error: /Users/wmazur/projects/scala/community-build3/repo/scala-ql/src/test/scala/scalaql/BaseLineSpec.scala:3:7 
[error] 3 |import scalaql.fixture.*
[error]   |       ^
[error]   |Could not read definition trait ScalaqlSyntax in /Users/wmazur/projects/scala/community-build3/repo/scala-ql/target/jvm-3/classes/scalaql/syntax/ScalaqlSyntax.tasty. Caused by the following exception:
[error]   |java.util.NoSuchElementException: key not found: Addr(18)
[error]   |
[error]   |Run with -Ydebug-unpickling to see full stack trace.
[error] -- [E046] Cyclic Error: /Users/wmazur/projects/scala/community-build3/repo/scala-ql/src/test/scala/scalaql/BaseLineSpec.scala:5:7 
[error] 5 |import java.util.concurrent.atomic.AtomicInteger
[error]   |       ^
[error]   |Cyclic reference involving trait ScalaqlSyntax
[error]   |
[error]   |The error occurred while trying to compute the signature of import java.util.concurrent.atomic.AtomicInteger
[error]   |  which required to compute the signature of trait ScalaqlSyntax
[error]   |
[error]   | Run with both -explain-cyclic and -Ydebug-cyclic to see full stack trace.
[error]   |
[error]   | longer explanation available when compiling with `-explain`
[error] -- [E046] Cyclic Error: /Users/wmazur/projects/scala/community-build3/repo/scala-ql/src/test/scala/scalaql/fixture/fixture.scala:2:16 
[error] 2 |package scalaql.fixture
[error]   |                ^
[error]   |Cyclic reference involving trait ScalaqlSyntax
[error]   |
[error]   |The error occurred while trying to compute the signature of trait ScalaqlSyntax
[error]   |
[error]   | Run with both -explain-cyclic and -Ydebug-cyclic to see full stack trace.
[error]   |
[error]   | longer explanation available when compiling with `-explain`
[warn] two warnings found

Expectation

  1. Suspiscious exception: key not found: Addr(18) should be handled
  2. It should compile without cyclic reference errors - works in 3.7.1

Metadata

Metadata

Assignees

Labels

area:picklingarea:tasty-formatissues relating to TASTy as a portable standarditype:bugregressionThis worked in a previous version but doesn't anymore

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions