Commit Graph

292 Commits

Author SHA1 Message Date
Brian Huffman
fbb711b36d Add regression test for #913. 2020-09-29 10:54:12 -07:00
Iavor Diatchki
5d0493689f Updates to the lexer
Fixes #713
Fixes #818
Fixes #876
2020-09-25 14:16:37 -07:00
Iavor Diatchki
273d8a3d91 Fixes to defaulting, and add a check for mutually exclusive constraints
Fixes #910
2020-09-24 14:11:27 -07:00
Iavor Diatchki
44c4e47506 Add some tests 2020-09-23 16:40:35 -07:00
Iavor Diatchki
082c804516 Track where types come from 2020-09-23 16:28:24 -07:00
Brian Huffman
2af6893724 Update expected test outputs with unfolded private type synonyms.
This behavior was intentionally changed by the fix for #485.
2020-09-23 10:32:20 -07:00
Brian Huffman
13515f3f7e Add regression test for issue #485. 2020-09-23 10:32:20 -07:00
Brian Huffman
53a5a3044b Remove multi-line block comment from regression test.
Apparently multi-line REPL input is not supported on all platforms
(Windows in particular).
2020-09-23 09:10:34 -07:00
Brian Huffman
aa256f6551 Add test for #838. 2020-09-23 09:10:34 -07:00
Brian Huffman
7f5514257c Add regression test for #894. 2020-09-23 07:26:39 -07:00
Rob Dockins
25818493ff Add a quick-test mode to the cry shell script.
This excludes the new SuiteB tests, and moves the `allexamples`
test into a separate directory that is also excluded.  The
standard `test` command still runs all tests.
2020-09-21 14:54:29 -07:00
Rob Dockins
e79786edb0 Remove seq and change foldl' to always perform normal-form evaluation.
The extra flexability aforded by WHNF evaluation is mostly just confusing,
I think.
2020-09-14 12:41:38 -07:00
Rob Dockins
6feeafa74f Add seq and deepseq primitives, and rewrite some prelude
functions to use stricter variants.  Add an `Eq` constraint
to `parmap` to mirror the restriction on `deepseq`.
2020-09-14 10:42:59 -07:00
Rob Dockins
2029605a3c Implement primitive foldl and foldl' operations.
Reimplement `foldr` and add `foldr'` in terms of
the left folds.
2020-09-14 10:42:59 -07:00
Iavor Diatchki
e75aaef5a0 Allow code blocks to start without a newline when using fences 2020-08-25 13:02:58 -07:00
Rob Dockins
82187952e7 Generalize the type of generate.
This allows the indexing type to be arbitraty `Integral` types,
provided the type is large enough to index the sequence.

Fixes #848
2020-08-22 15:28:13 -07:00
Rob Dockins
af94423b48 Remove the atXis0 test. I couldn't think of a way to make it
determinsitic enough for a regression test.
2020-08-11 11:06:59 -07:00
Rob Dockins
06aca879f0 Test case for issue 861 2020-08-11 09:28:13 -07:00
brianhuffman
f31ad90726
Merge pull request #855 from GaloisInc/issue851
Issue851
2020-07-30 11:29:16 -07:00
Brian Huffman
331725e135 Add regression test for #851. 2020-07-30 10:53:37 -07:00
Rob Dockins
84d26a0484 Add cases for VRational and VFloat to etaDelay.
These were previously missed because the final wildcard case
kept GHC from issuing a warning.  This removes the wildcard case
and issues more explict panics regarding type mismatches in the
various cases.

Fixes #850
2020-07-30 10:03:24 -07:00
Iavor Diatchki
027a35887f Add some more constraints to the FLiteral instances.
Fixes #845
2020-07-28 17:36:46 -07:00
Brian Huffman
fe465e108f Update expected output for regression test issue835.icry. 2020-07-28 16:03:20 -07:00
Brian Huffman
e48e9f8302 Add regression test for issue #835. 2020-07-28 13:50:16 -07:00
Iavor Diatchki
df7d9ba906 Add a test case for #805.
Fixes #805
2020-07-20 17:27:16 -07:00
Iavor Diatchki
a25924df10 Add defaulting for FLiteral and update CHANGES
Fixes #820
2020-07-15 11:55:29 -07:00
Rob Dockins
a4b137da4a Fix fragile tests 2020-07-09 10:54:03 -07:00
Iavor Diatchki
372d2bf3aa Make :m work the same way as :l
More precisely, in both cases we unload all modules and then reload
everything (this is what `:l` used to do, while `:m` only reloaded
the current module).  This fixes #668.

There are opportunities to be smarter here: in particular when we
reload modules, we do need to parse them so that we can find out what
their dependencies are, and if needed to reload those.  However, if
none of the dependencies have changed, and we didn't change, then we
could reuse the current module.  This could be quite useful for modules
that take a long time to load.
2020-07-07 15:34:03 -07:00
Rob Dockins
84e1a06536 Tenatively apply defaulting to definitions when typechecking the
rest of a module.  This helps prevent a single ambiguous size
variable from causing additional errors in other definition.
2020-07-02 15:04:07 -07:00
Rob Dockins
e9c22ad0cf Still compute width defaulting information as before, but
use that information to emit error messages rather than warnings.

