Skip to content

Commit 510a56b

Browse files
committed
Move WrappedResult to dotty.util
We can't have WrappedResult in tools itself, since that gives a CyclicReference error in some situations. Specifically, if tools.WrappedResult is compiled first, we complete its paackage, which means we complete tools/package.scala which means we enter its members which means we process the WrappedResult export which means we complete WrappedResult which gives a CyclicReference An alternative fix would be to avoid the export and use explicit forwarders instead.
1 parent 7fcb5b2 commit 510a56b

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

compiler/src/dotty/tools/dotc/core/Decorators.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import dotty.tools.dotc.transform.MegaPhase
1111
import ast.tpd._
1212
import scala.language.implicitConversions
1313
import printing.Formatting._
14+
import dotty.util.WrappedResult
1415

1516
/** This object provides useful implicit decorators for types defined elsewhere */
1617
object Decorators {

compiler/src/dotty/tools/package.scala

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,5 @@ package object tools {
2424
def unsupported(methodName: String): Nothing =
2525
throw new UnsupportedOperationException(methodName)
2626

27-
export WrappedResult.{WrappedResult, result}
28-
// Equivalent to:
29-
// type WrappedResult[T] = WrappedResult.WrappedResult[T]
30-
// def result[T] given WrappedResult[T] = WrappedResult.result[T]
31-
// The export gave a CyclicReference error in some situations
32-
// Investigate if this happens again.
27+
export util.WrappedResult.{WrappedResult, result}
3328
}

compiler/src/dotty/tools/WrappedResult.scala renamed to compiler/src/dotty/util/WrappedResult.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package dotty.tools
1+
package dotty.util
22

33
object WrappedResult {
44
opaque type WrappedResult[T] = T

0 commit comments

Comments
 (0)