Commit Graph

307 Commits

Author SHA1 Message Date
Edwin Brady
751fd1f36a Experiment with hole name display
If unelaborating a term that's just a hole, show the scope it was
created in too, to help with error messages
2020-01-11 23:34:44 +00:00
Edwin Brady
4ce469cc03 Name choice of holes
The names should give more of a hint as to where the holes were created.
Might help with #161.
2020-01-11 22:52:18 +00:00
Edwin Brady
abd801c45a
Merge pull request #177 from SPY/testfix/chez010-macos
Fix chez010 test on MacOS
2020-01-11 22:50:16 +00:00
Edwin Brady
da293d1ce8 Check constructors are fully applied in case trees
This is necessary to build case trees correctly, and without this, we
can get mysterious and hard to debug run time errors!
2020-01-11 17:27:27 +00:00
Arnaud Bailly
432cc7ca5c Merge branch 'master' of https://github.com/edwinb/Idris2 into better-ide-mode 2020-01-11 09:45:39 +01:00
Ilya Rezvov
32b1c9b34f use an explicit extension for libcb references in %foreign pragmas 2020-01-09 11:55:33 -08:00
Ilya Rezvov
56d24e34d4 Merge remote-tracking branch 'origin/master' into testfix/chez010-macos 2020-01-09 11:44:51 -08:00
Ohad Kammar
971bfc5bbd Update prelude line numbers in a test 2020-01-09 13:06:39 +00:00
Edwin Brady
7cde0a7255
Merge pull request #174 from chrrasmussen/fix-double-subtraction
Fix subtraction of Double in interpreter
2020-01-09 11:41:40 +00:00
Edwin Brady
4b79b98db4
Merge pull request #173 from timmyjose/fix-mit-scheme-build-issues
Reorder Scheme compilers order to pick generic Scheme last.
2020-01-09 11:39:39 +00:00
Ilya Rezvov
b437323fd2 dylib extension added for libcb to fix chez010 test on MacOS 2020-01-01 14:23:02 -08:00
Edwin Brady
bf5b2298e0 Update test chez010
To use expressions to calculate FFI convention, so that it's tested.
2019-12-30 21:16:07 +00:00
Edwin Brady
df3f8b73f8 Further tweak to linearity rules
When we check a scope in RigW, need to mark all linear things outside
that scope as irrelevant within the scope (since the scope may be used
multiple times).
2019-12-29 15:21:08 +00:00
Christian Rasmussen
a70c68da91 Add test for Double subtraction 2019-12-22 21:50:18 +01:00
Timmy Jose
1c1e2b16ca Reorder Scheme compilers order to pick Chez Scheme first.
This fixes the issue where some Scheme compiler like mit-scheme is
installed and that gets picked up first, leading to an infinite
loop in the tests.

Also see attached image in the PR.
2019-12-21 18:42:09 +05:30
Arnaud Bailly
d5e63338ca Merge remote-tracking branch 'upstream/master' into better-ide-mode 2019-12-08 13:09:08 +01:00
Edwin Brady
663e1b8f69 Add uniqueSearch data type option
This changes the behaviour of 'auto' implicits so that by default they
return the first result, rather than checking for unique results. This
is consistent with Idris 1. However, we still want to check for
uniqueness somtimes (for example, with interface search, which should
reject overlapping results) so the 'uniqueSearch' option means that any
auto implicit search for the type should check uniqueness of results.

Fixes #169
2019-12-07 18:54:02 +00:00
Edwin Brady
79320c1574
Merge pull request #145 from lodi/nixprep
allow overriding racket/chicken paths through environment variables
2019-12-06 10:40:32 +00:00
Alex Gryzlov
1652a6be7d Merge remote-tracking branch 'upstream/master' into misc-fixes 2019-11-25 19:18:09 +03:00
Edwin Brady
17c83d6f4a
Merge pull request #137 from msmorgan/remove-trailing-whitespace
Remove trailing whitespace from Idris sources.
2019-11-18 20:44:46 +01:00
Alex Gryzlov
742f8e662a fix total006 test 2019-11-12 17:03:13 +03:00
Arnaud Bailly
cc6dc2839e
implement GetOptions and correctly reply nil when no holes 2019-11-11 09:28:11 +01:00
Arnaud Bailly
58e2ae2de8 make tests pass, tweaking repl's output 2019-10-31 07:14:46 +01:00
Arnaud Bailly
85e6e9ca7a handle more commands in IDE mode 2019-10-31 07:09:43 +01:00
lodi
76ff99d370 allow overriding racket/chicken paths through environment variables
This is to help Idris2 codegen the correct scripts on NixOS where
Racket and Chicken aren't installed in the standard locations, and
the /usr/bin/env trampoline is disabled at package build time.
This now matches the existing Chez behavior.

