From 70005a6dee1eba3e3f5694aa4903e95988dcaa3d Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 13 Nov 2017 23:26:06 -0400 Subject: - Refactoring. - Now giving type checking/inference a higher priority. - Better error messages. --- new-luxc/source/luxc/lang/analysis/inference.lux | 27 ++++++++++++------------ 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'new-luxc/source/luxc/lang/analysis/inference.lux') diff --git a/new-luxc/source/luxc/lang/analysis/inference.lux b/new-luxc/source/luxc/lang/analysis/inference.lux index e2866ac87..934ecafa5 100644 --- a/new-luxc/source/luxc/lang/analysis/inference.lux +++ b/new-luxc/source/luxc/lang/analysis/inference.lux @@ -109,20 +109,19 @@ (apply-function analyse unnamedT args) (#;UnivQ _) - (&common;with-var - (function [[var-id varT]] - (do Monad - [[outputT argsA] (apply-function analyse (maybe;assume (type;apply (list varT) inferT)) args)] - (do @ - [? (&;with-type-env - (tc;concrete? var-id)) - ## Quantify over the type if genericity/parametricity - ## is discovered. - outputT' (if ? - (&;with-type-env - (tc;clean var-id outputT)) - (wrap (type;univ-q +1 (replace-var var-id +1 outputT))))] - (wrap [outputT' argsA]))))) + (do Monad + [[var-id varT] (&;with-type-env tc;var) + [outputT argsA] (apply-function analyse (maybe;assume (type;apply (list varT) inferT)) args)] + (do @ + [? (&;with-type-env + (tc;concrete? var-id)) + ## Quantify over the type if genericity/parametricity + ## is discovered. + outputT' (if ? + (&;with-type-env + (tc;clean var-id outputT)) + (wrap (type;univ-q +1 (replace-var var-id +1 outputT))))] + (wrap [outputT' argsA]))) (#;ExQ _) (do Monad -- cgit v1.2.3