Skip to content

Commit a778f35

Browse files
committed
Alternative WrappedResult implementation without exports
This allows us to put WrappedResult directly in the tools package object.
1 parent 510a56b commit a778f35

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

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

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

1615
/** This object provides useful implicit decorators for types defined elsewhere */
1716
object Decorators {

compiler/src/dotty/tools/package.scala

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

27-
export util.WrappedResult.{WrappedResult, result}
27+
object resultWrapper {
28+
opaque type WrappedResult[T] = T
29+
private[tools] def unwrap[T](x: WrappedResult[T]): T = x
30+
private[tools] def wrap[T](x: T): WrappedResult[T] = x
31+
}
32+
type WrappedResult[T] = resultWrapper.WrappedResult[T]
33+
def WrappedResult[T](x: T) = resultWrapper.wrap(x)
34+
def result[T] given (x: WrappedResult[T]): T = resultWrapper.unwrap(x)
2835
}

compiler/src/dotty/util/WrappedResult.scala

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)