@@ -40,23 +40,23 @@ object UnsafeExpr {
40
40
*/
41
41
def open [T1 , R , X ](f : Expr [T1 => R ])(content : (Expr [R ], [t] => Expr [t] => Expr [T1 ] => Expr [t]) => X )(given qctx : QuoteContext ): X = {
42
42
import qctx .tasty .{given , _ }
43
- val (params, bodyExpr) = paramsAndBody(f)
43
+ val (params, bodyExpr) = paramsAndBody[ R ] (f)
44
44
content(bodyExpr, [t] => (e : Expr [t]) => (v : Expr [T1 ]) => bodyFn[t](e.unseal, params, List (v.unseal)).seal.asInstanceOf [Expr [t]])
45
45
}
46
46
47
47
def open [T1 , T2 , R , X ](f : Expr [(T1 , T2 ) => R ])(content : (Expr [R ], [t] => Expr [t] => (Expr [T1 ], Expr [T2 ]) => Expr [t]) => X )(given qctx : QuoteContext )(given DummyImplicit ): X = {
48
48
import qctx .tasty .{given , _ }
49
- val (params, bodyExpr) = paramsAndBody(f)
49
+ val (params, bodyExpr) = paramsAndBody[ R ] (f)
50
50
content(bodyExpr, [t] => (e : Expr [t]) => (v1 : Expr [T1 ], v2 : Expr [T2 ]) => bodyFn[t](e.unseal, params, List (v1.unseal, v2.unseal)).seal.asInstanceOf [Expr [t]])
51
51
}
52
52
53
53
def open [T1 , T2 , T3 , R , X ](f : Expr [(T1 , T2 , T3 ) => R ])(content : (Expr [R ], [t] => Expr [t] => (Expr [T1 ], Expr [T2 ], Expr [T3 ]) => Expr [t]) => X )(given qctx : QuoteContext )(given DummyImplicit , DummyImplicit ): X = {
54
54
import qctx .tasty .{given , _ }
55
- val (params, bodyExpr) = paramsAndBody(f)
55
+ val (params, bodyExpr) = paramsAndBody[ R ] (f)
56
56
content(bodyExpr, [t] => (e : Expr [t]) => (v1 : Expr [T1 ], v2 : Expr [T2 ], v3 : Expr [T3 ]) => bodyFn[t](e.unseal, params, List (v1.unseal, v2.unseal, v3.unseal)).seal.asInstanceOf [Expr [t]])
57
57
}
58
58
59
- private def paramsAndBody [R ](given qctx : QuoteContext )(f : Expr [Any ]) = {
59
+ private def paramsAndBody [R ](given qctx : QuoteContext )(f : Expr [Any ]): ( List [qctx.tasty. ValDef ], Expr [ R ]) = {
60
60
import qctx .tasty .{given , _ }
61
61
val Block (List (DefDef (" $anonfun" , Nil , List (params), _, Some (body))), Closure (Ident (" $anonfun" ), None )) = f.unseal.etaExpand
62
62
(params, body.seal.asInstanceOf [Expr [R ]])
0 commit comments