Commit Graph

49 Commits

Author SHA1 Message Date
Iavor Diatchki
3eae908e9a Fix special cases for windows 2022-07-26 16:15:16 +03:00
Iavor Diatchki
5c1b0bc17e Fix tests 2022-07-25 20:57:17 +03:00
Iavor Diatchki
694282e517 Add more tests for passing on parameters 2022-07-18 11:40:12 +03:00
Iavor Diatchki
a2bc669b66 First stab at passing through functor parameters 2022-07-15 17:59:10 +03:00
Iavor Diatchki
18e1b92fdc Implement insantiating imports with { } 2022-07-14 16:07:00 +03:00
Iavor Diatchki
141910894f Implement functor imports with instantiation.
Fixes #1363
2022-07-14 13:03:06 +03:00
Matthew Yacavone
2a8f7557e8 fix remaining tests 2022-07-13 18:59:08 -07:00
Matthew Yacavone
70d96006a5 fix error for parameterized module instantiations, add tests like T5 2022-06-21 15:22:41 -07:00
Matthew Yacavone
a643a192e8 only use top-level imports in implicit interface, get more tests working 2022-06-15 15:21:44 -07:00
Iavor Diatchki
1e3ad37127 Don't crash on undefined names.
When we resolve an undfined name we record error, but we continue
processing things, so that we can report multiple errors.  As a result
we need to generate some sort of fake "real" name for the undefined entity.

Previously we used to generate a fake local name, but that confused parts
of the code that expected certain things to always be defined at the top
level.  So now we generate a fake name in the Cryptol prelude instead.
2022-06-14 09:27:11 -07:00
Iavor Diatchki
6ab14706af New module system 2022-06-13 15:56:15 -07:00
Iavor Diatchki
7afd9e1c55 Call removeIncludes very early---it is not part of parsing.
We have to do that, so that we can see included imports, and thus load
the correct dependencies for a module.

This fixes #1330
2022-03-02 10:42:42 -08:00
Iavor Diatchki
a53b24b8a0 Fix paths in nested relative includes
Fixes #1321
2022-02-07 16:45:50 -08:00
Iavor Diatchki
2d1f2c1033 Fix windows tests, take 2 2022-02-07 14:56:20 -08:00
Iavor Diatchki
800f1e0cfe Fix tests on windows (hopefully) 2022-02-07 11:15:49 -08:00
Iavor Diatchki
5a55e31585 Fix tests 2022-02-07 10:21:10 -08:00
Aaron Tomb
e19f5083e0 Fix expected output for modsys/T16 on Windows 2021-09-17 16:23:46 -07:00
Brian Huffman
869deb1354 Update expected test output.
Some error messages changed due to the new definition in Cryptol.cry.
2021-09-10 20:08:43 -07:00
Rob Dockins
097b8a22d2 Update test suite expected output to track changes
in the pretty printer code.
2021-08-06 14:18:12 -07:00
Rob Dockins
a3534f99b7 Update tests again 2021-06-30 16:34:17 -07:00
Rob Dockins
3ea59c7a69 Fix windows test output 2021-06-30 16:01:08 -07:00
Rob Dockins
5a8a00fc81 Minor test suite updates 2021-06-30 10:19:39 -07:00
Iavor Diatchki
54780379cf Rename files to have correct OS extension 2021-04-22 16:39:37 -07:00
Iavor Diatchki
c16583230a Print test-runner version, and always build it. 2021-04-22 14:04:15 -07:00
Iavor Diatchki
0c65f5e82b Change CI to use test-lib-0.3 and add a windows test for modsys/T18 2021-04-21 15:33:29 -07:00
Iavor Diatchki
aa7cce1668 Require version 0.3 of test-runner and a windows specific result for the test 2021-04-21 14:38:37 -07:00
Iavor Diatchki
1c175f5c85 Fix test (accounts for chanes in the standard library) 2021-04-20 14:53:21 -07:00
Iavor Diatchki
6818969db6 Fixes #1169 2021-04-20 14:47:32 -07:00
Iavor Diatchki
277a65781c Changes to make new command line scope and browsing work with the current
parameterzied modules.