Also, fixed the test runner to restore the correct working directory
after a failed test, and fixed the top-level Makefile to allow the
IDRIS2_VERSION variable to be queried without building the project.
2019-10-28 22:44:16 -04:00
Edwin Brady
ab98b4d3c9 Print banner before typechecking
Otherwise it hides the errors
2019-10-26 13:39:50 +01:00
Michael Morgan
e6121e0935 Remove trailing whitespace from Idris sources.
This is the result of running the command:

$ find . -name '*.idr' -type f -exec sed -i -E 's/\s+$//' {} +

I confirmed before running it that this would not affect any markdown
formatting in documentation comments.
2019-10-25 14:24:25 -07:00
Edwin Brady
f09138d508 Fix broken test 2019-10-25 17:32:29 +01:00
Edwin Brady
da1964ce3d
Merge pull request #134 from ohad/bugfix-#109
Add multiple-parameter test as idris/basic029
2019-10-25 14:05:45 +01:00
Edwin Brady
c458957bd6 Get correct namespace in parameters blocks
Fixes #132. When getting the names in the block, we need to return the
fully explicit name, because we can't assume they'll all be in the same
namespace as we can have namespaces inside parameters blocks.
2019-10-25 14:03:15 +01:00
Ohad Kammar
90927cd886 Add multiple parameter block to test suite 2019-10-24 00:06:57 +03:00
Edwin Brady
a1116632ae
Merge pull request #123 from abailly/with-match-constants
allow matching constants in with clauses
2019-10-19 13:56:41 +01:00
Edwin Brady
e680306321
Merge pull request #105 from ska80/version+tag
Add an optional version tag when building in between releases
2019-10-19 13:46:21 +01:00
Edwin Brady
bb55ac5f1d Auto implicit search fix
Can't use a local which has 'erased' as its type, since that's just been
substituted in while working out how many arguments a local function
needs to have. Also need to ensure we've searched for default hints when
encountering IBindImplicits rather than after because otherwise it might
find the wrong instance.

Both these problems result it terms which don't type check getting past
the elaborator! So, also added a --debug-elab-check flag to check the
result of elaboration. It's not on by default because there are cases
where it really hurts performance, typically when inferring implicits
with lots of sharing. So we'll keep it as a debug flag, for now at
least.
2019-10-18 18:26:32 +01:00
Arnaud Bailly
eedbf23f38 allow matching constants in with clauses fix #122 2019-10-15 21:52:44 +02:00
Kamil Shakirov
b87fd0beb3 Add optional version tag when build in between releases
Also add REPL :version command to show the current version
2019-10-14 12:01:29 +06:00
Edwin Brady
d9ff8d65a6 Allow implementations to have implicits given
See e.g. Applicative instance in Data.Vect. This allows implementations
to use implicits at run time (by default, they'd be 0 multiplicity so
erased, but it might be useful to have an index available at run time).

At the moment, the parser requires implicits to be given before
constraints. Ideally it should be possible to give them in any order.
I'll come back to this.
2019-10-13 12:32:07 +01:00
Edwin Brady
85459814ef Support foreign callbacks in Racket back end 2019-09-29 19:37:30 +01:00
Edwin Brady
c6039e4fe5 Support callbacks in foreign calls to C
Currently Chez backend only
2019-09-29 17:25:26 +01:00
Edwin Brady
78e44a4353 Reading/writing buffers can fail
So, make them return and Either and wrap the scheme definitions in an
exception handler that returns an error code on failure
2019-09-28 18:33:46 +01:00
Edwin Brady
1a4f424259 Support UTF8 strings
When writing to ttc, need to take the length in bytes rather than the
length in characters. Also need to write to scheme in the appropriate
format for each scheme system.

