Skip to content
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

Cyclic Error when compiling protobuf-java 3.24.0 on Scala 3.3.0 #1557

Closed
armanbilge opened this issue Aug 9, 2023 · 0 comments
Closed

Cyclic Error when compiling protobuf-java 3.24.0 on Scala 3.3.0 #1557

armanbilge opened this issue Aug 9, 2023 · 0 comments

Comments

@armanbilge
Copy link
Contributor

Complete reproducer in armanbilge/sandbox@47d818f.

scalaVersion := "3.3.0"

Compile / PB.targets := Seq(
  scalapb.gen() -> (Compile / sourceManaged).value / "scalapb"
)

libraryDependencies ++= Seq(
    "com.google.protobuf" % "protobuf-java" % "3.24.0" % "protobuf-src" intransitive ()
)
sbt:sandbox> compile
[info] Compiling 11 protobuf files to /workspace/sandbox/target/scala-3.3.0/src_managed/main/scalapb
[info] compiling 61 Scala sources to /workspace/sandbox/target/scala-3.3.0/classes ...
[error] -- [E140] Cyclic Error: /workspace/sandbox/target/scala-3.3.0/src_managed/main/scalapb/com/google/protobuf/descriptor/FeatureSet.scala:301:9 
[error] 301 |    type EnumType = EnumType
[error]     |         ^
[error]     |illegal cyclic type reference: alias ... of ... (caught cyclic reference) ... refers back to the type itself
[error] -- [E007] Type Mismatch Error: /workspace/sandbox/target/scala-3.3.0/src_managed/main/scalapb/com/google/protobuf/descriptor/FeatureSet.scala:305:111 
[error] 305 |    def companion: _root_.scalapb.GeneratedEnumCompanion[EnumType] = com.google.protobuf.descriptor.FeatureSet.EnumType
[error]     |                                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error]     |     Found:    com.google.protobuf.descriptor.FeatureSet.EnumType.type
[error]     |     Required: scalapb.GeneratedEnumCompanion[EnumType.this.EnumType²]
[error]     |
[error]     |     where:    EnumType  is a class in object FeatureSet
[error]     |               EnumType² is a type in class EnumType
[error]     |
[error]     | longer explanation available when compiling with `-explain`
[error] two errors found
[error] (Compile / compileIncremental) Compilation failed
[error] Total time: 13 s, completed Aug 9, 2023, 5:50:03 AM
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

No branches or pull requests

1 participant