-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Cyclic reference when using List and compiling Seq* classes at the same time #970
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
Labels
Comments
Can you still reproduce this? Seems to work fine here now. |
I can reproduce it on 4463f5e locally. |
@smarter could you please try with different order of arguments:
|
Yes, I can reproduce that way. |
smarter
added a commit
to dotty-staging/dotty
that referenced
this issue
Nov 27, 2015
This is a strawman proposal for fixing scala#970, before this commit, the following fails with a cyclic reference error: dotc B.scala\ ./scala-scala/src/library/scala/collection/immutable/Seq.scala\ ./scala-scala/src/library/scala/package.scala\ ./scala-scala/src/library/scala/collection/GenSeqLike.scala\ ./scala-scala/src/library/scala/collection/SeqLike.scala\ ./scala-scala/src/library/scala/collection/generic/GenSeqFactory.scala\ where B.scala is defined as: object B{ def main(args: Array[String]): Unit = { val s = List(1,2,3) () } } Here's what I think is happening: 1. Unpickling a Scala2 TypeRef requires us to perform type application. (`Scala2Unpickler#readType`) 2. To apply a TypeAlias to some arguments, we first need to determine its type parameters. (`TypeApplications#appliedTo` and `TypeApplications#typeParams`) 3. To do this, we look at the type parameters of the underlying type of the TypeAlias, this requires completing the TypeAlias. 4. If the TypeAlias is defined in a source tree and not unpickled, this forces us to typecheck its right-hand side. (`Namer#Completer#typeSig`) 5. In turns, this forces various classes to be completed, which might themselves refer indirectly to type aliases, forcing even more stuff. This commit is a hacky way to avoid 3. by only completing the type parameters of a type alias instead of completing the whole type alias when we don't need it. Let me know if you think the basic idea is sound or not and if you can think of a nicer way to implement it!
smarter
added a commit
to dotty-staging/dotty
that referenced
this issue
Nov 27, 2015
This is a strawman proposal for fixing scala#970, before this commit, the following fails with a cyclic reference error: dotc B.scala\ ./scala-scala/src/library/scala/collection/immutable/Seq.scala\ ./scala-scala/src/library/scala/package.scala\ ./scala-scala/src/library/scala/collection/GenSeqLike.scala\ ./scala-scala/src/library/scala/collection/SeqLike.scala\ ./scala-scala/src/library/scala/collection/generic/GenSeqFactory.scala where B.scala is defined as: object B{ def main(args: Array[String]): Unit = { val s = List(1,2,3) () } } Here's what I think is happening: 1. Unpickling a Scala2 TypeRef requires us to perform type application. (`Scala2Unpickler#readType`) 2. To apply a TypeAlias to some arguments, we first need to determine its type parameters. (`TypeApplications#appliedTo` and `TypeApplications#typeParams`) 3. To do this, we look at the type parameters of the underlying type of the TypeAlias, this requires completing the TypeAlias. 4. If the TypeAlias is defined in a source tree and not unpickled, this forces us to typecheck its right-hand side. (`Namer#Completer#typeSig`) 5. In turns, this forces various classes to be completed, which might themselves refer indirectly to type aliases, forcing even more stuff. This commit is a hacky way to avoid 3. by only completing the type parameters of a type alias instead of completing the whole type alias when we don't need it. Let me know if you think the basic idea is sound or not and if you can think of a nicer way to implement it!
OK, I think I got it but I'll need some help with the design: #981 |
smarter
added a commit
to dotty-staging/dotty
that referenced
this issue
Nov 30, 2015
This is a strawman proposal for fixing scala#970, before this commit, the following fails with a cyclic reference error: dotc B.scala\ ./scala-scala/src/library/scala/collection/immutable/Seq.scala\ ./scala-scala/src/library/scala/package.scala\ ./scala-scala/src/library/scala/collection/GenSeqLike.scala\ ./scala-scala/src/library/scala/collection/SeqLike.scala\ ./scala-scala/src/library/scala/collection/generic/GenSeqFactory.scala where B.scala is defined as: object B{ def main(args: Array[String]): Unit = { val s = List(1,2,3) () } } Here's what I think is happening: 1. Unpickling a Scala2 TypeRef requires us to perform type application. (`Scala2Unpickler#readType`) 2. To apply a TypeAlias to some arguments, we first need to determine its type parameters. (`TypeApplications#appliedTo` and `TypeApplications#typeParams`) 3. To do this, we look at the type parameters of the underlying type of the TypeAlias, this requires completing the TypeAlias. 4. If the TypeAlias is defined in a source tree and not unpickled, this forces us to typecheck its right-hand side. (`Namer#Completer#typeSig`) 5. In turns, this forces various classes to be completed, which might themselves refer indirectly to type aliases, forcing even more stuff. This commit is a hacky way to avoid 3. by only completing the type parameters of a type alias instead of completing the whole type alias when we don't need it. Let me know if you think the basic idea is sound or not and if you can think of a nicer way to implement it!
This was referenced Jan 15, 2016
This is fixed by now. |
DarkDimius
pushed a commit
to dotty-linker/dotty
that referenced
this issue
May 9, 2016
This is a strawman proposal for fixing scala#970, before this commit, the following fails with a cyclic reference error: dotc B.scala\ ./scala-scala/src/library/scala/collection/immutable/Seq.scala\ ./scala-scala/src/library/scala/package.scala\ ./scala-scala/src/library/scala/collection/GenSeqLike.scala\ ./scala-scala/src/library/scala/collection/SeqLike.scala\ ./scala-scala/src/library/scala/collection/generic/GenSeqFactory.scala where B.scala is defined as: object B{ def main(args: Array[String]): Unit = { val s = List(1,2,3) () } } Here's what I think is happening: 1. Unpickling a Scala2 TypeRef requires us to perform type application. (`Scala2Unpickler#readType`) 2. To apply a TypeAlias to some arguments, we first need to determine its type parameters. (`TypeApplications#appliedTo` and `TypeApplications#typeParams`) 3. To do this, we look at the type parameters of the underlying type of the TypeAlias, this requires completing the TypeAlias. 4. If the TypeAlias is defined in a source tree and not unpickled, this forces us to typecheck its right-hand side. (`Namer#Completer#typeSig`) 5. In turns, this forces various classes to be completed, which might themselves refer indirectly to type aliases, forcing even more stuff. This commit is a hacky way to avoid 3. by only completing the type parameters of a type alias instead of completing the whole type alias when we don't need it. Let me know if you think the basic idea is sound or not and if you can think of a nicer way to implement it!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If
B.scala
is removed from compilation list, cyclic reference error is not triggered anymore.The text was updated successfully, but these errors were encountered: