diff options
author | Eduardo Julian | 2018-04-06 08:32:41 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-04-06 08:32:41 -0400 |
commit | ca238f9c89d3156842b0a3d5fe24a5d69b2eedb0 (patch) | |
tree | 50ba106541f2357daf27393df28e8b263f7311e1 /new-luxc/source/luxc/lang/analysis/inference.lux | |
parent | 84d7e87817cd2c074653b34d028c8fa807febc7f (diff) |
- Adapted new-luxc's code to latest stdlib changes.
Diffstat (limited to '')
-rw-r--r-- | new-luxc/source/luxc/lang/analysis/inference.lux | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/new-luxc/source/luxc/lang/analysis/inference.lux b/new-luxc/source/luxc/lang/analysis/inference.lux index 3919ff78d..9bc668050 100644 --- a/new-luxc/source/luxc/lang/analysis/inference.lux +++ b/new-luxc/source/luxc/lang/analysis/inference.lux @@ -13,23 +13,28 @@ (lang ["la" analysis #+ Analysis] (analysis ["&." common])))) -(exception: #export Cannot-Infer) +(do-template [<name>] + [(exception: #export (<name> {message Text}) + message)] + + [Cannot-Infer] + [Cannot-Infer-Argument] + [Smaller-Variant-Than-Expected] + [Invalid-Type-Application] + [Not-A-Record-Type] + [Not-A-Variant-Type] + ) + (def: (cannot-infer type args) (-> Type (List Code) Text) (format " Type: " (%type type) "\n" "Arguments:" (|> args list.enumerate - (list/map (function [[idx argC]] + (list/map (function (_ [idx argC]) (format "\n " (%n idx) " " (%code argC)))) (text.join-with "")))) -(exception: #export Cannot-Infer-Argument) -(exception: #export Smaller-Variant-Than-Expected) -(exception: #export Invalid-Type-Application) -(exception: #export Not-A-Record-Type) -(exception: #export Not-A-Variant-Type) - (def: (replace-bound bound-idx replacementT type) (-> Nat Type Type Type) (case type @@ -131,9 +136,10 @@ (do macro.Monad<Meta> [[outputT' args'A] (general analyse outputT args') argA (&.with-stacked-errors - (function [_] (Cannot-Infer-Argument - (format "Inferred Type: " (%type inputT) "\n" - " Argument: " (%code argC)))) + (function (_ _) + (ex.construct Cannot-Infer-Argument + (format "Inferred Type: " (%type inputT) "\n" + " Argument: " (%code argC)))) (&.with-type inputT (analyse argC)))] (wrap [outputT' (list& argA args'A)])) |