Commit Graph

294 Commits

Author SHA1 Message Date
Ohad Kammar
aa451022b5 Add tests for fully abstract records in Idris and Yaffle 2020-04-16 02:49:32 +01:00
Edwin Brady
0ed9f6cee6 Occasional performance boost
Check for conversion without reducing names, before unifying arguments.
This is quick to check, and can save a lot of evaluation.
2020-04-12 18:01:45 +01:00
Edwin Brady
841c3f27a5 Change order of argument search in auto implicits
For consistency with interactive expression search
2020-04-10 15:39:45 +01:00
Edwin Brady
69a7640a6e Allow flagging types as externally defined
e.g. in a C file. This means we don't accidentally treat things as
empty, since previously we just defined these as empty types, but that
broke coverage checking. Fixes #240
2020-04-10 11:45:52 +01:00
Edwin Brady
0daece1e0e Fix where under multiple cases
The names the locals were being applied to weren't being updated
properly, so applications of local functions inside case blocks were
sometimes given the wrong arguments. This is one of the few places where
it's hard to keep track of names in the type system! So naturally that'd
be where things go wrong I suppose...
2020-04-09 18:47:39 +01:00
Edwin Brady
1c4b558b26
Merge pull request #271 from ohad/bugfix-269
Bugfix #269
2020-04-06 22:27:19 +01:00
Edwin Brady
3b07afc601
Merge pull request #268 from gallais/interactive-test
[ new ] interactive test runner
2020-04-06 22:12:15 +01:00
Ohad Kammar
fbf82eaf0b Bugfix #269
Make desugaring/elaboration of interfaces, interface implementations,
records, and parameter blocks take into account the pragma
`%unbound_implicits off`.

Main changes:

(a) Execute the pragma also during desugaring
(b) Check whether `isUnboundImplicits` is on at each desugaring step

Alternatives I didn't take:

(1) Changing `findBindableNames` to effectfully check the flag.

  Rationale:
  Apart from turning a pure function into an effectful one, this
  would mean repeatedly calling `findBindableNames`, only to do
  nothing once the flag is read.

(2) Adding another function that takes multiple places (list of terms)
  that might contain bindable names, and before dispatching
  `findBindableNames` on each term, checking the flag.

  Rationale: I didn't want to add another abstraction. (weak
  rationale)

@edwinb @gallais : if you prefer (2), I can do that.
2020-04-06 15:56:48 +01:00
Guillaume Allais
6e2ccb085e [ more ] show the diff in case of mismatch 2020-04-06 11:29:18 +01:00
Guillaume Allais
5ae54488d7 [ new ] interactive test runner 2020-04-06 11:06:19 +01:00
Guillaume Allais
8cb17de3f9 [ fix ] resugar to drop name prefixes
My first attempt at refolding natural constants led to all names
being printed with their namespace prefixes. This fixes that,
most notably by introducing the massive `mapPTermM` function in
`Idris.Syntax`.
2020-04-03 20:00:59 +01:00
Guillaume Allais
e1aea9fae7 [ new ] resugar Prelude's natural numbers 2020-04-03 00:00:16 +01:00
Guillaume Allais
4cbb02b6b3 [ fix ] properly nesting multiline comments
We should be able to comment out any part of a program that parses
and still get a program that parses. This means we need to properly
ignore `{-` and `-}` when hidden behind a `--` comment or inside of
a string literal.
2020-04-01 12:52:01 +01:00
Edwin Brady
f7161cc76b
Merge pull request #237 from petithug/literate-master
Literate programming
2020-03-31 18:19:43 +01:00
Edwin Brady
b3dc643029 Better disambiguation of pairs
The names weren't fully explicit in the elaborator, so ambiguity
resolution wasn't able to take advantage of type-directed pruning. Now
they're explicit (but hard-coded, which we should fix later...) so they
can be resolved more easily.
2020-03-31 18:12:34 +01:00
Marc Petit-Huguenin
7ea39af60e
Literate programming
- Add support for .lidr files.
- Add new Parse Error for Literate fails.
- Add support for Case Split.
- Add support for Add Clause.
- Add support for Add Lemma.
- Add tests.
2020-03-29 11:58:00 -07:00
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