While we're at it, Idris 1 supports unicode identifiers (although we
don't encourage it :)) so this allows any characeter >127 in an
identifier.
2019-09-28 14:08:23 +01:00
Kamil Shakirov
0722b96fef Add '--no-banner' option 2019-09-24 20:26:25 +06:00
Arnaud Bailly
2f8daa7cf2 Merge branch 'master' of https://github.com/edwinb/Idris2 into add-version-command 2019-09-22 22:39:36 +02:00
Edwin Brady
728ef085a5 Write out less metadata
For the types of local names, don't write out the environment - it's
going to be repeated for every name, mostly it's unhelpful, and if you
want to see the types of other names you can ask directly. This can save
a huge amount of time when environments are slightly complicated.
2019-09-22 18:01:29 +01:00
Arnaud Bailly
9c1f8b6f02
Merge branch 'master' into add-version-command 2019-09-22 15:50:13 +02:00
Edwin Brady
7825d216c0 Push constraint name into default method impls
If a default method implementation refers to another method in the
interface, it's going to be one from the interface being defined, so
push it through explicitly.
This is only going to be guaranteed to be the case for default method
implementations - we can't assume anything for other implementations.
Fixes #77
2019-09-20 19:01:07 +01:00
Edwin Brady
9b639eee35 Nat optimisation needs to look under lambda
Names are saturated, so there might be a lambda in the term we're
optimising. Fixes #62
2019-09-18 10:00:30 +01:00
Arnaud Bailly
295058130e
Merge branch 'master' into add-version-command 2019-09-13 17:33:14 +02:00
Edwin Brady
253a34dee6 Merge branch 'master' of github.com:edwinb/Idris2 2019-09-13 13:19:35 +01:00
Edwin Brady
4159d43432
Merge pull request #75 from abailly/configurable-ide-mode-socket
Configurable ide-mode-socket REPL
2019-09-13 13:13:02 +01:00
Edwin Brady
421b15aa24 Detect cycles in imports 2019-09-07 14:54:29 +01:00
Edwin Brady
65db4fbf96 Put built ttcs in build/ttc, rather than build
This is so that we can put other build artefacts (e.g. executables) in
properly organised subdirectories of build, e.g. build/bin/chez,
build/bin/js, etc.
2019-09-04 12:41:16 +01:00
Arnaud Bailly
3dcd48e08b
Merge branch 'master' into configurable-ide-mode-socket 2019-08-29 16:24:17 +02:00
Arnaud Bailly
643fc9c4c7
provide Version command in ide-mode 2019-08-29 14:37:38 +02:00
Arnaud Bailly
558776c4c4
remove version number from banner at REPL startup
otherwise all tests will need to change every time version changes...
2019-08-29 14:37:04 +02:00
Arnaud Bailly
4646bb0d1c
expose current Idris2 version as a proper type 2019-08-29 14:37:04 +02:00
Edwin Brady
0a8b50d31f
Merge pull request #72 from jfdm/make-test-output-better
Print expected and given output when test fails.
2019-08-29 10:52:30 +01:00
Edwin Brady
718f5963ce
Merge pull request #70 from jfdm/expand-ipkg-contents
Align the IPKG format more with the previous Idris implementation.
2019-08-29 10:51:41 +01:00
Arnaud Bailly
64b0c10356
Merge branch 'master' of https://github.com/edwinb/Idris2 into configurable-ide-mode-socket 2019-08-17 12:56:38 +02:00
Edwin Brady
c01986a62e Preserve order of arguments in unification
Sometimes we swap the arguments, to reduce code duplication, but we need
to remember we've done that since (1 x : a) -> b is valid for an
argument of type (x : a) -> b, but not vice versa (that is, we have a
teensy bit of subtying to deal with, for convenience...).

