Skip to content

Commit 81440cd

Browse files
authored
Merge pull request #1959 from andrew-johnson-4/lmcommon-typecheck-bounds-fdsuioo
Lmcommon typecheck bounds fdsuioo
2 parents 7682e10 + a11798d commit 81440cd

9 files changed

Lines changed: 2596 additions & 2598 deletions

BOOTSTRAP/cli.c

Lines changed: 2563 additions & 2563 deletions
Large diffs are not rendered by default.

LM23COMMON/typecheck-acontext-substitute.lsts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ let substitute(ctx: List<(CString,AST)>, v: Token): Token = (
1010
let substitute(ctx: List<(CString,AST)>, tt: Type): Type = (
1111
match tt {
1212
TVar{v=name} => match ctx.lookup(v, mk-eof()) {
13-
Lit{tv=key} => t0(tv);
14-
Var{tv=key} => t0(tv);
15-
AType{tv=tt} => tv;
13+
Lit{tv1=key} => t0(tv1);
14+
Var{tv2=key} => t0(tv2);
15+
AType{tv3=tt} => tv3;
1616
_ => tt;
1717
};
1818
TGround{tag=tag,parameters=parameters} => (

LM23COMMON/typecheck-infer-ctx.lsts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11

22
let infer-ctx(tctx: TypeContext?, lhs: AST): TypeContext? = (
33
match lhs {
4-
App{ left:Lit{key:c":"}, right:App{ v-t=left:Var{v=key,vtk=token}, right:AType{tt=tt} } } => (
4+
App{ left:Lit{key:c":"}, right:App{ v-t=left:Var{v1=key,vtk=token}, right:AType{tt=tt} } } => (
55
(tctx, tt) = tctx.phi-initialize(tt, lhs);
66
let dt = denormalize(tt) && t0(c"LocalVariable");
77
let nt = tt.normalize;
8-
tctx = infer-tctx(tctx.bind(v, nt, dt, v-t), tt);
8+
tctx = infer-tctx(tctx.bind(v1, nt, dt, v-t), tt);
99
);
10-
App{ ps=left, right:App{ left:Lit{key:c":"}, right:App{ v-t=left:Var{v=key,vtk=token}, right:AType{tt=tt} } } } => (
10+
App{ ps=left, right:App{ left:Lit{key:c":"}, right:App{ v-t=left:Var{v2=key,vtk=token}, right:AType{tt=tt} } } } => (
1111
(tctx, tt) = tctx.phi-initialize(tt, lhs);
1212
let dt = denormalize(tt) && t0(c"LocalVariable");
1313
let nt = tt.normalize;
14-
tctx = infer-tctx(infer-ctx(tctx.bind(v, nt, dt, v-t),ps), tt);
14+
tctx = infer-tctx(infer-ctx(tctx.bind(v2, nt, dt, v-t),ps), tt);
1515
);
1616
ASTNil{} => ();
1717
}; tctx

LM23COMMON/typecheck-infer-expr.lsts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,11 @@ let std-infer-expr(tctx: Maybe<TypeContext>, term: AST, is-scoped: Bool, used: I
190190
_ => def-i = def-i + 1;
191191
}};
192192
);
193-
Glb{key=key, val=val} => (
193+
Glb{key1=key, val=val} => (
194194
let rough-tt = typeof-term(term);
195195
if rough-tt.is-arrow and not(rough-tt.is-open) and not(rough-tt.is-t(c"TypedMacro",0)) {
196196
let tctx-tctx = tctx.get-or(mk-tctx());
197-
tctx-tctx.function-name = key.key;
197+
tctx-tctx.function-name = key1.key;
198198
tctx = Some(tctx-tctx);
199199
(let inner-tctx, let new-val) = std-infer-expr(tctx, val, is-scoped, Used(), ta);
200200
match new-val {
@@ -206,16 +206,16 @@ let std-infer-expr(tctx: Maybe<TypeContext>, term: AST, is-scoped: Bool, used: I
206206
_ => ();
207207
};
208208
if not(is(val,new-val)) then {
209-
let new-term = mk-glb(key,new-val);
209+
let new-term = mk-glb(key1,new-val);
210210
mark-var-to-def(new-term, term);
211211
term = new-term;
212212
};
213213
};
214214
);
215-
Var{key=key, token=token} => (
216-
(tctx, let vt) = typeof-var(term, tctx, key, hint.is-t(c"MustNotFresh",0) or hint.is-t(c"TailPosition",0));
215+
Var{key2=key, token=token} => (
216+
(tctx, let vt) = typeof-var(term, tctx, key2, hint.is-t(c"MustNotFresh",0) or hint.is-t(c"TailPosition",0));
217217
vt = tctx.with-phi(vt, term);
218-
mark-var-to-def-todo(tctx, key, ta, term);
218+
mark-var-to-def-todo(tctx, key2, ta, term);
219219
# TailPosition LocalVariables don't need to be retained because +1/-1 retain/release cancels itself out
220220
if not(hint.is-t(c"TailPosition",0) and vt.is-t(c"LocalVariable",0))
221221
and not(hint.is-t(c"MustNotRetain",0))
@@ -226,13 +226,13 @@ let std-infer-expr(tctx: Maybe<TypeContext>, term: AST, is-scoped: Bool, used: I
226226
tctx = tctx.ascript(term, vt);
227227
};
228228
);
229-
Lit{key=key, token=token} => (
229+
Lit{key3=key, token=token} => (
230230
if hint.is-t(c"Literal",0) {
231231
tctx = tctx.ascript(term,hint);
232232
} else if not(non-zero(typeof-term(term))) {
233-
if hint.is-t(c"HashtableEq",2) and hint.is-datatype and key==c"HashtableEqEOF"
233+
if hint.is-t(c"HashtableEq",2) and hint.is-datatype and key3==c"HashtableEqEOF"
234234
then {
235-
(tctx, let lit-tt) = tctx.apply-callable(key, t0(c"Nil"), term, hint);
235+
(tctx, let lit-tt) = tctx.apply-callable(key3, t0(c"Nil"), term, hint);
236236
tctx = tctx.ascript(term, lit-tt);
237237
} else {
238238
tctx = tctx.ascript(term, t2(c"Arrow",t0(c"Any"),t0(c"Any")));

LM23COMMON/typecheck-release-locals.lsts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ let release-locals(tctx-before: TypeContext?, tctx-after: TypeContext?, term: AS
2929
tctx-after = tctx-after.ascript(def, binding-type);
3030
};
3131
for nd in needs-release {
32-
let phi-id = nd.denormalized.slot(c"Phi::Id",1).l1.simple-tag;
3332
pid-seen = pid-seen.bind(nd.denormalized.slot(c"Phi::Id",1).l1.simple-tag,true);
3433
let do-release = mk-cons(
3534
mk-app(mk-var(c".release"),mk-var(nd.key-or-zero)),
@@ -46,7 +45,6 @@ let release-locals(tctx-before: TypeContext?, tctx-after: TypeContext?, term: AS
4645
term = mk-cons(term, return-term); tctx-after = tctx-after.ascript(term,return-type);
4746
};
4847
for nd in needs-mark-release {
49-
let phi-id = nd.denormalized.slot(c"Phi::Id",1).l1.simple-tag;
5048
pid-seen = pid-seen.bind(nd.denormalized.slot(c"Phi::Id",1).l1.simple-tag,true);
5149
tctx-after = tctx-after.phi-move(tctx-after.with-phi(nd.denormalized, term), term);
5250
};

LM23COMMON/typecheck-std-apply-macro-candidates.lsts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ let std-try-destructure-macro(tctx: TypeContext?, margs: AST, mtype: Type, mcand
7373

7474
let std-macro-helper-name(tt: Type): CString = (
7575
match tt {
76-
TVar{name=name} => if name.has-prefix(c"macro::") then name else c"";
76+
TVar{name1=name} => if name1.has-prefix(c"macro::") then name1 else c"";
7777
TAnd{conjugate=conjugate} => (
78-
let name = c"";
78+
let name2 = c"";
7979
for c in conjugate {
80-
if not(non-zero(name)) then name = std-macro-helper-name(c);
80+
if not(non-zero(name2)) then name2 = std-macro-helper-name(c);
8181
};
82-
name
82+
name2
8383
);
8484
_ => c"";
8585
};

LM23COMMON/typecheck-std-maybe-release-after-call.lsts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ let std-release-after-call(tctx: TypeContext?, function-type: Type, param-types:
4242
#};
4343

4444
(let tmp-release, tmp-return) = if param-types.is-t(c"MustNotRewrite",0) {
45-
let tmp-id = uuid();
46-
let tmp-def = mk-var(tmp-id); ascript-force(tmp-def, args-type);
47-
let tmp-var2 = mk-var(tmp-id); ascript-force(tmp-var2, args-type);
48-
tctx = tctx.bind(tmp-id, ta, args-type, tmp-def);
49-
mark-var-to-def-todo(tctx, tmp-id, ta, tmp-var2);
45+
let tmp-id1 = uuid();
46+
let tmp-def = mk-var(tmp-id1); ascript-force(tmp-def, args-type);
47+
let tmp-var2 = mk-var(tmp-id1); ascript-force(tmp-var2, args-type);
48+
tctx = tctx.bind(tmp-id1, ta, args-type, tmp-def);
49+
mark-var-to-def-todo(tctx, tmp-id1, ta, tmp-var2);
5050
let tmp-nil = mk-nil(); ascript-force(tmp-nil, t0(c"Nil"));
5151
let declare = mk-abs(tmp-def, tmp-nil, ta); ascript-force(declare, t0(c"Nil"));
5252
let bind = mk-app(declare, args); ascript-force(bind, t0(c"Nil"));
@@ -57,13 +57,13 @@ let std-release-after-call(tctx: TypeContext?, function-type: Type, param-types:
5757

5858
(tmp-var2, args)
5959
} else {
60-
let tmp-id = uuid();
61-
let tmp-def = mk-var(tmp-id); ascript-force(tmp-def, args-type);
62-
let tmp-var2 = mk-var(tmp-id); ascript-force(tmp-var2, args-type);
63-
let tmp-direct = mk-var(tmp-id); ascript-force(tmp-direct, typeof-term(args));
64-
tctx = tctx.bind(tmp-id, ta, args-type, tmp-def);
65-
mark-var-to-def-todo(tctx, tmp-id, ta, tmp-var2);
66-
mark-var-to-def-todo(tctx, tmp-id, ta, tmp-direct);
60+
let tmp-id2 = uuid();
61+
let tmp-def = mk-var(tmp-id2); ascript-force(tmp-def, args-type);
62+
let tmp-var2 = mk-var(tmp-id2); ascript-force(tmp-var2, args-type);
63+
let tmp-direct = mk-var(tmp-id2); ascript-force(tmp-direct, typeof-term(args));
64+
tctx = tctx.bind(tmp-id2, ta, args-type, tmp-def);
65+
mark-var-to-def-todo(tctx, tmp-id2, ta, tmp-var2);
66+
mark-var-to-def-todo(tctx, tmp-id2, ta, tmp-direct);
6767
let tmp-nil = mk-nil(); ascript-force(tmp-nil, t0(c"Nil"));
6868
let declare = mk-abs(tmp-def, tmp-nil, ta); ascript-force(declare, t0(c"Nil"));
6969
let bind = mk-app(declare, args); ascript-force(bind, t0(c"Nil"));

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ CC = clang
22
CFLAGS = -w -O2 -march=native -mtune=native
33

44
dev: install-production
5-
lm tests/promises/list/comparison.lsts
5+
lm tests/promises/lm-typecheck/direct-inference.lsts
66
gcc tmp.c
77
./a.out
88

tests/promises/lm-typecheck/direct-inference.lsts.skip

Whitespace-only changes.

0 commit comments

Comments
 (0)