Skip to content

Commit 5271e92

Browse files
committed
the peeped type here is wrong because it isnt supposed to be deconstructed
1 parent 7186dab commit 5271e92

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

PLUGINS/FRONTEND/LSTS/lsts-parse.lsts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1883,7 +1883,7 @@ let lsts-parse-atom-without-tail(tokens: List<Token>): Tuple<AST,List<Token>> =
18831883
lsts-parse-expect(c"}", tokens); tokens = tail(tokens);
18841884
term = mk-app(
18851885
mk-app(
1886-
Var( c"while", with-location(mk-token("while"),loc) ),
1886+
Var( c"macro::while", with-location(mk-token("macro::while"),loc) ),
18871887
c-rest.first
18881888
),
18891889
mk-app(

SRC/typecheck-std-apply-macro.lsts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ let std-apply-macro-location(tctx: Maybe<TypeContext>, mname: CString, margs: AS
5858

5959
let std-apply-macro(tctx: Maybe<TypeContext>, mname: CString, margs: AST, used: IsUsed, strong: Bool): (TypeContext?, AST) = (
6060
let result = mk-eof();
61+
let peeped-type = ta;
6162
if mname==c"macro::concat" then (tctx, result) = std-apply-macro-concat(tctx, mname, margs)
6263
else if mname==c"macro::location" then (tctx, result) = std-apply-macro-location(tctx, mname, margs)
6364
else if mname==c"macro::variable" then (tctx, result) = std-apply-macro-variable(tctx, mname, margs)
@@ -76,7 +77,7 @@ let std-apply-macro(tctx: Maybe<TypeContext>, mname: CString, margs: AST, used:
7677
peeped = mtype;
7778
};
7879
};
79-
(tctx, let peeped-type, margs) = std-infer-peeped-arguments(tctx, margs, peep-holes);
80+
(tctx, peeped-type, margs) = std-infer-peeped-arguments(tctx, margs, peep-holes);
8081

8182
let matched = [] : List<(Type,AST)>;
8283
for list Tuple{mtype=first, mterm=third} in row {
@@ -102,7 +103,7 @@ let std-apply-macro(tctx: Maybe<TypeContext>, mname: CString, margs: AST, used:
102103
(tctx, result) = std-apply-macro-candidates(tctx, mname, margs, candidates);
103104
};
104105

105-
if strong and not(non-zero(result)) then exit-error("Failed to Apply Macro: \{mname}\nArgs: \{margs}\n", margs);
106+
if strong and not(non-zero(result)) then exit-error("Failed to Apply Macro: \{mname}\nArgs: \{margs} : \{peeped-type}\n", margs);
106107
if strong {
107108
(tctx, result) = std-infer-expr(tctx, result, false, used, ta);
108109
mark-free-and-seen(result);

lib/core/common-macros.lsts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ typed macro macro::lhs-index(base field: macro::lhs-field, index: lazy): lazy =
5151
macro::concat($".", field)(base); index
5252
);
5353

54-
typed macro macro::while(cond: lazy, body: lazy): lazy = (
54+
typed macro macro::while(cond: Bool, body: lazy): lazy = (
5555
primitive::while( cond, body as Nil )
5656
);
5757

0 commit comments

Comments
 (0)