Commit Graph

705 Commits

Author SHA1 Message Date
Ryan
dd112501ca Remove unnecessary line from issue1675 test. 2024-07-10 15:02:15 -06:00
Ryan
84194fc187 Issue#1675, add failing test for ec_mult as y should be 0 rather than 13. 2024-07-10 10:13:11 -06:00
Ryan Scott
97e972b025
Merge pull request #1695 from GaloisInc/issue1593-issue1693
Abort early after type-checking malformed constraint guards
2024-07-03 12:41:23 -04:00
Iavor Diatchki
d0a98a545b Make fixes for 1691 work with more nested modules. 2024-07-03 08:57:52 -07:00
Ryan Scott
6e417aa3d1 Abort early after type-checking malformed constraint guards
Checking ill-typed constraint guards for exhaustivity can cause Cryptol to
panic. If we detect any type errors after type-checking the guards, we now
abort early and report any recorded errors instead of proceeding to check
exhaustivity.

Fixes #1593. Fixes #1693.
2024-07-02 07:16:05 -04:00
Iavor Diatchki
128411e605 Merge branch 'master' into issue_1691
# Conflicts:
#	CHANGES.md
2024-07-01 09:57:15 -07:00
Iavor Diatchki
efa9dd1742 Fix test for Windows. 2024-07-01 09:55:04 -07:00
Ryan Scott
fbbbb8f56f
Check for syntactically invalid constraint guards in the parser (#1686)
Numeric constraint guards have very particular syntactic requirements:

* They must always be used in top-level definitions.
* Their definitions must always be accompanied by a top-level type signature.

Previously, we checked these requirements in a combination of places in the
parser and the typechecker. The checks in the typechecker weren't very
thorough, however, and they failed to catch local definitions without type
signatures that use constraint guards, as seen in #1685.

This patch moves all of these syntactic checks to the parser (in
`Cryptol.Parser.ExpandPropGuards`). We now recurse into expressions to check
for local definition that use constraint guards and error if we encounter one.
This ensures that by the time we reach the typechecker, all constraint guard
expressions are at least syntactically valid.

Fixes #1685.
2024-07-01 07:13:36 -04:00
Iavor Diatchki
84648390b7 Add a test 2024-06-28 04:39:19 -07:00
Iavor Diatchki
e98f4d6e28 Only add implicit imports for non-anonymous modules 2024-06-28 04:39:05 -07:00
Eric Mertens
823ed91fc7 Update docs.cry test to show preserved doctests 2024-06-03 10:09:40 -07:00
Iavor Diatchki
d6eed17be5 More test fixes 2024-06-02 07:13:27 -07:00
Iavor Diatchki
c77db36a25 Update mingw test 2024-06-02 04:20:31 -07:00
Iavor Diatchki
a9f962a5e7 Fix darwin test 2024-06-02 04:16:37 -07:00
Iavor Diatchki
d599934038 Fix tests 2024-06-01 03:04:15 -07:00
Ryan Scott
f380e1084d Fix roundAway implementation in reference evaluator
This synchronizes the implementation of `roundAway` in the reference evaluator
with the implementation of `Cryptol.Backend.FloatHelpers.floatToInteger`, which
expects `NearAway` rather than `Away`.

Fixes #1663.
2024-05-31 10:16:45 -04:00
Ryan
fe5e9bdb1e Revert "Only grab public IfaceDecls from other modules."
This reverts commit 19ebc256f8.
2024-04-01 08:58:30 -06:00
Ryan
ed7776de2e Add failing test for issue-#1649 2024-04-01 08:58:22 -06:00
Ryan Scott
1e1c14c28a Implement coreLint for numeric constraint guards
This ensures that the constraints and right-hand side expressions in each guard
are well formed. This check suffices to catch the bug in
https://github.com/GaloisInc/saw-script/issues/2043, which was fixed separately
in a previous commit.

I have also updated the `tests/constraint-guards/type-sig-constraint.icry` test
to use `coreLint=on` rather than checking `debug` output, as the former is more
resilient to internal changes in Cryptol's pretty-printer.

Fixes #1647.
2024-03-25 13:13:00 -04:00
Ryan Scott
092a7f088b Fix typechecking of constraint guards with type signature constraints
Previously, `checkPropGuardCase` would not consider type signature constraints
when determining how many proof applications to generate, which ultimately led
to the issues observed in https://github.com/GaloisInc/saw-script/issues/2043.
This is relatively easy to fix by ensuring that we pass these constraints as an
additional argument to `checkPropGuardCase`.

It is difficult to fully validate that this fix works without SAW, but I have
checked in a smoke test that checks if the guards in a numeric constraint guard
definition have the expected number of proof applications.
2024-03-25 12:26:34 -04:00
Ryan
19ebc256f8 Only grab public IfaceDecls from other modules. 2024-03-19 14:35:37 -06:00
Ryan Scott
ca0eb7e064 Fix handling of abstract types
We must treat built-in abstract types slightly differently from user-defined
abstract types.

Also fix a bug in the way that the return kind of primitive types are computed:
we previously said that they all return `*`, but this is not necessarily the
case.
2024-02-02 16:02:31 -05:00
Ryan Scott
a9e35fe004 Update .stdout.mingw32 and .stdout.darwin files 2024-02-01 20:39:51 -05:00
Ryan Scott
f825abd2e1 Update expected stdout for test cases 2024-02-01 19:35:16 -05:00
Iavor Diatchki
3e7d786a15 Implement sanity checking for case
Fixes #1615
2024-01-31 12:01:52 -08:00
Iavor Diatchki
e5251eef98 Add nominal type constructors in scope.
Fixes #1617
2024-01-31 11:21:39 -08:00
Iavor Diatchki
684a85ed18 Tweak error messages 2024-01-31 10:36:13 -08:00
Iavor Diatchki
e47ebcbc8a Improvements to ":help" for nominal types/constructors
Fixes #1605
2024-01-31 10:03:02 -08:00
Ryan Scott
0c88cc328d Add regression test for #1606 2024-01-28 17:18:36 -05:00
Ryan Scott
d965cb44ae Emit an error for non-exhaustive case expressions
Fixes #1608.
2024-01-28 17:15:55 -05:00
Ryan Scott
ca85fac6b3 Error when default case overlaps with subsequent cases 2024-01-26 10:51:55 -05:00
Ryan Scott
82526569eb Generalize CheckEnum test case to include :prove commands 2024-01-25 15:06:35 -05:00
Ryan Scott
77a840621b Fix precedence when pretty-printing counterexamples 2024-01-23 17:22:05 -05:00
Ryan Scott
c00c9e5775 Implement toExpr for enums 2024-01-23 17:06:09 -05:00
Ryan Scott
f0706f9ed9 Test case for :check'ing enum values 2024-01-23 15:10:28 -05:00
Ryan Scott
e6291cee56 Update issue1040 golden output 2024-01-23 13:03:24 -05:00
Iavor Diatchki
5236aff002 Fix test 2024-01-22 16:37:19 -08:00
Iavor Diatchki
40a37c8cde Handle missing cases for nested patterns, with test 2024-01-22 15:33:13 -08:00
Iavor Diatchki
cb6228efa3 Add some tests 2024-01-22 14:39:50 -08:00
Bretton
9081a09923 Add test for #1590 2023-12-04 21:10:40 -06:00
Iavor Diatchki
d8223c129c Add a test 2023-10-30 09:51:52 -07:00
Ryan Scott
ed40d6f974
Respect VWord/VSeq invariants in parmap implementation (#1579)
Previously, `parmap` could incorrectly return a `VWord` when the element type
was not `Bit`, and it could also return a `VSeq` when the element type was
`Bit`. This changes the implementation of `parmap` to use the `mkSeq` smart
constructor, which properly chooses what sort of `GenValue` to return depending
on the element type.

Fixes #1578.
2023-10-10 07:44:17 -04:00
Bretton
fa8731c2d5 Fix ffi-fallback-rec test windows output 2023-08-24 15:29:07 -07:00
Bretton
beac2abf55 Add ffi-fallback-rec test 2023-08-24 14:32:39 -07:00
Bretton
f55d51972d Add ffi-fallback tests 2023-08-22 13:41:39 -07:00
Bretton
57aee9e7f9 Update ffi-runtime-errors test output 2023-08-21 19:44:40 -07:00
Bretton
fbfad1fd0c Add test for #1562 2023-08-10 15:39:24 -07:00
Bretton
edff7d3088 Fix test output for issues/issue1455_3 on windows 2023-08-08 18:34:13 -07:00
Bretton
fbb2e37bdd Add tests for #1561 2023-08-08 17:45:12 -07:00
Bretton
bff4add099 Fix tests/issues/issue1455/Inst1.cry 2023-08-08 17:42:35 -07:00