Cyclic Error when compiling protobuf-java 3.24.0 on Scala 3.3.0
Closed this issue · 0 comments
armanbilge commented
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