File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
main/scala/scala/async/internal
test/scala/scala/async/run/toughtype Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -259,10 +259,11 @@ private[async] trait TransformUtils {
259259 if (tp.typeSymbol.isDerivedValueClass) {
260260 val argZero = mkZero(tp.memberType(tp.typeSymbol.derivedValueClassUnbox).resultType)
261261 val target : Tree = gen.mkAttributedSelect(
262- typer .typedPos(macroPos)(
262+ callSiteTyper .typedPos(macroPos)(
263263 New (TypeTree (tp.baseType(tp.typeSymbol)))), tp.typeSymbol.primaryConstructor)
264264 val zero = gen.mkMethodCall(target, argZero :: Nil )
265- gen.mkCast(zero, tp)
265+ // restore the original type which we might otherwise have weakened with `baseType` above
266+ callSiteTyper.typedPos(macroPos)(gen.mkCast(zero, tp))
266267 } else {
267268 gen.mkZero(tp)
268269 }
Original file line number Diff line number Diff line change @@ -286,6 +286,19 @@ class ToughTypeSpec {
286286 val result = Await .result(fut, 5 .seconds)
287287 result mustBe None
288288 }
289+
290+ // https://github.com/scala/async/issues/106
291+ @ Test def valueClassT106 (): Unit = {
292+ import scala .async .internal .AsyncId ._
293+ async {
294+ " whatever value" match {
295+ case _ =>
296+ await(" whatever return type" )
297+ new IntWrapper (" value class matters" )
298+ }
299+ " whatever return type"
300+ }
301+ }
289302}
290303
291304class IntWrapper (val value : String ) extends AnyVal {
You can’t perform that action at this time.
0 commit comments