Commit Graph

278 Commits

Author SHA1 Message Date
Edwin Brady
2938e86421 Ints in buffers are 32 bit
...for consistency with Idris 1 (probably to be revisited later). So,
when working via the scheme primitives, we need to read/write 32 bits.
2020-03-27 20:54:39 +00:00
Edwin Brady
ebafddcfc9 Look for scrutinee type in case
We can work out what it should be since each case is supposed to have
the same type, so we can look ahead to the alternatives. This way, we
don't have to rely on the scrutinee alone to calculate the type of the
case block. (Idris 1 does this too but I've only just encountered the
need for it in Idris 2 now!)
2020-03-27 14:27:33 +00:00
Edwin Brady
654c306ed5 Update idemode tests
Change in evaluation order changes the internal names - not that we
should be exposing these anyway, but that can be tidied up later...
2020-03-27 00:34:21 +00:00
Edwin Brady
bce7a5e747
Merge pull request #205 from abailly/syntax-highlight
first stab at syntax highlighting in Emacs
2020-03-27 00:22:19 +00:00
Edwin Brady
ed5b53d97f Rabbit hole
Sorry for the less than informative title :). Lots going on here. It
started as an attempt to fix unification to deal with laziness coercions
in trickier places, but unearthed a couple of tricky and interconnected
issues that are hard to unpick into a single patch. So, this fixes a few
things:

- default hints should only be resolved on the current elaboration (e.g.
nested function definitions, not the outer definition which might not
yet be complete)
- delayed elaborators should be allowed to have nested delayed
elaborators, which means disambiguation is a little bit better
- we should delay elaborating arguments where the type isn't known yet,
because later arguments may resolve the type, and we can use this to
help with disambiguation/laziness coercions
- other bits and pieces arising
2020-03-27 00:11:21 +00:00
Edwin Brady
cbf8785d32 Take account of env in record elaboration
Also need to make sure that the constructor and fields are included in
the nested names so that the parameters get expanded properly.
Fixes #138
2020-03-19 12:12:25 +00:00
Edwin Brady
3cf223b835 Elaborate record bodies on second mutual pass
This is the same behaviour as Idris 1. Fixes #217
2020-03-18 23:09:17 +00:00
Edwin Brady
588a5b74cd Only record fields should be in a new namespace
Record name and constructor are in the outer namespace, fields in the
nested namepsace. Private names in the nested namespace is visible from
the outer namespace. Fixes #183

Also remove the 'nested' flag on INamespace, since it was only there for
records, and not really the right way to do things. The nested namespace
name is now given in the IRecord constructor (a front end might not want
to use a new namespace after all).
2020-03-18 22:48:19 +00:00
Edwin Brady
776abebba1
Merge pull request #227 from ska80/typedd-book/chapter13-14
Port code examples for chapters 13 and 14 from TypeDD book
2020-03-18 20:37:26 +00:00
Edwin Brady
c1bc4330fa Don't build run time case trees for Rig0 defs
They might match on runtime-erased things (which is okay, since they're
erased too!) and if we try building the tree, it'll report an error
incorrectly. Fixes #229
2020-03-18 20:09:11 +00:00
Edwin Brady
59b66d6134 Add prettyName
This is to display names in a user friendly way, especially case and
with block names
2020-03-18 19:33:19 +00:00
Edwin Brady
fbff80545d Add coverage006 test 2020-03-18 14:39:59 +00:00
Edwin Brady
22febdf7ff Take environment into account in coverage check
We weren't using the surrounding environment for building the patterns
for an impossible case, so getting strange errors. Fixes #228
2020-03-18 14:05:01 +00:00
Edwin Brady
1f0212c20d Update test output 2020-03-17 21:55:34 +00:00
Edwin Brady
8db29f5b35 Add --no-banner to test 2020-03-17 21:34:16 +00:00
Edwin Brady
102fb7fdb6 Coverage checker improvement
Check that none of the generated missing cases match explicitly given
clauses, which might happen if there's some overlaps in the clauses or
if there's some matching on implicits. Ignore erased argument positions
when checking the match.
2020-03-17 21:12:21 +00:00
Kamil Shakirov
1704495f06 Port code examples for chapters 13 and 14 from TypeDD book 2020-03-13 09:50:22 +06:00
Edwin Brady
946881d56c Make sure we only insert 'Delay' at the top level
If we postpone unification problems, it's not necessarily at the top
level of a term, but then if we retry and find we need to insert a
'Delay' or 'Force' then it had better be at the top level or we'll get
an incorrect term. So, keep track of this in postponed constraints.
2020-03-12 14:58:06 +00:00
Edwin Brady
9229cdbf1f Fix order of metavariable substitution
Need to substitute the one applied to most things, or it won't want to
substitute at all. Fixes #226
2020-03-10 19:39:36 +00:00
Edwin Brady
288a92424a Unifier mustn't resolve things which aren't holes
For example, delayed elaborators. If it resolves one, and it's not a
complete solution, we might end up with unsolved holes. Or - possibly
worse - we might end up with an error in a program that is silently
fixed rather than reported!

