Skip to content

Commit 89674fc

Browse files
committed
cases-of OK
1 parent c1109e2 commit 89674fc

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

SRC/typecheck-infer-expr.lsts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ let std-infer-expr(tctx: Maybe<TypeContext>, term: AST, is-scoped: Bool, used: I
9393
tctx = tctx.ascript(term, type-nil);
9494
for kt in index-fields-of.lookup((dt.first,dt.second,tg), mk-vector(type((CString,Type)))) {
9595
let actx = mk-actx().bind(field-item,mk-var(kt.first));
96-
body = substitute(actx,body);
97-
(tctx, body) = std-infer-expr(tctx, body, false, Used, ta);
98-
term = mk-cons(term, body);
96+
let re-body = substitute(actx,body);
97+
(tctx, re-body) = std-infer-expr(tctx, re-body, false, Used, ta);
98+
term = mk-cons(term, re-body);
9999
tctx = tctx.ascript(term, type-nil);
100100
};
101101
);
@@ -120,9 +120,9 @@ let std-infer-expr(tctx: Maybe<TypeContext>, term: AST, is-scoped: Bool, used: I
120120
# this convention is used to *discard* any tag information that exists in terms like (x as Tag::)
121121
# so effectively this is still a good and perfectly valid tag
122122
let actx = mk-actx().bind(case-item,mk-atype(t0(c"Tag::" + k)));
123-
body = substitute(actx,body);
124-
(tctx, body) = std-infer-expr(tctx, body, false, Used, ta);
125-
term = mk-cons(term, body);
123+
let re-body = substitute(actx,body);
124+
(tctx, re-body) = std-infer-expr(tctx, re-body, false, Used, ta);
125+
term = mk-cons(term, re-body);
126126
tctx = tctx.ascript(term, type-nil);
127127
};
128128
);

tests/promises/meta/cases-of.lsts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,46 +8,46 @@ let cases-count = 0;
88
let cases-cat = c"";
99

1010
cases-count = 0;
11-
case-cat = c"";
11+
cases-cat = c"";
1212
for case in $cases-of(B(1,2)) {
1313
cases-count = cases-count + 1;
1414
cases-cat = cases-cat + stringof(case);
1515
};
16-
print("case cat of B = \{cases-cat}\n");
16+
assert( cases-cat == c"Tag::BTag::C" );
1717
assert( cases-count == 2 );
1818

1919
cases-count = 0;
20-
case-cat = c"";
20+
cases-cat = c"";
2121
for case in $cases-of(C(1,2,3)) {
2222
cases-count = cases-count + 1;
2323
cases-cat = cases-cat + stringof(case);
2424
};
25-
print("case cat of C = \{cases-cat}\n");
25+
assert( cases-cat == c"Tag::BTag::C" );
2626
assert( cases-count == 2 );
2727

2828
cases-count = 0;
29-
case-cat = c"";
29+
cases-cat = c"";
3030
for case in $cases-of(B(1,2) as Tag::B) {
3131
cases-count = cases-count + 1;
3232
cases-cat = cases-cat + stringof(case);
3333
};
34-
print("case cat of B as Tag::B = \{cases-cat}\n");
34+
assert( cases-cat == c"Tag::BTag::C" );
3535
assert( cases-count == 2 );
3636

3737
cases-count = 0;
38-
case-cat = c"";
38+
cases-cat = c"";
3939
for case in $cases-of(C(1,2,3) as Tag::C) {
4040
cases-count = cases-count + 1;
4141
cases-cat = cases-cat + stringof(case);
4242
};
43-
print("case cat of C as Tag::C = \{cases-cat}\n");
43+
assert( cases-cat == c"Tag::BTag::C" );
4444
assert( cases-count == 2 );
4545

4646
cases-count = 0;
47-
case-cat = c"";
47+
cases-cat = c"";
4848
for case in $cases-of(D(1,2,3,4)) {
4949
cases-count = cases-count + 1;
5050
cases-cat = cases-cat + stringof(case);
5151
};
52-
print("cases cat of D = \{cases-cat}\n");
52+
assert( cases-cat == c"Tag::" );
5353
assert( cases-count == 1 );

0 commit comments

Comments
 (0)