aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/tool/compiler/phase/analysis
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/tool/compiler/phase/analysis.lux4
-rw-r--r--stdlib/source/lux/tool/compiler/phase/analysis/case.lux18
-rw-r--r--stdlib/source/lux/tool/compiler/phase/analysis/case/coverage.lux12
-rw-r--r--stdlib/source/lux/tool/compiler/phase/analysis/function.lux12
-rw-r--r--stdlib/source/lux/tool/compiler/phase/analysis/inference.lux24
-rw-r--r--stdlib/source/lux/tool/compiler/phase/analysis/module.lux10
-rw-r--r--stdlib/source/lux/tool/compiler/phase/analysis/reference.lux4
-rw-r--r--stdlib/source/lux/tool/compiler/phase/analysis/scope.lux3
-rw-r--r--stdlib/source/lux/tool/compiler/phase/analysis/structure.lux50
9 files changed, 68 insertions, 69 deletions
diff --git a/stdlib/source/lux/tool/compiler/phase/analysis.lux b/stdlib/source/lux/tool/compiler/phase/analysis.lux
index dd21c8a1e..9281046c1 100644
--- a/stdlib/source/lux/tool/compiler/phase/analysis.lux
+++ b/stdlib/source/lux/tool/compiler/phase/analysis.lux
@@ -7,7 +7,7 @@
[data
["." error]
[text
- format]]
+ ["%" format (#+ format)]]]
["." macro]]
["." / #_
["#." type]
@@ -24,7 +24,7 @@
["/" analysis (#+ Analysis Operation Phase)]]]])
(exception: #export (unrecognized-syntax {code Code})
- (ex.report ["Code" (%code code)]))
+ (ex.report ["Code" (%.code code)]))
## TODO: Had to split the 'compile' function due to compilation issues
## with old-luxc. Must re-combine all the code ASAP
diff --git a/stdlib/source/lux/tool/compiler/phase/analysis/case.lux b/stdlib/source/lux/tool/compiler/phase/analysis/case.lux
index 4846b8f54..85be37a90 100644
--- a/stdlib/source/lux/tool/compiler/phase/analysis/case.lux
+++ b/stdlib/source/lux/tool/compiler/phase/analysis/case.lux
@@ -9,7 +9,7 @@
["." error]
["." maybe]
[text
- format]
+ ["%" format (#+ format)]]
[collection
["." list ("#@." fold monoid functor)]]]
["." type
@@ -28,22 +28,22 @@
["#." coverage (#+ Coverage)]])
(exception: #export (cannot-match-with-pattern {type Type} {pattern Code})
- (ex.report ["Type" (%type type)]
- ["Pattern" (%code pattern)]))
+ (ex.report ["Type" (%.type type)]
+ ["Pattern" (%.code pattern)]))
(exception: #export (sum-has-no-case {case Nat} {type Type})
- (ex.report ["Case" (%n case)]
- ["Type" (%type type)]))
+ (ex.report ["Case" (%.nat case)]
+ ["Type" (%.type type)]))
(exception: #export (not-a-pattern {code Code})
- (ex.report ["Code" (%code code)]))
+ (ex.report ["Code" (%.code code)]))
(exception: #export (cannot-simplify-for-pattern-matching {type Type})
- (ex.report ["Type" (%type type)]))
+ (ex.report ["Type" (%.type type)]))
(exception: #export (non-exhaustive-pattern-matching {input Code} {branches (List [Code Code])} {coverage Coverage})
- (ex.report ["Input" (%code input)]
- ["Branches" (%code (code.record branches))]
+ (ex.report ["Input" (%.code input)]
+ ["Branches" (%.code (code.record branches))]
["Coverage" (/coverage.%coverage coverage)]))
(exception: #export (cannot-have-empty-branches {message Text})
diff --git a/stdlib/source/lux/tool/compiler/phase/analysis/case/coverage.lux b/stdlib/source/lux/tool/compiler/phase/analysis/case/coverage.lux
index 3444a5355..067ce0972 100644
--- a/stdlib/source/lux/tool/compiler/phase/analysis/case/coverage.lux
+++ b/stdlib/source/lux/tool/compiler/phase/analysis/case/coverage.lux
@@ -12,7 +12,7 @@
[number
["." nat]]
["." text
- format]
+ ["%" format (#+ Format format)]]
[collection
["." list ("#@." functor fold)]
["." dictionary (#+ Dictionary)]]]]
@@ -68,17 +68,17 @@
(#Bit value')
(|> value'
- %b
+ %.bit
(text.enclose ["(#Bit " ")"]))
(#Variant ?max-cases cases)
(|> cases
dictionary.entries
(list@map (function (_ [idx coverage])
- (format (%n idx) " " (%coverage coverage))))
+ (format (%.nat idx) " " (%coverage coverage))))
(text.join-with " ")
(text.enclose ["{" "}"])
- (format (%n (..cases ?max-cases)) " ")
+ (format (%.nat (..cases ?max-cases)) " ")
(text.enclose ["(#Variant " ")"]))
(#Seq left right)
@@ -206,8 +206,8 @@
(open: "coverage/." ..equivalence)
(exception: #export (variants-do-not-match {addition-cases Nat} {so-far-cases Nat})
- (ex.report ["So-far Cases" (%n so-far-cases)]
- ["Addition Cases" (%n addition-cases)]))
+ (ex.report ["So-far Cases" (%.nat so-far-cases)]
+ ["Addition Cases" (%.nat addition-cases)]))
## After determining the coverage of each individual pattern, it is
## necessary to merge them all to figure out if the entire
diff --git a/stdlib/source/lux/tool/compiler/phase/analysis/function.lux b/stdlib/source/lux/tool/compiler/phase/analysis/function.lux
index 76effa0dc..5e5e26b85 100644
--- a/stdlib/source/lux/tool/compiler/phase/analysis/function.lux
+++ b/stdlib/source/lux/tool/compiler/phase/analysis/function.lux
@@ -7,7 +7,7 @@
[data
["." maybe]
["." text
- format]
+ ["%" format (#+ format)]]
[collection
["." list ("#@." fold monoid monad)]]]
["." type
@@ -23,18 +23,18 @@
["/" analysis (#+ Analysis Operation Phase)]]]])
(exception: #export (cannot-analyse {expected Type} {function Text} {argument Text} {body Code})
- (ex.report ["Type" (%type expected)]
+ (ex.report ["Type" (%.type expected)]
["Function" function]
["Argument" argument]
- ["Body" (%code body)]))
+ ["Body" (%.code body)]))
(exception: #export (cannot-apply {functionT Type} {functionC Code} {arguments (List Code)})
- (ex.report ["Function type" (%type functionT)]
- ["Function" (%code functionC)]
+ (ex.report ["Function type" (%.type functionT)]
+ ["Function" (%.code functionC)]
["Arguments" (|> arguments
list.enumerate
(list@map (.function (_ [idx argC])
- (format (%n idx) " " (%code argC))))
+ (format (%.nat idx) " " (%.code argC))))
(text.join-with text.new-line))]))
(def: #export (function analyse function-name arg-name body)
diff --git a/stdlib/source/lux/tool/compiler/phase/analysis/inference.lux b/stdlib/source/lux/tool/compiler/phase/analysis/inference.lux
index 7ef29752e..701e01167 100644
--- a/stdlib/source/lux/tool/compiler/phase/analysis/inference.lux
+++ b/stdlib/source/lux/tool/compiler/phase/analysis/inference.lux
@@ -7,7 +7,7 @@
[data
["." maybe]
["." text
- format]
+ ["%" format (#+ format)]]
[collection
["." list ("#@." functor)]]]
["." type
@@ -21,29 +21,29 @@
["/" analysis (#+ Tag Analysis Operation Phase)]]]])
(exception: #export (variant-tag-out-of-bounds {size Nat} {tag Tag} {type Type})
- (ex.report ["Tag" (%n tag)]
- ["Variant size" (%i (.int size))]
- ["Variant type" (%type type)]))
+ (ex.report ["Tag" (%.nat tag)]
+ ["Variant size" (%.int (.int size))]
+ ["Variant type" (%.type type)]))
(exception: #export (cannot-infer {type Type} {args (List Code)})
- (ex.report ["Type" (%type type)]
+ (ex.report ["Type" (%.type type)]
["Arguments" (|> args
list.enumerate
(list@map (function (_ [idx argC])
- (format text.new-line " " (%n idx) " " (%code argC))))
+ (format text.new-line " " (%.nat idx) " " (%.code argC))))
(text.join-with ""))]))
(exception: #export (cannot-infer-argument {inferred Type} {argument Code})
- (ex.report ["Inferred Type" (%type inferred)]
- ["Argument" (%code argument)]))
+ (ex.report ["Inferred Type" (%.type inferred)]
+ ["Argument" (%.code argument)]))
(exception: #export (smaller-variant-than-expected {expected Nat} {actual Nat})
- (ex.report ["Expected" (%i (.int expected))]
- ["Actual" (%i (.int actual))]))
+ (ex.report ["Expected" (%.int (.int expected))]
+ ["Actual" (%.int (.int actual))]))
(template [<name>]
[(exception: #export (<name> {type Type})
- (%type type))]
+ (%.type type))]
[not-a-variant-type]
[not-a-record-type]
@@ -82,7 +82,7 @@
(def: (named-type cursor id)
(-> Cursor Nat Type)
- (let [name (format "{New Type @ " (.cursor-description cursor) " " (%n id) "}")]
+ (let [name (format "{New Type @ " (.cursor-description cursor) " " (%.nat id) "}")]
(#.Primitive name (list))))
(def: new-named-type
diff --git a/stdlib/source/lux/tool/compiler/phase/analysis/module.lux b/stdlib/source/lux/tool/compiler/phase/analysis/module.lux
index 6a33171f1..c6280e4b3 100644
--- a/stdlib/source/lux/tool/compiler/phase/analysis/module.lux
+++ b/stdlib/source/lux/tool/compiler/phase/analysis/module.lux
@@ -7,7 +7,7 @@
["ex" exception (#+ exception:)]]
[data
["." text ("#@." equivalence)
- format]
+ ["%" format (#+ format)]]
["." error]
[collection
["." list ("#@." fold functor)]
@@ -31,14 +31,14 @@
(template [<name>]
[(exception: #export (<name> {tags (List Text)} {owner Type})
(ex.report ["Tags" (text.join-with " " tags)]
- ["Type" (%type owner)]))]
+ ["Type" (%.type owner)]))]
[cannot-declare-tags-for-unnamed-type]
[cannot-declare-tags-for-foreign-type]
)
(exception: #export (cannot-define-more-than-once {name Name})
- (ex.report ["Definition" (%name name)]))
+ (ex.report ["Definition" (%.name name)]))
(exception: #export (can-only-change-state-of-active-module {module Text} {state Module-State})
(ex.report ["Module" module]
@@ -49,8 +49,8 @@
(exception: #export (cannot-set-module-annotations-more-than-once {module Text} {old Code} {new Code})
(ex.report ["Module" module]
- ["Old annotations" (%code old)]
- ["New annotations" (%code new)]))
+ ["Old annotations" (%.code old)]
+ ["New annotations" (%.code new)]))
(def: #export (new hash)
(-> Nat Module)
diff --git a/stdlib/source/lux/tool/compiler/phase/analysis/reference.lux b/stdlib/source/lux/tool/compiler/phase/analysis/reference.lux
index c09ea55ba..6a5c4f889 100644
--- a/stdlib/source/lux/tool/compiler/phase/analysis/reference.lux
+++ b/stdlib/source/lux/tool/compiler/phase/analysis/reference.lux
@@ -7,7 +7,7 @@
["." macro]
[data
["." text ("#@." equivalence)
- format]]]
+ ["%" format (#+ format)]]]]
["." // #_
["#." scope]
["#." type]
@@ -24,7 +24,7 @@
(exception: #export (definition-has-not-been-exported {definition Name})
(exception.report
- ["Definition" (%name definition)]))
+ ["Definition" (%.name definition)]))
(def: (definition def-name)
(-> Name (Operation Analysis))
diff --git a/stdlib/source/lux/tool/compiler/phase/analysis/scope.lux b/stdlib/source/lux/tool/compiler/phase/analysis/scope.lux
index abf8f2a04..104001da9 100644
--- a/stdlib/source/lux/tool/compiler/phase/analysis/scope.lux
+++ b/stdlib/source/lux/tool/compiler/phase/analysis/scope.lux
@@ -5,8 +5,7 @@
[control
["ex" exception (#+ exception:)]]
[data
- ["." text ("#;." equivalence)
- format]
+ ["." text ("#;." equivalence)]
["." maybe ("#;." monad)]
["." product]
["e" error]
diff --git a/stdlib/source/lux/tool/compiler/phase/analysis/structure.lux b/stdlib/source/lux/tool/compiler/phase/analysis/structure.lux
index aebbe75ba..a630a8fab 100644
--- a/stdlib/source/lux/tool/compiler/phase/analysis/structure.lux
+++ b/stdlib/source/lux/tool/compiler/phase/analysis/structure.lux
@@ -13,7 +13,7 @@
[number
["." nat]]
[text
- format]
+ ["%" format (#+ format)]]
[collection
["." list ("#@." functor)]
["." dictionary (#+ Dictionary)]]]
@@ -31,58 +31,58 @@
["/" analysis (#+ Tag Analysis Operation Phase)]]]])
(exception: #export (invalid-variant-type {type Type} {tag Tag} {code Code})
- (ex.report ["Type" (%type type)]
- ["Tag" (%n tag)]
- ["Expression" (%code code)]))
+ (ex.report ["Type" (%.type type)]
+ ["Tag" (%.nat tag)]
+ ["Expression" (%.code code)]))
(template [<name>]
[(exception: #export (<name> {type Type} {members (List Code)})
- (ex.report ["Type" (%type type)]
- ["Expression" (%code (` [(~+ members)]))]))]
+ (ex.report ["Type" (%.type type)]
+ ["Expression" (%.code (` [(~+ members)]))]))]
[invalid-tuple-type]
[cannot-analyse-tuple]
)
(exception: #export (not-a-quantified-type {type Type})
- (%type type))
+ (%.type type))
(template [<name>]
[(exception: #export (<name> {type Type} {tag Tag} {code Code})
- (ex.report ["Type" (%type type)]
- ["Tag" (%n tag)]
- ["Expression" (%code code)]))]
+ (ex.report ["Type" (%.type type)]
+ ["Tag" (%.nat tag)]
+ ["Expression" (%.code code)]))]
[cannot-analyse-variant]
[cannot-infer-numeric-tag]
)
(exception: #export (record-keys-must-be-tags {key Code} {record (List [Code Code])})
- (ex.report ["Key" (%code key)]
- ["Record" (%code (code.record record))]))
+ (ex.report ["Key" (%.code key)]
+ ["Record" (%.code (code.record record))]))
(template [<name>]
[(exception: #export (<name> {key Name} {record (List [Name Code])})
- (ex.report ["Tag" (%code (code.tag key))]
- ["Record" (%code (code.record (list@map (function (_ [keyI valC])
- [(code.tag keyI) valC])
- record)))]))]
+ (ex.report ["Tag" (%.code (code.tag key))]
+ ["Record" (%.code (code.record (list@map (function (_ [keyI valC])
+ [(code.tag keyI) valC])
+ record)))]))]
[cannot-repeat-tag]
)
(exception: #export (tag-does-not-belong-to-record {key Name} {type Type})
- (ex.report ["Tag" (%code (code.tag key))]
- ["Type" (%type type)]))
+ (ex.report ["Tag" (%.code (code.tag key))]
+ ["Type" (%.type type)]))
(exception: #export (record-size-mismatch {expected Nat} {actual Nat} {type Type} {record (List [Name Code])})
- (ex.report ["Expected" (|> expected .int %i)]
- ["Actual" (|> actual .int %i)]
- ["Type" (%type type)]
- ["Expression" (%code (|> record
- (list@map (function (_ [keyI valueC])
- [(code.tag keyI) valueC]))
- code.record))]))
+ (ex.report ["Expected" (%.nat expected)]
+ ["Actual" (%.nat actual)]
+ ["Type" (%.type type)]
+ ["Expression" (%.code (|> record
+ (list@map (function (_ [keyI valueC])
+ [(code.tag keyI) valueC]))
+ code.record))]))
(def: #export (sum analyse tag valueC)
(-> Phase Nat Code (Operation Analysis))