aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/analyser/function.lux
diff options
context:
space:
mode:
authorEduardo Julian2017-05-30 21:35:37 -0400
committerEduardo Julian2017-05-30 21:35:37 -0400
commitb73f1c909d19d5492d6d9a7dc707a3b817c73619 (patch)
tree369d957687852bb5ca0024e9175072f5c92bf6d1 /new-luxc/source/luxc/analyser/function.lux
parent56b0ca377a30e30bf832d6dfdb789676f67e7ade (diff)
- Documented the analysis phase.
- Some refactoring. - Removed singleton variants.
Diffstat (limited to 'new-luxc/source/luxc/analyser/function.lux')
-rw-r--r--new-luxc/source/luxc/analyser/function.lux8
1 files changed, 5 insertions, 3 deletions
diff --git a/new-luxc/source/luxc/analyser/function.lux b/new-luxc/source/luxc/analyser/function.lux
index 394e65c4d..1aad8954e 100644
--- a/new-luxc/source/luxc/analyser/function.lux
+++ b/new-luxc/source/luxc/analyser/function.lux
@@ -62,7 +62,7 @@
(function [[output-id outputT]]
(do @
[#let [funT (#;Function inputT outputT)]
- =function (recur funT)
+ funA (recur funT)
funT' (&;within-type-env
(TC;clean output-id funT))
concrete-input? (&;within-type-env
@@ -70,15 +70,17 @@
funT'' (if concrete-input?
(&;within-type-env
(TC;clean input-id funT'))
- (wrap (#;UnivQ (list) (&inference;bind-var input-id +1 funT'))))
+ (wrap (type;univ-q +1 (&inference;replace-var input-id +1 funT'))))
_ (&;within-type-env
(TC;check expected funT''))]
- (wrap =function))
+ (wrap funA))
))))))
(#;Function inputT outputT)
(<| (:: @ map (|>. #la;Function))
&;with-scope
+ ## Functions have access not only to their argument, but
+ ## also to themselves, through a local variable.
(&env;with-local [func-name functionT])
(&env;with-local [arg-name inputT])
(&;with-expected-type outputT)