@@ -93,9 +93,9 @@ let std-apply-macro(tctx: Maybe<TypeContext>, mname: CString, margs: AST, used:
9393 };
9494 };
9595 (let peeped-tctx, peeped-type, margs) = if not(is(strong,MacroSuperWeak)) {
96- std-infer-peeped-arguments(tctx, margs, peep-holes, true);
96+ std-infer-peeped-arguments(tctx, mname, margs, peep-holes, true);
9797 } else {
98- std-infer-peeped-arguments(tctx, margs, peep-holes, false);
98+ std-infer-peeped-arguments(tctx, mname, margs, peep-holes, false);
9999 };
100100 let peeped-tctx-unwrapped = peeped-tctx.get-or(mk-tctx());
101101 peeped-tctx-unwrapped.pctx = tctx.get-or(mk-tctx()).pctx; # Phi Variables are irrelevant to peeped arguments
@@ -127,13 +127,13 @@ let std-apply-macro(tctx: Maybe<TypeContext>, mname: CString, margs: AST, used:
127127
128128 if not(is(strong,MacroWeak) or is(strong,MacroSuperWeak)) and not(non-zero(result)) then exit-error("Failed to Apply Macro: \{mname}\nArgs: \{margs} : \{peeped-type}\n", margs);
129129 if is(strong,MacroTerm) {
130- (tctx, result) = std-infer-expr(tctx, result, false, if return-type==type-lazy then used else Tail, ta);
130+ (tctx, result) = std-infer-expr(tctx, result, false, if mname.is-lazy-macro then Call(mname) else if return-type==type-lazy then used else Tail, ta);
131131 mark-free-and-seen(result);
132132 };
133133 (tctx, result)
134134);
135135
136- let std-infer-peeped-arguments(tctx: Maybe<TypeContext>, t: AST, peep: Type, strong: Bool): (TypeContext?, Type, AST) = (
136+ let std-infer-peeped-arguments(tctx: Maybe<TypeContext>, mname: CString, t: AST, peep: Type, strong: Bool): (TypeContext?, Type, AST) = (
137137 let o-t = t;
138138 let rewritten = false;
139139 match t {
@@ -159,8 +159,8 @@ let std-infer-peeped-arguments(tctx: Maybe<TypeContext>, t: AST, peep: Type, str
159159 TGround{tag:interned-tag-cons, parameters:[p2.. p1..]} => (
160160 match t {
161161 App{is-cons=is-cons, left=left, right=right} => (
162- (tctx, let lt, let new-left) = std-infer-peeped-arguments(tctx, left, p1, strong);
163- (tctx, let rt, let new-right) = std-infer-peeped-arguments(tctx, right, p2, strong);
162+ (tctx, let lt, let new-left) = std-infer-peeped-arguments(tctx, mname, left, p1, strong);
163+ (tctx, let rt, let new-right) = std-infer-peeped-arguments(tctx, mname, right, p2, strong);
164164 if not(is(left,new-left)) or not(is(right,new-right))
165165 then t = mk-cons-or-app(is-cons,new-left,new-right);
166166 (tctx, t2(interned-tag-cons,lt,rt), t)
@@ -172,7 +172,7 @@ let std-infer-peeped-arguments(tctx: Maybe<TypeContext>, t: AST, peep: Type, str
172172 _ => (
173173 if strong {
174174 if not rewritten {
175- (let protected-tctx, t) = std-infer-expr(tctx, t, false, Used(), ta);
175+ (let protected-tctx, t) = std-infer-expr(tctx, t, false, if mname.is-lazy-macro then Call(mname) else Used(), ta);
176176 mark-free-and-seen(t);
177177 tctx = tctx.with-pctx( protected-tctx.get-or(mk-tctx()).pctx );
178178 };
0 commit comments