Fixes #223
2020-03-09 23:04:02 +00:00
Edwin Brady
34044597c0
Merge pull request #213 from ska80/prelude/getchar-putchar
Add getChar, putChar and putCharLn to prelude
2020-03-07 14:15:22 +00:00
Arnaud Bailly
3a98ce91ea cope with different number of :ok return values 2020-03-06 19:20:25 +01:00
Edwin Brady
9060b24f2f Move network test to chez test suite 2020-03-05 18:03:12 +00:00
Edwin Brady
1dd81ff10b Look under . for function name on lhs
Need this to rule out some ambiguous names. Fixes #204.
2020-03-05 11:22:48 +00:00
Edwin Brady
fc0cfcb22b
Merge pull request #210 from ska80/chez010-test-makefile
Use Makefile for tests/chez/chez010
2020-03-05 10:31:45 +00:00
Edwin Brady
2653a7f7fb
Merge pull request #209 from ska80/chez013-test-makefile
Use Makefile for tests/chez/chez013
2020-03-05 10:31:17 +00:00
Edwin Brady
f38dd50b3f
Merge pull request #203 from m-bd/path-lookup
Add PATH lookup to find Chez Scheme
2020-03-05 10:17:33 +00:00
Kamil Shakirov
c8c0c5fb49 Add getChar, putChar and putCharLn to prelude 2020-03-05 14:55:20 +06:00
Kamil Shakirov
ac827222e8 Use Makefile for tests/chez/chez010 2020-03-03 18:11:47 +06:00
Kamil Shakirov
b14559c08c Use Makefile for tests/chez/chez013
Fixes running tests on MacOS where dlopen(3) loads shared libraries with 'dylib' extension.
2020-03-03 14:57:45 +06:00
Arnaud Bailly
2d6394c76c add type information for names found in metadata 2020-03-02 18:49:28 +01:00
Edwin Brady
a5c356f998 Basic support for struct in FFI
Just in the Chez backend for now, and not allowing strings or functions
due to limitations of Chez.
2020-03-01 23:23:21 +00:00
Arnaud Bailly
75b04d867b first stab at syntax highlightin in Emacs
got the basic infrastructure to output syntax highlight in IDE mode
setup but the results are far from being usable, need more work to
understand how to reap information from Metadata
2020-02-29 13:47:27 +01:00
Mounir Boudia
141c52ded7 Add PATH lookup to find Chez Scheme
On some systems "/usr/bin" and "/usr/local/bin" are not used.
If CHEZ env variable is not defined, lookup for chez in the PATH if
defined. Otherwise falls back to the old behaviour. (ie. lookup in
"/usr/bin" and "/usr/local/bin" as a last resort)
2020-02-27 23:47:54 +01:00
Edwin Brady
8f583ca900
Merge pull request #189 from chrrasmussen/fix-ide-mode-backwards-compatibility
Fix IDE Mode for Atom
2020-02-27 10:38:36 +00:00
Edwin Brady
1bb028ae47 Update proof tutorial for Idris 2 2020-02-26 12:33:01 +00:00
Edwin Brady
16ae7994e7 More documentation refreshing 2020-02-25 22:18:02 +00:00
Edwin Brady
2a2a20849d Add default implicit arguments
These are part of the core QTT now, so any substitutions or dependencies
will be dealt with as they should.
2020-02-25 14:09:08 +00:00
Edwin Brady
2da8da8aa9 Add missing test file 2020-02-23 22:20:11 +00:00
Edwin Brady
57a14ff401 Coverage checker looks at 'impossible' clauses
These can give valuable information, but since they're not well typed,
we have to rebuild as close an approximation as we can before passing it
to the case tree compiler. We can do this in a type-directed way, but
ignoring whether any of the arguments are convertible, and not trying to
solve any of the implicits. If this fails, it doesn't use the impossible
case, otherwise it uses it to find the missing cases in the resulting
case tree.
2020-02-23 21:40:23 +00:00
Edwin Brady
cd972143a5 Also check unique locals inside pairs
The error message doesn't propagate nicely here yet, but it should still
report failure to resolve the search
2020-02-23 17:44:18 +00:00
Edwin Brady
11da440124 Ambiguity checking on locals in auto search
Fixes #160
2020-02-23 17:30:48 +00:00
Edwin Brady
654ab0cbd0 Look inside definitions during conversion
If two definitions are identical, with the same arguments, they should
convert, even if they have different names. Fixes #194
2020-02-23 15:58:14 +00:00
Edwin Brady
e126dcd28f Add --find-ipkg flag
This looks for an .ipkg file in a parent directory before loading the
given file, and loads it relative to the .ipkg's source directory, with
the options specified in the .ipkg.

The intention is to save all the editor modes having to do the same
thing, and especially makes it possible for the new vim mode to work
with ipkgs.
2020-02-22 23:25:02 +00:00
Edwin Brady
8158c617f6 Disambiguate data constuctor families
If the name is given (rather than, say, computed) update it so that it's
the data type name being defined - so ambiguities are resolved
immediately. Fixes #192
2020-02-22 19:32:22 +00:00
Edwin Brady
5c86552e56 Parse primitive types as identifiers
This way we can use them as parts of namespaces - they don't need to be
reserved keywords, just reserved names. Fixes #111
2020-02-22 18:36:46 +00:00
Edwin Brady
03bdc3145c Type of generated top level methods
Pass through the types of the interface parameters to the top level
method types, because there might be information in there that we can't
otherwise infer. Fixes #188
2020-02-22 17:38:13 +00:00
Edwin Brady
22a779bc88 Proof search on solved holes shows result
From the result of unification
2020-02-22 15:30:45 +00:00
Edwin Brady
fb49038c9f Don't automatically apply implicits in let
This means we can say 'let x = foo' and have foo not be applied to its
implicit arguments, meaning that 'x' can be instantiated at whatever
implicits it needs through the scope.
2020-02-16 16:33:17 +00:00
Edwin Brady
84faedba50 Tweak expression search heuristic
Search locals left to right, so that they are used as arguments in the
same order by default in recursive calls.
2020-02-15 23:24:00 +00:00