Skip to content

Cyclic reference involving module class in Scala3 but compiles in Scala2 #12109

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

Closed
scf37 opened this issue Apr 15, 2021 · 5 comments · Fixed by #12117
Closed

Cyclic reference involving module class in Scala3 but compiles in Scala2 #12109

scf37 opened this issue Apr 15, 2021 · 5 comments · Fixed by #12117

Comments

@scf37
Copy link

scf37 commented Apr 15, 2021

Compiler version

3.0.0-RC1, 3.0.0-RC2

Minimized code

https://scastie.scala-lang.org/6NSAUSm4Qo2Y9NJbLQrxWw

Output

Cyclic reference involving module class JsonReaderDefaultValue$

Expectation

Successful compilation.

Does not reproduce when dependent code is copy-pasted to the same Scastie session.

@griggt
Copy link
Contributor

griggt commented Apr 15, 2021

Self-contained:

JsonReaderDefaultValue.scala (compile with Scala 2.13)

object JsonReaderDefaultValue extends LowPriorityDefaultValue {
  class ReaderDefaultValue extends scala.annotation.StaticAnnotation
}

trait LowPriorityDefaultValue {
  @JsonReaderDefaultValue.ReaderDefaultValue
  class NoDefaultValue
}

Test.scala

object Test {
  JsonReaderDefaultValue
}

odersky added a commit to dotty-staging/dotty that referenced this issue Apr 16, 2021
Eta expansion needs type parameters which can provoke a cycle.

Fixes scala#12109.
odersky added a commit to dotty-staging/dotty that referenced this issue Apr 17, 2021
Fixes scala#12109 without causing problems elsewhere.
odersky added a commit to dotty-staging/dotty that referenced this issue Apr 17, 2021
Eta expansion needs type parameters which can provoke a cycle.

Fixes scala#12109.
odersky added a commit to dotty-staging/dotty that referenced this issue Apr 17, 2021
Fixes scala#12109 without causing problems elsewhere.
michelou pushed a commit to michelou/scala3 that referenced this issue Apr 19, 2021
Eta expansion needs type parameters which can provoke a cycle.

Fixes scala#12109.
michelou pushed a commit to michelou/scala3 that referenced this issue Apr 19, 2021
Fixes scala#12109 without causing problems elsewhere.
michelou pushed a commit to michelou/scala3 that referenced this issue Apr 20, 2021
Eta expansion needs type parameters which can provoke a cycle.

Fixes scala#12109.
michelou pushed a commit to michelou/scala3 that referenced this issue Apr 20, 2021
Fixes scala#12109 without causing problems elsewhere.
michelou pushed a commit to michelou/scala3 that referenced this issue Apr 20, 2021
Eta expansion needs type parameters which can provoke a cycle.

Fixes scala#12109.
michelou pushed a commit to michelou/scala3 that referenced this issue Apr 20, 2021
Fixes scala#12109 without causing problems elsewhere.
michelou pushed a commit to michelou/scala3 that referenced this issue Apr 20, 2021
Eta expansion needs type parameters which can provoke a cycle.

Fixes scala#12109.
michelou pushed a commit to michelou/scala3 that referenced this issue Apr 20, 2021
Fixes scala#12109 without causing problems elsewhere.
michelou pushed a commit to michelou/scala3 that referenced this issue Apr 21, 2021
Eta expansion needs type parameters which can provoke a cycle.

Fixes scala#12109.
michelou pushed a commit to michelou/scala3 that referenced this issue Apr 21, 2021
Fixes scala#12109 without causing problems elsewhere.
@realvictorprm
Copy link

realvictorprm commented Apr 21, 2021

I have a similar issue however for me the code compiles but as soon as I try to publish I also run into Cyclic reference involving object GetSecretValueRequest with the type here being from the AWS SDK lib.
I also tried the latest nightly from the 20th April but without success :/

EDIT: However still trying to figure out if I can isolate that somehow.

@smarter
Copy link
Member

smarter commented Apr 21, 2021

Cyclic references can have many causes, if the latest nightly doesn't fix your problem, it's likely unrelated to this and you should open a new issue.

@realvictorprm
Copy link

I came to that conclusion too. This seems to be quite complex. My tries to isolate the issue failed so far :(

@smarter
Copy link
Member

smarter commented Apr 21, 2021

If you can't minimize it, it can still be helpful to open an issue if you can provide a reliably way to reproduce the problem (e.g. a branch of a git repo and the command used to compile the code).

michelou pushed a commit to michelou/scala3 that referenced this issue Apr 22, 2021
Eta expansion needs type parameters which can provoke a cycle.

Fixes scala#12109.
michelou pushed a commit to michelou/scala3 that referenced this issue Apr 22, 2021
Fixes scala#12109 without causing problems elsewhere.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants