Skip to content

Commit 3080012

Browse files
committed
Merge pull request #58 from retronym/topic/unhardcode-try
Unhardcode use of scala.util.Try
2 parents db4ceca + 72112ce commit 3080012

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

src/main/scala/scala/async/internal/AsyncTransform.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ trait AsyncTransform {
5151
List(emptyConstructor, stateVar, result, execContextValDef) ++ List(resumeFunTreeDummyBody, applyDefDefDummyBody, apply0DefDef, extraValDef)
5252
}
5353

54-
val template = Template(List(typeOf[(scala.util.Try[Any] => Unit)], typeOf[() => Unit]).map(TypeTree(_)), emptyValDef, body)
54+
val tryToUnit = appliedType(definitions.FunctionClass(1), futureSystemOps.tryType[Any], typeOf[Unit])
55+
val template = Template(List(tryToUnit, typeOf[() => Unit]).map(TypeTree(_)), emptyValDef, body)
5556

5657
val t = ClassDef(NoMods, name.stateMachineT, Nil, template)
5758
callSiteTyper.typedPos(macroPos)(Block(t :: Nil, Literal(Constant(()))))

src/main/scala/scala/async/internal/TransformUtils.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ private[async] trait TransformUtils {
8484
self.splice.get
8585
}
8686

87-
val TryClass = rootMirror.staticClass("scala.util.Try")
88-
val Try_get = TryClass.typeSignature.member(newTermName("get")).ensuring(_ != NoSymbol)
89-
val Try_isFailure = TryClass.typeSignature.member(newTermName("isFailure")).ensuring(_ != NoSymbol)
90-
val TryAnyType = appliedType(TryClass.toType, List(definitions.AnyTpe))
9187
val NonFatalClass = rootMirror.staticModule("scala.util.control.NonFatal")
9288
val Async_await = asyncBase.awaitMethod(global)(macroApplication.symbol).ensuring(_ != NoSymbol)
9389
}

0 commit comments

Comments
 (0)