diff options
author | Eduardo Julian | 2017-10-22 12:32:38 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-10-22 12:32:38 -0400 |
commit | 49f74e0ea7e9ef22ac7a189ff536a839d703ac5d (patch) | |
tree | cfb9547e257da37b70e20d0e0d4d50f24f760b3e /new-luxc/source/luxc | |
parent | 0bc56fdc626ee601ca2c4ba0502f76e76d765fa0 (diff) |
- Fixed some type-checking errors.
Diffstat (limited to 'new-luxc/source/luxc')
-rw-r--r-- | new-luxc/source/luxc/analyser/function.lux | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/new-luxc/source/luxc/analyser/function.lux b/new-luxc/source/luxc/analyser/function.lux index 424a3188f..1432308f8 100644 --- a/new-luxc/source/luxc/analyser/function.lux +++ b/new-luxc/source/luxc/analyser/function.lux @@ -19,10 +19,10 @@ (-> &;Analyser Text Text Code (Meta Analysis)) (do Monad<Meta> [functionT meta;expected-type] - (loop [expected functionT] + (loop [expectedT functionT] (&;with-stacked-errors - (function [_] (format "Functions require function types: " (type;to-text expected))) - (case expected + (function [_] (format "Functions require function types: " (type;to-text expectedT))) + (case expectedT (#;Named name unnamedT) (recur unnamedT) @@ -38,22 +38,22 @@ (do @ [[var-id var] (&;with-type-env tc;existential)] - (recur (maybe;assume (type;apply (list var) expected)))) + (recur (maybe;assume (type;apply (list var) expectedT)))) (#;ExQ _) (&common;with-var (function [[var-id var]] - (recur (maybe;assume (type;apply (list var) expected))))) + (recur (maybe;assume (type;apply (list var) expectedT))))) (#;Var id) (do @ [? (&;with-type-env - (tc;bound? id))] + (tc;concrete? id))] (if ? (do @ - [expected' (&;with-type-env - (tc;read id))] - (recur expected')) + [expectedT' (&;with-type-env + (tc;read id))] + (recur expectedT')) ## Inference (&common;with-var (function [[input-id inputT]] @@ -65,13 +65,13 @@ funT' (&;with-type-env (tc;clean output-id funT)) concrete-input? (&;with-type-env - (tc;bound? input-id)) + (tc;concrete? input-id)) funT'' (if concrete-input? (&;with-type-env (tc;clean input-id funT')) (wrap (type;univ-q +1 (&inference;replace-var input-id +1 funT')))) _ (&;with-type-env - (tc;check expected funT''))] + (tc;check expectedT funT''))] (wrap funA)) )))))) @@ -80,7 +80,7 @@ &;with-scope ## Functions have access not only to their argument, but ## also to themselves, through a local variable. - (&scope;with-local [func-name functionT]) + (&scope;with-local [func-name expectedT]) (&scope;with-local [arg-name inputT]) (&;with-expected-type outputT) (analyse body)) |