Skip to content

Commit 0dcb9d0

Browse files
authored
Merge pull request #2008 from andrew-johnson-4/type-list-to-vector-dfklsdi
Type list to vector dfklsdi
2 parents d4022c1 + 022b078 commit 0dcb9d0

6 files changed

Lines changed: 4378 additions & 4282 deletions

File tree

BOOTSTRAP/cli.c

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

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ LSTSFLAGS = MALLOC_CHECK_=3
88
# recommendation: ulimit -s unlimited
99

1010
dev: install-production
11-
lm --v23 tests/promises/vector/constructor.lsts
11+
lm tests/promises/vector/constructor.lsts
1212
$(CC) $(CFLAGS) tmp.c
1313
./a.out
1414

SRC/dev-prop-tctx-least-upper-bound.lsts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ let .least-upper-bound(tctx: TypeContext?, left: Vector<Type>, right: Vector<Typ
7878
let success = true;
7979
while rli < left.length {
8080
(tctx, let tt) = tctx.least-upper-bound(left[rli],right[rli],blame);
81-
if non-zero(tt) then next = next.push(tt);
81+
if not(non-zero(left[rli])) and not(non-zero(right[rli])) then next = next.push(ta);
82+
else if non-zero(tt) then next = next.push(tt);
8283
else success = false;
8384
rli = rli + 1;
8485
};

SRC/typecheck-typecheck.lsts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11

22
let typecheck(): Nil = (
3-
print("Typecheck 1\n");
43
infer-global-context-prim(ast-parsed-program);
5-
print("Typecheck 2\n");
64
infer-global-context-td(ast-parsed-program);
7-
print("Typecheck 3\n");
85
infer-global-context(ast-parsed-program);
9-
print("Typecheck 4\n");
106
assert-no-infinite-types();
11-
print("Typecheck 5\n");
127
(global-flow-tctx, ast-parsed-program) = infer-global-terms(global-flow-tctx, ast-parsed-program);
138
tctx-currently-processing-globals = false;
14-
print("Typecheck 6\n");
159
(global-flow-tctx, ast-parsed-program) = std-infer-expr(global-flow-tctx, ast-parsed-program, false, Used, ta);
16-
print("Typecheck 7\n");
1710
# TODO: release globals for graceful exit
1811
while non-zero(stack-to-specialize) { match stack-to-specialize {
1912
# this can't be a normal for-loop because it gets extended during iteration
@@ -22,11 +15,7 @@ let typecheck(): Nil = (
2215
specialize(key, ctx, result-type, term);
2316
);
2417
}};
25-
print("Typecheck 8\n");
2618
validate-interfaces();
27-
print("Typecheck 9\n");
2819
assert-well-typed(ast-parsed-program);
29-
print("Typecheck 10\n");
3020
decorate-var-to-def();
31-
print("Typecheck 11\n");
3221
);

SRC/unit-main-core.lsts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,10 @@ let main(argc: C_int, argv: CString[]): Nil = (
9999
print("\{ast-parsed-program}\n");
100100
);
101101
_ => (
102-
print("Begin Parse\n");
103102
for list fp4 in input.reverse { frontend(fp4); };
104-
print("End Parse, Begin Preprocess\n");
105103
match config-mode {
106104
ModeTypecheck{} => (preprocess(); typecheck(););
107-
ModeCompile{} => (preprocess(); print("End Preprocess, Begin Typecheck\n"); typecheck(); print("End Typecheck, Begin Backend\n"); plugin-current-backend(); );
105+
ModeCompile{} => (preprocess(); typecheck(); plugin-current-backend(); );
108106
};
109107
);
110108
};

lib/core/vector.lsts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,17 @@ let .reverse(v: Vector<t>): Vector<t> = (
204204

205205
# new allocations = 0
206206
let .into(v: Vector<t>, tt: Type<Vector<t>>): Vector<t> = v;
207+
let .into(v: Vector<t>, tt: Type<String>): String = (
208+
let s = "[";
209+
let i = 0_sz;
210+
for vector t in v {
211+
if i>0 then s = s + ",";
212+
s = s + t.into(type(String));
213+
i = i + 1;
214+
};
215+
s = s + "]";
216+
s
217+
);
207218

208219
let .contains(v: Vector<t>, i: t): Bool = (
209220
let result = false;

0 commit comments

Comments
 (0)