Some of this is a bit of a hack, but that code would change with the new
parameterized modules, so the hack is temporary.
2021-04-05 17:09:29 -07:00
Iavor Diatchki
f85b0e4994 Add implicit imports for locally defined modules
This also fixes the extra space in the "invlid dependency" error
2021-04-01 15:21:29 -07:00
Iavor Diatchki
8b4778b8c2 Add implicit imports of locally defined modules 2021-04-01 11:50:16 -07:00
Iavor Diatchki
cb21ab61ba Show the locations of the definitions when reporting invalid dependencies
We only show the file location as these will always be in the same file,
I think.
2021-04-01 11:17:08 -07:00
Iavor Diatchki
65cd467741 Fix dependency tracking with nested modules.
See the example on the PR thread, which is captured in test T11
2021-04-01 10:45:14 -07:00
Iavor Diatchki
1ea868228c Bug-fixes from code-review on 12 March 2021 2021-03-12 16:57:39 -08:00
Iavor Diatchki
fe17d24e69 Add a test 2021-03-12 11:50:43 -08:00
Iavor Diatchki
34b1d87df3 Implementation of nested modules.
* Limitations:
    Does not work in combination parameterized modules, as I am
    about to redo how that works.

  * General refeactorings:
    * Namespaces:
      - We have an explicit type for namespaces, see `Cryptol.Util.Ident`
      - Display environments should now be aware of the namespace of the
        name being displayed.

    * Renamer:
      - Factor out the renamer monad and error type into separate modules
      - All name resultion is done through a single function `resolveName`
      - The renamer now computes the dependencies between declarations,
         orders things in dependency order, and checks for bad recursion.

    * Typechecker: Redo checking of declarations (both top-level and local).
      Previously we used a sort of CPS to add things in scope.   Now we use
      a state monad and add things to the state.  We assume that the renamer
      has been run, which means that declarations are ordered in dependency
      order, and things have unique name, so we don't need to worry about
      scoping too much.

  * Change specific to nested modules:
    - We have a new namespace for module names
    - The interface file of a module contains the interfaces for nested modules
    - Most of the changes related to nested modules in the renamer are
      in `ModuleSystem.NamingEnv` and `ModuleSystem.Rename`
        - There is some trickiness when resolving module names when importing
          submodules (seed `processOpen` and `openLoop`)
    - There are some changes to the representation of modules in the typechecked
      syntax, in particular:
        - During type-checking we "flatten" nested module declarations into
          a single big declaration.  Hopefully, this means that passes after
          the type checker don't need to worry about nested modules
        - There is a new field containing the interfaces of the nested modules,
          this is needed so that when we import the module we know we have the
          nested structure
        - Declarations in functor/parameterzied modules do not appear in the
          flattened list of declarations.  Instead thouse modules are collected
          in a separate field, and the plan is that they would be used from
          there when we implmenet functor instantiation.
2021-03-12 09:55:56 -08: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
David Thrane Christiansen
02dfc4a898 Enforce that includes are UTF8
Previously, "include" used locale-dependent decoding of source files,
while the rest of Cryptol uses UTF8. This change makes "include"
consistent with the rest of Cryptol, and adds a test that checks for
malformed UTF8.
2020-06-09 09:02:22 -07:00
Iavor Diatchki
fcc7a19998 More information when browsing.
This implements the feature request in #689
2020-03-24 16:53:48 -07:00
Iavor Diatchki
d38eab4b2c Fix test. 2019-01-25 10:20:40 -08:00
Iavor Diatchki
b7b1baa25b Fix test, to account for changes to eval context checking 2018-08-15 20:26:25 +03:00
Iavor Diatchki
2272a59314 Rename type synonyms properly. 2017-12-01 10:29:42 -08:00
Iavor Diatchki
3443331f06 Add a test 2017-12-01 09:51:43 -08:00
Iavor Diatchki
f658f0244d Add another test. 2017-11-28 14:26:12 -08:00
Iavor Diatchki
c5e0540a0f Fix test. 2017-10-30 14:24:47 -07:00
Iavor Diatchki
3f4cc570cf Use a record for all module parameters at the value level. Also improve PP 2017-10-25 16:39:29 -07:00
Iavor Diatchki
9ecc8f720d Add some tests. 2017-10-24 14:04:41 -07:00
Iavor Diatchki
ca6b34f621 Refactor module system things; better loading of `A modules. 2017-10-23 15:12:12 -07:00
Iavor Diatchki
b8780ab68f Add some tests. 2017-10-18 14:33:41 -07:00