From b73f1c909d19d5492d6d9a7dc707a3b817c73619 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 30 May 2017 21:35:37 -0400 Subject: - Documented the analysis phase. - Some refactoring. - Removed singleton variants. --- new-luxc/source/luxc/analyser/function.lux | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'new-luxc/source/luxc/analyser/function.lux') 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) -- cgit v1.2.3