aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/analysis/inference.lux
diff options
context:
space:
mode:
authorEduardo Julian2017-11-13 23:26:06 -0400
committerEduardo Julian2017-11-13 23:26:06 -0400
commit70005a6dee1eba3e3f5694aa4903e95988dcaa3d (patch)
tree19141f900847092c3aa5032a62b6b97eb1ea9a33 /new-luxc/source/luxc/lang/analysis/inference.lux
parentb08f7d83a591be770af64b4c9ccd59f3306689e8 (diff)
- Refactoring.
- Now giving type checking/inference a higher priority. - Better error messages.
Diffstat (limited to 'new-luxc/source/luxc/lang/analysis/inference.lux')
-rw-r--r--new-luxc/source/luxc/lang/analysis/inference.lux27
1 files changed, 13 insertions, 14 deletions
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<Meta>
- [[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<Meta>
+ [[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<Meta>