This fix seems a bit ugly, but we do at least now propagate the
information. Fixes #82.
2019-08-16 11:32:16 +01:00
Edwin Brady
9bb91b5656 Allow deferring definitions to other modules
This is supported by Idris 1 and is handy for breaking cycles in
modules. To achieve this, we just need to make sure that complete
definitions aren't overwritten with empty definitions on loading.
2019-08-06 13:33:30 +01:00
Jan de Muijnck-Hughes
41cbb4eb2f Print expected and given output when test fails. 2019-08-03 20:07:11 +01:00
Arnaud Bailly
c6ba34c770
really remove ide mode socket test 2019-08-02 19:46:58 +02:00
Arnaud Bailly
39a5c25fbc
remove ide socket mode test because it's hard to make reliable 2019-08-02 17:59:17 +02:00
Arnaud Bailly
b682accc0b
Merge branch 'master' of https://github.com/edwinb/Idris2 2019-08-02 07:08:34 +02:00
Jan de Muijnck-Hughes
9839664d32 Align the IPKG format more with the previous Idris implementation. 2019-08-01 12:47:08 +01:00
Edwin Brady
e95c5f7571 Remove unnecessary check from let elaboration
Checking the let expression in full can break sharing when unifying the
types, and it's unnecessary because we've already checked the type of
the scope unifies with the expected type.
Fixes #63
2019-07-31 10:10:47 +01:00
Edwin Brady
f39b736110
Merge pull request #66 from abailly/no-prelude
check noprelude option when starting up without loading a file
2019-07-30 16:47:08 +01:00
Arnaud Bailly
ff7180e6b5
check noprelude option when starting up without loading a file #65 2019-07-30 13:56:27 +02:00
Edwin Brady
147d81f8ff Forgot to add test files! 2019-07-30 12:33:49 +01:00
Edwin Brady
47ad8ee7f5 Propagate implicits to with clauses
Fixes #57. Also move much of the 'with' machinery to its own source
file.
2019-07-30 12:32:33 +01:00
Arnaud Bailly
c49942cfc4
(hopefully) fix ide-mode-socket test
for some reason running idris2 _without_ an input file fails which
throws this test in a spin. We start the interpreter in ide mode on a
socket loading an empty module without prelude and then request
loading a file that does not require Prelude.
2019-07-30 07:57:44 +02:00
Arnaud Bailly
48ad84af0f
Merge branch 'master' of https://github.com/edwinb/Idris2 2019-07-29 14:13:58 +02:00
Edwin Brady
e6cf936331 Make sure hole names are unique
Fixes #6
2019-07-28 21:04:55 +01:00
Edwin Brady
e7054500e4
Merge pull request #60 from chrrasmussen/run-individual-tests
Run individual tests (Fixes #23)
2019-07-28 20:17:28 +01:00
Christian Rasmussen
e82a0c6acb Add instructions on how to run a subset of the tests 2019-07-28 20:21:34 +02:00
Edwin Brady
aaaf3a873b Check implicit searches are complete
Fixes #55
2019-07-28 18:27:43 +01:00
Christian Rasmussen
54f00e9247 Run individual tests (Fixes #23) 2019-07-28 18:54:23 +02:00
Edwin Brady
f1a4e0c09d Change elaboration of lets
Elaborate the scope of a let without the computational behaviour,
meaning that `let x = v in e` is equivalent to `(\x => e) v`. This makes
things more consistent (in that let bindings already don't propagate
inside case or with blocks) at the cost of not being able to rely on the
computational behaviour in types. More importantly, it removes a
significant potential source of slowness.

Fixes #58

If you need the computational behaviour, you can use a local function
definition instead.
2019-07-28 13:43:01 +01:00
Edwin Brady
0bb9a13d37 Update method names when checking default methods
Fixes #42. If we don't do this, the name is treated in the saem way as
an unbound implicit, which is not what we want, so update with the
method applied to the parameters.
2019-07-27 17:01:02 +01:00
Arnaud Bailly
775c67452a
reactivate all tests 2019-07-27 17:18:06 +02:00
Arnaud Bailly
5a555641a0
Merge branch 'master' of https://github.com/edwinb/Idris2 2019-07-27 17:03:26 +02:00
Edwin Brady
f6fa192779 Add test for fix for #49 2019-07-26 23:13:11 +01:00
Edwin Brady
fa76f2a78b Bind auto implicit arg names in LHS
We were only doing implicits, so add auto implicits too. It's slightly
tricky, because we might also have implicits given of the form @{x}
which stands for the next auto implicit.

Fixes #50
2019-07-26 16:58:02 +01:00
Edwin Brady
8e9655dd9b Unbound implicits are invertible in terms
Just like all other pi-bound things, if m is an unbound implicit and we
have m ?x = m y as a unification problem, we can conclude ?x = y because
it has to be true for all ms.

This was implemented in Blodwen but I hadn't got around to it yet for
Idris2... fortunately it's a bit easier in Idris2!

Fixes #44
2019-07-26 12:27:54 +01:00
Edwin Brady
86eb475413 Check for name clashes in impl constraints
We were only checking parameters, meaning that there were potential
clashes leading to confusing behaviour, and meaning that it was somehow
relevant what the names were in the interface!
2019-07-22 23:16:51 +01:00
Arnaud Bailly
db8079bae6
Merge branch 'master' of https://github.com/edwinb/Idris2 2019-07-22 17:22:39 +02:00
Edwin Brady
7e67ba4f35 Allow marking interface methods multiplicities
Now by marking a method as multiplicity 0, we can explicitly say that
it's compile time only, so we can use it to compute types based on other
erased things - see tests/idris2/interface008 for a small example.

This fixes #8 - at least in that it allows the interface to be expressed
properly now, although the multiplicity annotations mean that
unfortunately it can't be compatible with Idris 1.
2019-07-22 16:21:33 +01:00
Edwin Brady
91262b4800 Fix possible loop in auto implicit search
A local variable can't be applied to itself when searching (otherwise,
for example, we could end up trying something like id id id id id id etc
forever). So remove it from the environment before searching for its
arguments.

This and the previous patch fix #24. (Or, at least, the minimised cases
reported as part of it!)
2019-07-22 11:21:34 +01:00
Arnaud Bailly
dc9ab95adb
Merge branch 'master' of https://github.com/edwinb/Idris2 2019-07-21 07:48:49 +02:00
Arnaud Bailly
a6610a1a07
add very basic and fragile test for ide-mode-socket 2019-07-21 07:35:20 +02:00
Edwin Brady
6d90b72fe9 Check under data constructor for holes
We can't begin a search until we know what we're searching for! For some
reason I forgot to add this case, and without it the search space can
explode, or we might find an answer too soon and commit to the wrong
thing!

