@@ -6,7 +6,12 @@ trait AsyncTransform {
66 import global ._
77
88 def asyncTransform [T ](body : Tree , execContext : Tree , cpsFallbackEnabled : Boolean )
9- (implicit resultType : WeakTypeTag [T ]): Tree = {
9+ (resultType : WeakTypeTag [T ]): Tree = {
10+
11+ // We annotate the type of the whole expression as `T @uncheckedBounds` so as not to introduce
12+ // warnings about non-conformant LUBs. See SI-7694
13+ // This implicit propatages the annotated type in the type tag.
14+ implicit val uncheckedBoundsResultTag : WeakTypeTag [T ] = WeakTypeTag [T ](rootMirror, FixedMirrorTypeCreator (rootMirror, uncheckedBounds(resultType.tpe)))
1015
1116 reportUnsupportedAwaits(body, report = ! cpsFallbackEnabled)
1217
@@ -22,12 +27,12 @@ trait AsyncTransform {
2227 DefDef (NoMods , name.apply, Nil , applyVParamss, TypeTree (definitions.UnitTpe ), Literal (Constant (())))
2328 }
2429
25- val stateMachineType = applied(" scala.async.StateMachine" , List (futureSystemOps.promType[T ], futureSystemOps.execContextType))
30+ val stateMachineType = applied(" scala.async.StateMachine" , List (futureSystemOps.promType[T ](uncheckedBoundsResultTag) , futureSystemOps.execContextType))
2631
2732 val stateMachine : ClassDef = {
2833 val body : List [Tree ] = {
2934 val stateVar = ValDef (Modifiers (Flag .MUTABLE | Flag .PRIVATE | Flag .LOCAL ), name.state, TypeTree (definitions.IntTpe ), Literal (Constant (0 )))
30- val result = ValDef (NoMods , name.result, TypeTree (futureSystemOps.promType[T ]) , futureSystemOps.createProm[T ].tree)
35+ val result = ValDef (NoMods , name.result, TypeTree (futureSystemOps.promType[T ](uncheckedBoundsResultTag)) , futureSystemOps.createProm[T ](uncheckedBoundsResultTag) .tree)
3136 val execContextValDef = ValDef (NoMods , name.execContext, TypeTree (), execContext)
3237
3338 val apply0DefDef : DefDef = {
0 commit comments