Skip to content

Commit 7fcb5b2

Browse files
committed
Make WrappedResult a separate object
1 parent 3ceb51d commit 7fcb5b2

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package dotty.tools
2+
3+
object WrappedResult {
4+
opaque type WrappedResult[T] = T
5+
def result[T] given (x: WrappedResult[T]): T = x
6+
def apply[T](x: T): WrappedResult[T] = x
7+
}

compiler/src/dotty/tools/package.scala

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

27-
object WrappedResult {
28-
opaque type Type[T] = T
29-
def unwrap[T](x: Type[T]): T = x
30-
def apply[T](x: T): Type[T] = x
31-
}
32-
type WrappedResult[T] = WrappedResult.Type[T]
33-
def result[T] given (x: WrappedResult[T]): T = WrappedResult.unwrap(x)
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.
3433
}

0 commit comments

Comments
 (0)