This provides more specific messages than simply allowing the
affected type variables to remain uninstantiated and failing later.
It also causes some examples that otherwise would have ambiguous
types to fail earlier.  This converts some test instances where
REPL defaulting would eventually succeed into examples that fail
outright instead.  I largely think these instances are improvements.
2020-07-02 15:04:07 -07:00
Rob Dockins
7cd5e7bcef Change the default so that defaulting warnings are suppressed.
Now that we only default to unlimited-precision types, this warning
is considerably less useful.
2020-07-02 14:56:27 -07:00
Rob Dockins
620e62c8e3 Remove all defaulting, except for literals.
Fix up the test suite.  This mostly delays defaulting
warnings into "showing specific instance of polymorpic
type warnings", but requires actual fixes in a small number
of places.  Those places were higly questionable, in my opinion.
2020-07-02 14:56:27 -07:00
Rob Dockins
709dc939ed Change the defaulting rules for Literal constraints.
Instead of defaulting to `[n]` for some `n`, prefer instead
to default to `Integer` or `Rational` depending on the
other required constraints.
2020-07-02 14:56:27 -07:00
Iavor Diatchki
f6213aff33 Improve error messages when we know a constraint will always fail.
This changes the way the special "Error" type is used. The error
message now contains only an explanation of what happened,
and the actual malformed type is the parameter of the error function,
which is always used at kind `k -> k` where `k` is the malformed kind.

This fixes (or at least improves) #768
2020-06-30 20:03:50 -07:00
Rob Dockins
6c6cb94d46 Implement and use a new RecordMap type.
This type stores records as a finite map from field names to
values, while also remembering the original order of the fields
from when the record was generated (usually, from the program source).
For all "semantic" purposes, the fields are treated as appearing in
a canoical order (in sorted order of the field names).  However, for
user display purposes, records are presented in the order in which
the fields were originally stated.

In the course of implementing this, I discovered that we were not
previously checking for repeated fields in the parser or typechecker,
which would result in some rather strange situations and could probably
be used to break the type safety. This is now fixed and repeated fields
will result in either a parse error or a panic (for records generated
internally).

Fixes #706
2020-06-30 12:34:50 -07:00
robdockins
87d5edab00
Documentation updates (#779)
* Add docstrings for all prelude functions and fix minor style issues.

Fixes #771

* Update `CryptolPrims` documentation

* Minor updates to the prelude

* Update CHANGES

* Updates to the cryptol book and CryptolPrims

* Fix several additional docstrings

* Specify and document properties of signed bitvector division.

Fixes #677

* Fixup test

* typos and style

* Regenerate PDFs
2020-06-30 10:58:25 -07:00
Iavor Diatchki
0047eaf77a Initial support for floating point computation 2020-06-29 15:31:34 -07:00
Rob Dockins
d2490e724f Implement roundToEven and roundAway.
The old `round` operation is renamed into `roundAway` to make its
semantics more obvious.
2020-06-25 13:52:36 -07:00
Rob Dockins
6a05e86658 unit test for issue 712 2020-06-23 12:42:03 -07:00
Rob Dockins
332a0a3fdc Add an assert combinator to the prelude.
Fix up fragile test outputs.
2020-06-19 12:11:29 -07:00
Rob Dockins
6bedcbb4b3 Add a new Eq typeclass for types that have equality tests.
The `(==)` and `(!=)` operators move into the new `Eq` typeclass,
which becomes a superclass of `Cmp` and `SignedCmp`.
2020-06-19 12:00:12 -07:00
Rob Dockins
22e2e483d4 The new superclass inference sometimes casues minor changes in
error output in the test suite.
2020-06-19 11:55:58 -07:00
Rob Dockins
066cbd492e Post-merge test suite fixups 2020-05-26 17:45:42 -07:00
Rob Dockins
bbba626052 Merge remote-tracking branch 'origin/master' into split-arith 2020-05-26 17:37:00 -07:00
Rob Dockins
c1b641c420 Add a test case for issue725 2020-05-26 17:08:20 -07:00
Rob Dockins
aaf78e23ec Add a bit more output for the Satisfiable/Counterexample cases 2020-05-26 17:08:20 -07:00
Rob Dockins
e817f5c777 Update test suite 2020-05-26 15:33:46 -07:00
Rob Dockins
85e49a92db Rearrange the Cryptol prelude according to the new typeclass system 2020-05-22 15:39:38 -07:00
Brian Huffman
37f1fd8b4b Add regression test for #731. 2020-05-18 17:17:58 -07:00
Rob Dockins
f6e0342afa Partially update the test suite 2020-05-15 09:33:32 -07:00