From 1fabe19f7eacb668ef26cccde681dce5e2f98072 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 26 Oct 2017 14:48:05 -0400 Subject: - WIP: Wiring everything to get the compiler to work fully. - Fixed a bug when combining field/method/class modifiers. --- new-luxc/source/luxc/analyser/structure.lux | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'new-luxc/source/luxc/analyser') diff --git a/new-luxc/source/luxc/analyser/structure.lux b/new-luxc/source/luxc/analyser/structure.lux index 3bcc04d7e..8c1f7118c 100644 --- a/new-luxc/source/luxc/analyser/structure.lux +++ b/new-luxc/source/luxc/analyser/structure.lux @@ -206,19 +206,25 @@ (&;fail "") )))) -(def: #export (analyse-tagged-sum analyse tag value) +(def: #export (analyse-tagged-sum analyse tag valueC) (-> &;Analyser Ident Code (Meta la;Analysis)) (do meta;Monad [tag (meta;normalize tag) [idx group variantT] (meta;resolve-tag tag) - #let [case-size (list;size group)] - inferenceT (&inference;variant-inference-type idx case-size variantT) - [inferredT valueA+] (&inference;apply-function analyse inferenceT (list value)) - expectedT meta;expected-type - _ (&;with-type-env - (tc;check expectedT inferredT)) - temp &scope;next-local] - (wrap (la;sum idx case-size temp (|> valueA+ list;head maybe;assume))))) + expectedT meta;expected-type] + (case expectedT + (#;Var _) + (do @ + [#let [case-size (list;size group)] + inferenceT (&inference;variant-inference-type idx case-size variantT) + [inferredT valueA+] (&inference;apply-function analyse inferenceT (list valueC)) + _ (&;with-type-env + (tc;check expectedT inferredT)) + temp &scope;next-local] + (wrap (la;sum idx case-size temp (|> valueA+ list;head maybe;assume)))) + + _ + (analyse-sum analyse idx valueC)))) ## There cannot be any ambiguity or improper syntax when analysing ## records, so they must be normalized for further analysis. -- cgit v1.2.3