Fixes #36
2019-07-20 21:09:33 +01:00
Edwin Brady
0b1d6527c8 Add test for #25 2019-07-20 19:01:34 +01:00
Edwin Brady
cae9162fcf Check under 'as' patterns for case arg usage 2019-07-20 18:57:03 +01:00
Edwin Brady
6dd18d798a Allow annotating functions with multiplicity
This means we can write truly type level only functions, by annotating
them with a 0 before the type declaration.
2019-07-20 18:04:18 +01:00
Edwin Brady
607e280895 Place implicits through to method bodies
This means that even if the relevant parameters aren't used by a method
body, the method can still see what the implicits are (though they will
be 0 multiplicity).

This is relevant to #8, but doesn't really fix it because we still need
a way of saying that methods are 0 multiplicity.
2019-07-20 16:25:40 +01:00
Arnaud Bailly
4f21234c9e
basic test for --ide-mode
how to take care of input termination properly? currently we add the
message 'Alas the file is done' in the expected outcome but that's
ugly
2019-07-19 12:34:15 +02:00
Edwin Brady
9f94606037 Finish Chapter 12 tests 2019-07-12 09:34:29 +02:00
Edwin Brady
39ee4ad9c8 Numeric range syntax 2019-07-12 09:32:36 +02:00
Edwin Brady
4860d2b751 Add Range interface to prelude
This is part of what we used to have in Enum but I think it's better to
separate the two. Added implementations for Nat, and anything in
Integral/Ord/Neg, so that we get range syntax (at least when its
implemeted) for the most useful cases.
2019-07-11 23:38:25 +02:00
Edwin Brady
1cf9849a55 Add the bits of Chapter 12 that work
Still need enumeration syntax for the rest
2019-07-10 20:22:00 +02:00
Edwin Brady
fd4f90e331 Add some Control.Monad things
This required a small change to auto implicit search (and I'm still not
sure about this). Now search arguments right to left, because solving
later arguments may resolve earlier arguments by unification and this
can happen in particular when chasing parent interfaces (which may have
fewer parameters).
2019-07-10 20:18:40 +02:00
Edwin Brady
9f6a3fd2b8 Fix in scheme backend and test script
At least on Linux, \r needs to be in singles quotes as an argument to tr
or it removes all the 'r' instead! Hopefully it also works this way on
Windows...
2019-07-10 17:23:45 +02:00
Edwin Brady
a422294f36 Pass auto implicits through interfaces
This allows 'traverse' to work now (it was treating them as normal
implicits, so building the wrong form of application)
2019-07-10 17:23:33 +02:00
Niklas Larsson
28438650d0 windows support 2019-07-10 01:51:41 +02:00
Edwin Brady
2487c30232 Adding missing test files 2019-07-09 09:22:50 +02:00
Edwin Brady
2bb496f74b Chapter 11 examples now working 2019-07-08 23:46:20 +02:00
Edwin Brady
164a0a60cf Add Chapter 10 TypeDD tests
A lot to change here! To be honest, this chapter probably needs a
complete revision...
2019-07-08 13:04:39 +02:00
Edwin Brady
11199acab6 Improve 'with' implementation
Now supports with applications on the RHS when auto implicits are
involved. Auto implicit bound names in patterns now become searches on
the rhs in a with-application (I should write this construct up properly
in a paper some time!)
2019-07-08 12:55:55 +02:00
Edwin Brady
51c406ff7d Deal with non-existent files more gracefully
So now you can start idris2 with a non-existent file and use :e to start
editing it
2019-07-07 13:10:14 +01:00
Edwin Brady
fc224b1450 Fix Total004 test
Names in Data.List clashed
2019-07-06 15:55:47 +01:00
Edwin Brady
4ab543b83d A bit more library support, for Chapter 9
Also a tweak to errors when compiling to scheme, so that it properly
reports an error then quits if it's supposed to crash.
2019-07-05 17:24:15 +01:00
Edwin Brady
5fc0aa8248 Add Chapter 8 tests 2019-07-05 11:28:37 +01:00
Edwin Brady
7c34fa1db4 Change equality elaboration
Elaborate via either === (homogeneous equality) or ~=~ (heterogeneous
equality) both of which are synonyms for Equal. This is to get the Idris
1 behaviour that equality is homogeneous by default to reduce the need
for type annotations, but heterogeneous if that doesn't work.
2019-07-05 11:26:45 +01:00
Edwin Brady
40d9235b3f Allow ambiguity when chasing parent interfaces
There's a bit of a trade off here. It would be better to report the
ambiguity but this would lead to a need for (I think) excessive
precision in types which would impact usability. It will always take the
leftmost interface.

