Skip to content

Commit 33491c1

Browse files
committed
Improving test coverage [part 7]
1 parent 2e10b7d commit 33491c1

30 files changed

+705
-554
lines changed

stdlib/source/library/lux.lux

+36-96
Original file line numberDiff line numberDiff line change
@@ -1959,32 +1959,32 @@
19591959
..no_provenance
19601960
(code#text value))))
19611961

1962-
(the' .public UnQuote
1962+
(the' .private UnQuote
19631963
Type
19641964
{#Named [..prelude "UnQuote"]
19651965
{#Nominal ".Macro/UnQuote" (.list#)}})
19661966

1967-
(the' .public (unquote it)
1967+
(the' .private (unquote it)
19681968
(-> Macro
19691969
UnQuote)
19701970
(.as# (-> Macro UnQuote) it))
19711971

1972-
(the' .public (unquote_macro it)
1972+
(the' .private (unquote_macro it)
19731973
(-> UnQuote
19741974
Macro')
19751975
(.as# (-> UnQuote Macro') it))
19761976

1977-
(the' .public Spliced_UnQuote
1977+
(the' .private Spliced_UnQuote
19781978
Type
19791979
{#Named [..prelude "Spliced_UnQuote"]
19801980
{#Nominal ".Macro/Spliced_UnQuote" (.list#)}})
19811981

1982-
(the' .public (spliced_unquote it)
1982+
(the' .private (spliced_unquote it)
19831983
(-> Macro
19841984
Spliced_UnQuote)
19851985
(.as# (-> Macro Spliced_UnQuote) it))
19861986

1987-
(the' .public (spliced_unquote_macro it)
1987+
(the' .private (spliced_unquote_macro it)
19881988
(-> Spliced_UnQuote
19891989
Macro')
19901990
(.as# (-> Spliced_UnQuote Macro') it))
@@ -2998,8 +2998,7 @@
29982998

29992999
[[?#variant #Variant]
30003000
[?#tuple #Tuple]
3001-
[?#form #Form]]
3002-
)
3001+
[?#form #Form]])
30033002

30043003
(the' .private (?#binding tape)
30053004
($ Projection (And Text Code))
@@ -3065,8 +3064,7 @@
30653064
[[?#bit Bit #Bit]
30663065
[?#natural Natural #Natural]
30673066
[?#text Text #Text]
3068-
[?#name Name #Name]]
3069-
)
3067+
[?#name Name #Name]])
30703068

30713069
(the' .private (?#this_name reference tape)
30723070
(-> Name
@@ -3365,10 +3363,6 @@
33653363
(monad#each meta#monad normal_type parameters))])
33663364
(meta#return lux (type_reification abstraction parameters))))
33673365

3368-
(the' .public type_must_have_singular_expansion
3369-
Error
3370-
"The expansion of the type-syntax has to yield a single element.")
3371-
33723366
(the' .private (expanded_type_reification normal_type @ binding parameters)
33733367
(-> (-> Code ($ Meta Code)) Provenance Name ($ List Code)
33743368
($ Meta Code))
@@ -3383,7 +3377,7 @@
33833377
(meta#return lux (` (..type (, singular))))
33843378

33853379
else
3386-
(meta#failure ..type_must_have_singular_expansion)))
3380+
(meta#failure "The expansion of the type-syntax has to yield a single element.")))
33873381

33883382
{#None}
33893383
((normal_type_reification normal_type {#Name @ binding} parameters) lux))))
@@ -3597,8 +3591,7 @@
35973591
<side>))]
35983592

35993593
[[product#left left]
3600-
[product#right right]]
3601-
)
3594+
[product#right right]])
36023595

36033596
(the' .private (generated_name prefix state)
36043597
(-> Text
@@ -4067,8 +4060,7 @@
40674060
(` <nullary>))))))]
40684061

40694062
[[0b (if (, pre) 1b (, post)) or]
4070-
[1b (if (, pre) (, post) 0b) and]]
4071-
)
4063+
[1b (if (, pre) (, post) 0b) and]])
40724064

40734065
... https://en.wikipedia.org/wiki/Halting_problem
40744066
(the .public (halt! message)
@@ -4317,56 +4309,6 @@
43174309
{#None}
43184310
{#Left "Not expecting any type."}))))
43194311

4320-
(the \n
4321-
Text
4322-
(.int_char# +10))
4323-
4324-
(the (provenance#as it)
4325-
(-> Provenance
4326-
Text)
4327-
(let [... https://en.wikipedia.org/wiki/Delimiter
4328-
delimiter ","
4329-
[file line column] it]
4330-
(text "@"
4331-
(text#as file) delimiter
4332-
(natural#as line) delimiter
4333-
(natural#as column))))
4334-
4335-
(the (provenance#with provenance error)
4336-
(-> Provenance
4337-
(Change Text))
4338-
(text (provenance#as provenance) \n
4339-
error))
4340-
4341-
(the provenance#here
4342-
(macro (_ tokens compiler)
4343-
(when tokens
4344-
(list)
4345-
(let [[..#info _
4346-
..#source _
4347-
..#current_module _
4348-
..#modules _
4349-
..#scopes _
4350-
..#type_context _
4351-
..#seed _
4352-
..#expected _
4353-
..#provenance provenance
4354-
..#eval _] compiler
4355-
[.#module module .#line line .#column column] provenance]
4356-
{#Right [compiler
4357-
(list (` (.is .Provenance
4358-
[.#module (, {..#Text ..provenance#dummy module})
4359-
.#line (, {..#Natural ..provenance#dummy line})
4360-
.#column (, {..#Natural ..provenance#dummy column})])))]})
4361-
4362-
_
4363-
{#Left ..wrong_syntax})))
4364-
4365-
(the .public invalid_implementation_member
4366-
Error
4367-
(provenance#with (provenance#here)
4368-
"Invalid implementation member."))
4369-
43704312
(the .public implementation
43714313
(macro (_ tokens)
43724314
(with_monad meta#monad
@@ -4399,10 +4341,10 @@
43994341
(pure (list tag value))
44004342

44014343
_
4402-
(failure (text "Unknown implementation member: " slot_name)))
4344+
(failure (text "Unknown member of implementation: " slot_name)))
44034345

44044346
_
4405-
(failure ..invalid_implementation_member))))
4347+
(failure "Invalid member of implementation."))))
44064348
(list#conjoint tokens'))]
44074349
(pure (list (code#tuple (list#conjoint members)))))))
44084350

@@ -4459,11 +4401,6 @@
44594401
(?#and ?#simple_global_declaration
44604402
?#any))
44614403

4462-
(the .public improper_type_definition
4463-
Error
4464-
(provenance#with (provenance#here)
4465-
"Improper type definition syntax."))
4466-
44674404
(the (declaration_of_type it)
44684405
(-> Code
44694406
(Meta [Code (Maybe (Either (List Text) (List Text)))]))
@@ -4479,21 +4416,21 @@
44794416
(meta#pure [type {#Some {#Left tags}}])
44804417

44814418
{#None}
4482-
(failure ..improper_type_definition))
4419+
(failure ..wrong_syntax))
44834420

44844421
(list type {#Tuple _ slots})
44854422
(when (?#value slots (?#some ?#text))
44864423
{#Some slots}
44874424
(meta#pure [type {#Some {#Right slots}}])
44884425

44894426
{#None}
4490-
(failure ..improper_type_definition))
4427+
(failure ..wrong_syntax))
44914428

44924429
(list type)
44934430
(meta#pure [it {#None}])
44944431

44954432
_
4496-
(failure ..improper_type_definition)))
4433+
(failure ..wrong_syntax)))
44974434

44984435
else
44994436
(meta#pure [it {#None}])))
@@ -4771,6 +4708,10 @@
47714708
(.text_size# input))]
47724709
(.text_clip# after_offset after_length input))))))
47734710

4711+
(the \n
4712+
Text
4713+
(.int_char# +10))
4714+
47744715
(the (absolute_module_name nested? relative_root module)
47754716
(-> Bit Text Text
47764717
(Meta Text))
@@ -5390,15 +5331,7 @@
53905331
{#None}
53915332
(failure ..wrong_syntax))))
53925333

5393-
(the (imported_by? import_name module_name)
5394-
(-> Text Text
5395-
(Meta Bit))
5396-
(with_monad meta#monad
5397-
[module (module module_name)
5398-
.let [[..#module_hash _ ..#module_aliases _ ..#definitions _ ..#imports imports ..#module_state _] module]]
5399-
(pure (list#member? imports import_name))))
5400-
5401-
(the .public refer
5334+
(the refer
54025335
(macro (_ tokens)
54035336
(when (?#value tokens
54045337
(all ?#and
@@ -5662,8 +5595,7 @@
56625595
(|>> (<extension> 1)))]
56635596

56645597
[[++ .i64_+#]
5665-
[-- .i64_-#]]
5666-
)
5598+
[-- .i64_-#]])
56675599

56685600
(the (interleaved left right)
56695601
(for_any (_ it)
@@ -5829,6 +5761,17 @@
58295761
_
58305762
(failure ..wrong_syntax))))
58315763

5764+
(the (provenance#as it)
5765+
(-> Provenance
5766+
Text)
5767+
(let [... https://en.wikipedia.org/wiki/Delimiter
5768+
delimiter ","
5769+
[file line column] it]
5770+
(text "@"
5771+
(text#as file) delimiter
5772+
(natural#as line) delimiter
5773+
(natural#as column))))
5774+
58325775
(the .public undefined
58335776
(let [provenance (is (Meta Provenance)
58345777
(function (_ compiler)
@@ -5945,8 +5888,7 @@
59455888
[[i64 ..I64]
59465889
[natural ..Natural]
59475890
[integer ..Integer]
5948-
[revolution ..Revolution]]
5949-
)
5891+
[revolution ..Revolution]])
59505892

59515893
(the .public character
59525894
(macro (_ tokens compiler)
@@ -5993,8 +5935,7 @@
59935935
[c++ "C++"]
59945936
[common_lisp "Common Lisp"]
59955937
[php "PHP"]
5996-
[r "R"]]
5997-
)
5938+
[r "R"]])
59985939

59995940
(the .public for
60005941
(let [target (is (Meta Target)
@@ -6219,8 +6160,7 @@
62196160
[[Analysis]
62206161
[Synthesis]
62216162
[Translation]
6222-
[Declaration]]
6223-
)
6163+
[Declaration]])
62246164

62256165
(the .public alias
62266166
(macro (_ tokens)

stdlib/source/library/lux/abstract/functor.lux

+1-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@
6969

7070
(the .public (recursive body)
7171
(for_any (_ it)
72-
(-> (-> (Functor it)
73-
(Functor it))
72+
(-> (Change (Functor it))
7473
(Functor it)))
7574
(implementation
7675
(the (each value it)

stdlib/source/library/lux/abstract/projection.lux

+2-2
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@
245245

246246
(the .public (when condition next)
247247
(for_any (_ state it)
248-
(-> Bit (Projection state it)
249-
(Projection state it)))
248+
(-> Bit
249+
(Change (Projection state it))))
250250
(function (_ state)
251251
(if condition
252252
(next state)

stdlib/source/library/lux/data/format/json.lux

+1-2
Original file line numberDiff line numberDiff line change
@@ -607,8 +607,7 @@
607607

608608
(the .public (recursive context)
609609
(for_any (_ it)
610-
(-> (-> (Format JSON it)
611-
(Format JSON it))
610+
(-> (Change (Format JSON it))
612611
(Format JSON it)))
613612
(implementation
614613
(the (as it)

stdlib/source/library/lux/error.lux

+1
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,4 @@
3434
(the .public not_known)
3535
(the .public empty)
3636
(the .public no_instance)
37+
(the .public not_available)

stdlib/source/library/lux/macro/pattern.lux

+3-6
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33

44
(.using
55
[library
6-
[lux (.except UnQuote unquote unquote_macro
7-
Spliced_UnQuote spliced_unquote spliced_unquote_macro
8-
or let |>)
6+
[lux (.except or let |>)
97
[abstract
108
["[0]" monad]]
119
[control
@@ -22,7 +20,7 @@
2220
["[0]" vocabulary]
2321
["[0]" expansion]])
2422

25-
(the with_template (.in_module# .prelude .with_template))
23+
(the with_template (.in_module# .prelude with_template))
2624

2725
(with_template [<name>]
2826
[(the <name> (.in_module# .prelude <name>))]
@@ -59,8 +57,7 @@
5957
[?#any]
6058
[?#name]
6159
[?#local]
62-
[?#tuple]]
63-
)
60+
[?#tuple]])
6461

6562
(the .public or
6663
(pattern

stdlib/source/library/lux/math/number/64/rational.lux

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@
246246
(the arithmetic_of_module_2/2
247247
(template.macro (_ ,*variables)
248248
[(every .public Exponent
249-
Integer)
249+
fraction.Exponent)
250250

251251
... https://en.wikipedia.org/wiki/Exponentiation
252252
... https://en.wikipedia.org/wiki/Exponentiation_by_squaring

stdlib/source/library/lux/math/number/big/fraction.lux

+4-2
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,16 @@
1414
["[0]" list
1515
["?[1]" \\projection]]]]
1616
[math
17-
["[0]" random (.only Random) (.use "[1]#[0]" functor)]]]]
17+
["[0]" random (.only Random) (.use "[1]#[0]" functor)]]
18+
[aspect
19+
["[0]" case]]]]
1820
[//
1921
["//" natural]
2022
[//
2123
[/64
2224
["/" fraction]]]])
2325

24-
(/.module //.Number //.small
26+
(/.module //.Number (case.some //.small)
2527
//.= //.< //.greatest_common_divisor
2628
//.zero //.one
2729
//.+ //.- //.x //./ //.%

0 commit comments

Comments
 (0)