fixed field selectors on arity 0 functions
[cc1516.git] / sem.icl
diff --git a/sem.icl b/sem.icl
index eef2974..fd9eb5c 100644 (file)
--- a/sem.icl
+++ b/sem.icl
@@ -308,8 +308,8 @@ instance infer Expr where
             _ = pure f
         ) >>= \newF->
         fresh >>= \tv->case expected of
-            FuncType t = pure (s1, t, (FunExpr p newF args fs))
-                //TODO: Fieldselectors!
+            FuncType t = foldM foldFieldSelectors t fs >>= \returnType ->
+                pure (s1, returnType, (FunExpr p newF args fs))
             _ = (let given = foldr (->>) tv argTs in
                 lift (unify expected given) >>= \s2->
                 applySubst s2 >>|