Skip to content

Commit df2ee00

Browse files
committed
Merge pull request #107 from retronym/ticket/106
Fix compiler crash with value class in result position
2 parents 00e62b2 + f4275e2 commit df2ee00

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,8 @@ private[async] trait TransformUtils {
343343
New(TypeTree(baseType)))), tpSym.asClass.primaryConstructor)
344344

345345
val zero = gen.mkMethodCall(target, argZero :: Nil)
346-
347346
// restore the original type which we might otherwise have weakened with `baseType` above
348-
gen.mkCast(zero, tp)
347+
c.typecheck(atMacroPos(gen.mkCast(zero, tp)))
349348
} else {
350349
gen.mkZero(tp)
351350
}

src/test/scala/scala/async/run/toughtype/ToughType.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,19 @@ class ToughTypeSpec {
319319
val result = Await.result(fut, 5.seconds)
320320
result mustEqual 1
321321
}
322+
323+
// https://github.com/scala/async/issues/106
324+
@Test def valueClassT106(): Unit = {
325+
import scala.async.internal.AsyncId._
326+
async {
327+
"whatever value" match {
328+
case _ =>
329+
await("whatever return type")
330+
new IntWrapper("value class matters")
331+
}
332+
"whatever return type"
333+
}
334+
}
322335
}
323336

324337
class IntWrapper(val value: String) extends AnyVal {

0 commit comments

Comments
 (0)