Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
SI-6535 Step back from the precipice of a cycle
Adding any non-local parent to WrapAsScala will trigger a valid cyclic reference error. By moving the import of `Wrapper._` inside `WrapAsScala` and `WrapAsJava`, it is not in scope when typing the parents of those, and we avoid the cycle. Adds a test case to show the essense of the promiscious mutual imports that triggers this.
- Loading branch information
Showing
4 changed files
with
27 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
t6535.scala:2: error: encountered unrecoverable cycle resolving import. | ||
Note: this is often due in part to a class depending on a definition nested within its companion. | ||
If applicable, you may wish to try moving some members into another object. | ||
import Bs.B._ | ||
^ | ||
one error found |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
object As { | ||
import Bs.B._ | ||
|
||
object A | ||
extends scala.AnyRef // needed for the cycle; | ||
// replacing with a locally defined closs doesn't | ||
// hit the locked import and hence doesn't cycle. | ||
} | ||
|
||
object Bs { | ||
import As.A._ | ||
|
||
object B | ||
extends scala.AnyRef // scala.Immutable, ... | ||
} |