Chapter 7 tests added.
2019-07-05 10:29:41 +01:00
Edwin Brady
aa58114671 Add 'last chance' unification and tweak guesses
Idris 1 will fill in the last metavariables by matching rather than
unification, as a convenience. I still think this is okay, even if it's
a bit hacky, because it's a huge convenience and doesn't affect other
unification problems.

Also abstract over lets in guesses, like in delayed elaborators, to
avoid any difficulties when linearity checking and to make sure that let
bound things don't get reevaluated.

This is enough to get the Chapter 6 TypeDD tests working
2019-07-05 00:09:00 +01:00
Edwin Brady
c260f6c90e Improve dot patterns
Allow matching rather than unification, as long as it doesn't solve any
metavariables on the way. I noticed a potential unification bug on the
way, forgetting to update whether holes are solved when unifying
argument lists.
2019-07-04 23:16:08 +01:00
Edwin Brady
6f5d3f5fef Unelaborate hole applications properly
This was left over from Blodwen (where it was also wrong :)) but the way
we apply metavariables now means we don't need to do anything fancy when
unelaborating them for pretty printing.
2019-07-03 15:31:46 +01:00
Edwin Brady
89c8314a0f Desugar pattern matching lambdas 2019-07-03 15:11:57 +01:00
Edwin Brady
0f56c239c2 Parse pattern matching lambda
This is now enough for Chapter 5 tests to work
2019-07-03 13:04:25 +01:00
Edwin Brady
e526badfe2 Delay case elaboration
This helps a few things because it delays elaboration of the block until
as much as possible is known about its type.

