X-Git-Url: https://git.lukelau.me/?p=scheme.git;a=blobdiff_plain;f=typecheck.scm;h=b2b001f1d27220211e5f67e651d641c9895f5b5c;hp=f6d7c86465f4869043b3d2fcb9560e42603258d7;hb=HEAD;hpb=3d94d4500167a8327473e15cf477727968ee36a2 diff --git a/typecheck.scm b/typecheck.scm index f6d7c86..b2b001f 100644 --- a/typecheck.scm +++ b/typecheck.scm @@ -1,4 +1,5 @@ (load "ast.scm") +(load "stdlib.scm") (define (abs? t) (and (list? t) (eq? (car t) 'abs))) @@ -258,7 +259,6 @@ ((res (case (ast-type x) ('int-literal (make-result '() 'Int)) - ('bool-literal (make-result '() 'Bool)) ('string-literal (make-result '() 'String)) ('builtin (make-result '() (builtin-type x))) @@ -318,8 +318,9 @@ (flat-map data-tors-type-env (program-data-layouts prog))) ; we typecheck the lambda calculus only (only single arg lambdas) -(define (typecheck prog) - (let ([expanded (expand-pattern-matches prog)]) +(define (typecheck prog-without-stdlib) + (let* ([prog (append stdlib prog-without-stdlib)] + [expanded (expand-pattern-matches prog)]) (cadr (check (program-data-layouts prog) (init-adts-env expanded) (normalize (program-body expanded))))))