Also added a few libraries.
2019-07-02 16:53:41 +01:00
Edwin Brady
5eec46f6ce TypeDD chapter 4 tests 2019-07-01 21:35:19 +01:00
Edwin Brady
00514887c4 More base libraries
This has shown up a problem with 'case' which is hard to fix - since it
works by generating a function with the appropriate type, it's hard to
ensure that let bindings computational behaviour is propagated while
maintaining appropriate dependencies between arguments and keeping the
let so that it only evaluates once. So, I've disabled the computational
behaviour of 'let' inside case blocks. I hope this isn't a big
inconvenience (there are workarounds if it's ever needed, anyway).
2019-06-30 23:54:50 +01:00
Edwin Brady
577b68dd5a Make a start on Data.Vect 2019-06-30 17:38:40 +01:00
Edwin Brady
f2dff5cae4 Normalise holes in error messages
The solved holes may not outlive the error, so normalise before throwing
so that they can be displayed properly.
2019-06-30 17:23:19 +01:00
Edwin Brady
f37da6c5b7 Start adding tests for TypeDD book
Also detailing any changes needed to the code. Added primitives for
Doubles, and repl/replWith to get Chapter 2 code to work.
2019-06-30 15:50:58 +01:00
Edwin Brady
eddb23d108 Need to save postponed names in ttc too
Flag these when searching names for references
2019-06-30 12:49:11 +01:00
Edwin Brady
ae777b8dcb Add parameters blocks 2019-06-29 23:55:17 +01:00
Edwin Brady
2f4cdf857d Make typecase on -> work 2019-06-29 22:43:06 +01:00
Edwin Brady
17c862fe00 Add parse error tests from Blodwen 2019-06-29 21:37:30 +01:00
Edwin Brady
f9ea1ff329 Updating typecase, add tests 2019-06-29 21:32:19 +01:00
Edwin Brady
7aa8a71f8f Fix loading of hints, and add test
Need to add by full name, due to ordering of loading (the name it's
attached to may not be resolved yet!). This doesn't seem to cause any
performance problems but we can revisit if it does.
2019-06-29 20:51:48 +01:00
Edwin Brady
e463a2864a Add a couple more tests 2019-06-29 20:03:00 +01:00
Edwin Brady
a65d1efa38 Throw error if case type is not inferred
This is probably quite rare to want, but we could consider putting this
under a delayOnFailure
2019-06-29 19:39:11 +01:00
Edwin Brady
99dac56e1e Make sure matches are not too specific
i.e. if an argument has a polymorphic type, we shouldn't allow a
concrete type in its place
2019-06-29 19:28:04 +01:00
Edwin Brady
cda87a9c16 Fix coverage checker issue
Don't use the type of a scrutinee to restrict possible patterns, because
it might have been refined by a Rig0 argument that has a missing case.
Instead, generate all the possible cases and check that the generated
ones are impossible (there's no obvious change in performance)
2019-06-29 16:41:26 +01:00
Edwin Brady
9b44839c57 Add test for eta 2019-06-28 12:43:55 +01:00
Edwin Brady
e9a3167e2f Even more tests
Small change needed to fix one - assume given implicits which are of the
form x@_ arise from types. It's a bit of a hack but I don't think
there's any need for anything more complicated.
2019-06-27 20:19:00 +01:00
Edwin Brady
110a7461fc More tests from Blodwen 2019-06-27 19:33:02 +01:00
Edwin Brady
82ceedb84e Add linearity tests 2019-06-27 19:28:14 +01:00
Edwin Brady
b0cad15c65 Refine dot pattern rules
Only valid if unifying the pattern at the end doesn't solve any
metavariables. Also when elaborating applications of fromInteger etc to
constants on the LHS we need to be in expression mode, then reduce the
result later.
2019-06-27 19:16:33 +01:00
Edwin Brady
211de419bb Fix environments for nested names
This was a slight difference from Blodwen that wasn't accounted for -
there might be lets in the nested environment, so when building the
expanded application type, make sure we go under them
2019-06-27 15:26:18 +01:00
Edwin Brady
d053a18977 Set fresh name counter on loading Main ttc
Make sure this is the counter from the right namespace, or we might get
name clashes at the REPL
2019-06-27 14:47:47 +01:00
Edwin Brady
ce78abaaef Build and save references for metavars too
This wasn't necessary before, since we always inlined, but since we can
now postpone things longer and don't always inline until much later, we
need to know what names everything refers to earlier.
2019-06-27 09:01:59 +01:00
Edwin Brady
2cd81a9eb0 More tests moved over... 2019-06-25 21:50:48 +01:00
Edwin Brady
3eda2494bf Add error message tests 2019-06-25 21:46:28 +01:00
Edwin Brady
7b504e7a9e More Chez tests 2019-06-25 21:27:46 +01:00
Edwin Brady
69199639cf Fix Nat hack
And add chez scheme section to tests, with one initial test
2019-06-25 14:05:54 +01:00
Edwin Brady
bf64f843aa A bit more totality checking polish
Need to check for 'assert_total' in getRefs, and get Inf and Lazy the
right way around!
2019-06-25 12:57:49 +01:00
Edwin Brady
0b4f4ec46d Fix naming issue in totality checker
Also added a new test
2019-06-25 10:26:14 +01:00