Commit Graph

824 Commits

Author SHA1 Message Date
Edwin Brady
a9ccf4db4f
Experimental Scheme based evaluator (#1956)
This is for compiled evaluation at compile-time, for full normalisation. You can try it by setting the evaluation mode to scheme (that is, :set eval scheme at the REPL). It's certainly an order of magnitude faster than the standard evaluator, based on my playing around with it, although still quite a bit slower than compilation for various reasons, including:

* It has to evaluate under binders, and therefore deal with blocked symbols
* It has to maintain enough information to be able to read back a Term from the evaluated scheme object, which means retaining things like types and other metadata
* We can't do a lot of the optimisations we'd do for runtime evaluation particularly setting things up so we don't need to do arity checking

Also added a new option evaltiming (set with :set evaltiming) to display how long evaluation itself takes, which is handy for checking performance.

I also don't think we should aim to replace the standard evaluator, in general, at least not for a while, because that will involve rewriting a lot of things and working out how to make it work as Call By Name (which is clearly possible, but fiddly).

Still, it's going to be interesting to experiment with it! I think it will be a good idea to use it for elaborator reflection and type providers when we eventually get around to implementing them.

Original commit details:

* Add ability to evaluate open terms via Scheme

Still lots of polish and more formal testing to do here before we can
use it in practice, but you can still use ':scheme <term>' at the REPL
to evaluate an expression by compiling to scheme then reading back the
result.

Also added 'evaltiming' option at the REPL, which, when set, displays
how long normalisaton takes (doesn't count resugaring, just the
normalisation step).

* Add scheme evaluation mode

Different when evaluating everything, vs only evaluating visible things.
We want the latter when type checking, the former at the REPL.

* Bring support.rkt up to date

A couple of missing things required for interfacing with scheme objects

* More Scheme readback machinery

We need these things in the next version so that the next-but-one
version can have a scheme evaluator!

* Add top level interface to scheme based normaliser

Also check it's available - currently chez only - and revert to the
default slow normaliser if it's not.

* Bring Context up to date with changes in main

* Now need Idris 0.5.0 to build

* Add SNF type for scheme values

This will allow us to incrementally evaluate under lambdas, which will
be useful for elaborator reflection and type providers.

* Add Quote for scheme evaluator

So, we can now get a weak head normal form, and evaluate the scope of
a binder when we have an argument to plug in, or just quote back the
whole thing.

* Add new 'scheme' evaluator mode at the REPL

Replacing the temporary 'TmpScheme', this is a better way to try out the
scheme based evaluator

* Fix name generation for new UN format

* Add scheme evaluator support to Racket

* Add another scheme eval test

With metavariables this time

* evaltiming now times execution too

This was handy for finding out the difference between the scheme based
evaluator and compilation. Compilation was something like 20 times
faster in my little test, so that'd be about 4-500 times faster than the
standard evaluator. Ouch!

* Fix whitespace errors

* Error handling when trying to evaluate Scheme
2021-09-24 20:38:55 +01:00
madman-bob
119d8321d4
[ fix ] Use qualified type name for record elaboration (#1871) (#1948)
* [ fix ] Use qualified type name for record elaboration (#1871)

* Clarify record elaboration `Name` arguments
2021-09-24 11:23:46 +01:00
Guillaume ALLAIS
f4bd911f13 [ fix #1943 ] Allow operator names in named argument applications 2021-09-23 11:41:25 +01:00
Guillaume ALLAIS
a0846af5fa [ decor ] highlighting comments too
Even though the `Comment` aspect is not (currently) supported
in the IDEMode, this is crucial to get proper highlighting in
Katla's LaTeX & HTML backends.
2021-09-20 17:00:25 +01:00
Edwin Brady
bf0a157253
Disable -Xcheck-hashes, at least for the moment (#1940)
* Version increment to 0.5.1

This is to remove the requirement on Chez >9.5

* Disable -Xcheck-hases, at least for the moment

If we're going to have this as an option, we need to have a portable way
of finding a sha256sum command. At the moment, we might find a command,
but different versions accept different options. We should at least
allow setting it via an environment variable, and we certainly shouldn't
fail if running the command fails.

* Update bootstrap code ready for 0.5.1 release
2021-09-20 07:51:33 +01:00
Edwin Brady
1e90182311
Version increment to 0.5.1 (#1939)
This is to remove the requirement on Chez >9.5
2021-09-19 20:53:32 +01:00
Guillaume ALLAIS
87c1cb697f [ repl ] better printing of holes
* Fixed printing in the IDEMode (& include highlighting)
* Now also print the type of the holes
2021-09-19 17:49:51 +01:00
Edwin Brady
2e98dd6dab
Abandon auto search on undefined name (#1938)
* Abandon auto search on undefined name

These might arise from names in other modules that haven't been
imported. But it's going to be an error whatever, so give up straight
away. Fixes #1925

* Fix typo

* Fix test source

* Record possible cause when we can't solve a goal

Normally, it's just because we searched and failed. But maybe sometimes,
it's because there's an undefined name, in which case, we can include
this in the error message.

This is good to record because it means we don't abandon elaboration at
the wrong time! Say, if a search fails due to an undefined name, but it
was only in one branch of an ambiguous elaboration.

* Add necessary arguments for perf009 test
2021-09-19 14:31:29 +01:00
Edwin Brady
ada3eb4449
Version 0.5.0 (#1931)
* Update version numbers and bootstrap scheme

* Use wall clock time for search timeouts

That was always the intention in any case, rather than the process time.
2021-09-18 16:07:34 +01:00
James Cook
971afa9f5d
Add a transform rule making (++) for List tail-recursive. (#1888) 2021-09-16 15:35:29 +01:00
G. Allais
8b9916f5b1
[ html ] Various HTML docs fixes (#1924) 2021-09-15 18:41:37 +01:00
G. Allais
32e26c5bd1
[ refactor ] introduce UserName for (UN/RF) (#1926)
Instead of having UN & RF (& Hole in the near future & maybe even
more later e.g. operator names) we have a single UN constructor
that takes a UserName instead of a String.

UserName is (for now)

```idris
data UserName : Type where
  Basic : String -> UserName -- default name constructor       e.g. map
  Field : String -> UserName -- field accessor                 e.g. .fst
  Underscore : UserName      -- no name                        e.g. _
```

This is extracted from the draft PR #1852 which is too big to easily
debug. Once this is working, I can go back to it.
2021-09-15 13:20:58 +01:00
Tim Engler
7baf698f66
Made unifying error msg nicer. (#1922)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-09-15 11:57:50 +01:00
stefan-hoeck
281ae86ece [ fix ] string casts on js backends 2021-09-10 08:48:29 +01:00
Guillaume ALLAIS
1f85265193 [ re #1632 ] (->) does not unify with any of TCon/Type/PrimVal 2021-09-09 18:37:49 +01:00
G. Allais
911a907e74
[ highlighting ] Builtin.assert_ functions using postulate face (#1914) 2021-09-09 18:37:37 +01:00
Stefan Höck
af5657d23a
[ performance ] Memoise toplevel constants (#1899)
* [ performance ] memoize toplevel constants

* [ test ] memoization tests

* [ fix ] fix blodwen-lazy for racket and gambit
2021-09-08 16:46:19 +01:00
Guillaume ALLAIS
b231ef0da5 [ fix #1831 ] Be more careful about checking primitive names 2021-09-07 11:23:26 +01:00
Edwin Brady
c861845757
Abandon ambiguity resolution on undefined name (#1907)
* Abandon ambiguity resolution on undefined name

This has finally annoyed me enough to do something about it. If we get a
"no such variable" error there's no point exploring other branches.

* Removes spaces from test file

One day I'll update the linter to ignore test files. We should really
accept literally anything as a possiblity for test files, even if
removing the spaces is tidier.

* Reset context before throwing in 'successful'

Although I don't think this is strictly necessary for a fatal error, we
should still for the sake of tidiness reset the state when backtracking.
2021-09-07 00:41:08 +01:00
Edwin Brady
9865765d1d
Normalise errors on display, not when they arise (#1906)
* Move Context into its own file

Just the core definition - this is so that we have access to it in
Core.Core, for inclusion in error messages, to save normalisation of
terms in errors until we actually show them.

* Normalise errors on display, not when they arise

This can save a lot of time in ambiguity resolution if the errors are
complicated, because the errors might never be displayed if it's in an
abandoned branch.

This involves lifting 'Context' out of Core.Context, because we need to
store it in Error, which is needed by Core, which in turn is needed in
Core.Context.

Also moved a couple of test caes from ttimp to idris2, so that the
errors get rendered properly and won't need updating unnecessarily. In
fact all of the ttimp tests - which were just part of the initial
scaffolding - are probably now subsumed by the idris2 tests.

* Add new coverage001 test files
2021-09-06 23:37:59 +01:00
Edwin Brady
2a5739c27a
Check primitives (fromInteger etc) reduce on LHS (#1903)
If they don't, we can't turn them into patterns to match on, and we end
up looping. Possibly we could throw a different and maybe more
informative error instead of just making an unmatchable pattern.
Fixes #1895
2021-09-05 12:37:59 +01:00
Guillaume ALLAIS
257783275e [ new ] --total cli flag 2021-09-03 12:07:29 +01:00
Guillaume ALLAIS
1d1c428805 [ re #1828 ] test case 2021-09-01 11:32:51 +01:00
Guillaume ALLAIS
a7d73d0d3d [ new ] ellipses for with patterns
Rather than Agda's `...` we use the common symbol for "I don't care": `_`.
2021-08-31 22:50:46 +01:00
Guillaume ALLAIS
9498f44603 [ fix ] Parse let _ = as Let rather than LetPat 2021-08-31 22:50:22 +01:00
Guillaume ALLAIS
d289ed653d [ fix #1887 ] Parse _ <- as DoBind instead of DoBinPat 2021-08-31 22:50:22 +01:00
madman-bob
7a3d557bab
Add copyDir function (#1805)
Co-authored-by: Stiopa Koltsov <stepan.koltsov@gmail.com>
2021-08-30 16:42:58 +01:00
Joel Berkeley
078db21edf
Return a Vect from Stream take (#1812)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-08-30 16:00:20 +01:00
Mathew Polzin
cdc157a333 Add javascript support for getting system time as integer. 2021-08-30 15:35:49 +01:00
madman-bob
3e1f6aba56
Add copyFile to System.File (#1797)
Co-authored-by: Stiopa Koltsov <stepan.koltsov@gmail.com>
2021-08-30 15:31:37 +01:00
G. Allais
1e0027721f
[ fix #1859 ] Undo my mistakes (#1866) 2021-08-27 16:18:24 +01:00
G. Allais
e2addcf27d
[ new ] semantic highlighting via the IDE mode (#1868) 2021-08-27 14:47:35 +01:00
Stefan Höck
2465418610
[ fix ] fix #1839 (#1857)
* [ fix ] fix #1839

* [ test ] console width 0 in test
2021-08-24 15:43:22 +01:00
Guillaume ALLAIS
4a9f00078a [ close #1313 ] test case
This was fixed by, I believe, the addition of `withExtendedNS` in #1342
2021-08-20 16:47:59 +01:00
G. Allais
8d8a135237
[ fix #1496, fix #1345 ] propagate lex & lit fails too (#1850) 2021-08-20 16:47:47 +01:00
Guillaume ALLAIS
58907de84b [ new ] specify data/record/interface 2021-08-20 14:43:07 +01:00
G. Allais
c1ebc0535d
[ new ] semantic highlighting in REPL & holes (#1836) 2021-08-13 16:00:54 +01:00
G. Allais
21c6f4fb79
[ breaking ] remove parsing of dangling binders (#1711)
* [ breaking ] remove parsing of dangling binders

It used to be the case that

```
ID : Type -> Type
ID a = a

test : ID (a : Type) -> a -> a
test = \ a, x => x
```

and

```
head : List $ a -> Maybe a
head [] = Nothing
head (x :: _) = Just x
```

were accepted but these are now rejected because:

* `ID (a : Type) -> a -> a` is parsed as `(ID (a : Type)) -> a -> a`
* `List $ a -> Maybe a` is parsed as `List (a -> Maybe a)`

Similarly if you want to use a lambda / rewrite / let expression as
part of the last argument of an application, the use of `$` or parens
is now mandatory.

This should hopefully allow us to make progress on #1703
2021-08-10 19:24:32 +01:00
Tim Engler
be37e5b458 Added "lookupBetween" "leftMost" and "rightMost" to Data.SortedMap 2021-08-10 09:42:53 +01:00
Ellis Kesterton
0d6049cbcf
Fix error message for incorrect function patterns (#1816) 2021-08-09 10:00:34 +01:00
Edwin Brady
170af1e87a
Use Closures instead of NF in binders for normal forms (#1823)
* Skip forced arguments in conversion check

This isn't always safe - we have to have also checked the type of the
things we're converting - but in the place where it is safe it can be a
pretty significant saving.

* Use Closures, not NF, in Binders for normal forms

This means we don't need to reduce argument types during unification if
we don't need to. Also, we now try to avoid reducing closures during
unification if they are unified with a metavariable. Together, this
saves a huge amount of unnecessary evaluation in programs that do a lot
of compile time evaluation.

* Didn't mean to update idris2api.ipkg

* Fix dodgy merge
2021-08-08 17:05:29 +01:00
Zoe Stafford
1669fc351b
Refactor %builtin (#1803)
* Stub for future 'identity' optimisation
I plan to add this later, but I'm using for now for
NaturalToInteger and IntegerToNatural

* Refactor `%builtin`
fixes #1799

- automatically optimise all Natural shaped things
- NaturalToInteger and IntegerToNatural now use
  new `Identity` flag (internal use only for now)
  which signals the function is identity at runtime

* Use NaturalToInteger and IntegerToNatural for Nat and Fin
Also define show fin in terms of finToInteger, for speed

* Fix name handling for %builtin

* [ tests ] fixes + #1799

* remove %builtin from libs
Add back after next version

* Use resolved names where convenient
2021-08-03 14:19:17 +01:00
Zoe Stafford
8e1ca0eddf
Add break in each case alt in js backend (#1796)
* Add `break` in each case alt in js backend
Fixes #1795

* Remove some uneeded `break`s

* linter

* Follow @stefan-hoeck 's advice
This is neater
Note: I renamed breakAfterAssignment because it's too much work to type

* [ test ] Test for #1795

* cleanup: remove unneeded vcat
2021-07-30 07:16:23 +01:00
Sventimir
4920601fe9
Add tests for Nat ranges and fix bad range [1,2..1] behaviour. (#1794)
Co-authored-by: Marcin Pastudzki <marcin.pastudzki@gmail.com>
2021-07-28 06:52:59 +01:00
Mathew Polzin
b03395debe
Merge pull request #1603 from ska80/remove-realpath-notes
Remove all mentions of `realpath` from docs
2021-07-26 12:38:39 -07:00
Guillaume ALLAIS
13ef8ba707 [ fix #1782 ] remove the case-specific code
I can't make sense of this code, it seems to try to convert the
case function corresponding to `let (a, b) = f n in ...` into a
different case function where `f n` and `(a, b)` have been unified.
But if `f n` is a bona fide stuck computation, there's no chance of
this happening.

Just turning this off solves the #1782 and only breaks one function
in the whole of the idris2 repo (I would have expected our current
termination oracle to be too weak to detect it as valid anyway!)
and one in frex (which, again, should not have been seen as terminating).

Also fixes #1460
2021-07-26 17:03:16 +01:00
Guillaume ALLAIS
d0c0698c45 [ re #1771 ] Check parameters for positive uses
It's fine to allow positive occurences in (strictly positive)
parameters but we do need to check that these occurences are
strictly positive!
2021-07-23 13:30:24 +01:00
Guillaume ALLAIS
b24a9a51df [ re #1771 ] Fix another Erased-related issue (in nameIn) 2021-07-23 13:30:24 +01:00
Guillaume ALLAIS
230f42b697 [ re #1771 ] Do not use Erased to go under binders
In the `MkFix : f (Fix f) -> Fix f` example, using `Erased` for `f`
makes the type reduce to `[__] (Fix [__]) -> Fix [__]` and because
`[__] e1 ... en` computes to `[__]`, we end up with `[__] -> Fix [__]`
which does not reference `Fix` anymore.
2021-07-23 13:30:24 +01:00
André Videla
5389f8c2a8
Merge pull request #1770 from andrevidela/fix-if-then-else-interpolation
Fix #1767
2021-07-22 16:35:11 +00:00
Edwin Brady
e633a9fa6e Correct error018 test
I expect I got my local versions inconsistent while working on this...
2021-07-22 13:36:03 +01:00
Edwin Brady
edefd543f7 A bit of refactoring of argument elaboration order
In theory argument elaboration order doesn't matter, but in practice we
sometimes make choices for performance reasons, like helping with
disambiguation by knowing the target type.

This was kind of messy, now we can more clearly see what's going on.
Also, more importantly, it gives us a bit more control which we
sometimes need. For example, if we go choose to go right to left for
some performance heuristic it might turn out we don't have enough
information yet, in which case we need to delay and try again later.

Fixes #1743
2021-07-22 13:36:03 +01:00
André Videla
bab3897a9b move basic053->interpolation002, move basic061->basic053 2021-07-22 12:17:53 +00:00
André Videla
1276f47cf6 Fix #1767
The `if then else` syntax expects a block for the `then` and `else`
parts. Before this patch, the token `InterpEnd` was not a valid
follow up token to end a block. This adds `InterpEnd` as a closing
token for blocks, allowing `if then else` in interpolation slices
without additional parens.
2021-07-22 12:17:53 +00:00
André Videla
5576d30c27
Merge pull request #1736 from stepancheg/test-discovery
Implement test discovery
2021-07-22 08:56:02 +00:00
Edwin Brady
68db9fe0fe Add reg048 files
Odd, I thought I added these before, but it's probably because I got in
a mess with git and didn't re-add once I resolved that.
2021-07-19 00:21:28 +01:00
Edwin Brady
2068eb271b Better ordering of delayed elaborators
Instead of having an arbitrary looking priority number, record explicit
reasons for the delay, which helps order them sensibly when rerunning
them. Mostly this allows us to choose which ones to rerun, where it
helps, and helps order things to get better error messages.
2021-07-19 00:21:28 +01:00
Stiopa Koltsov
7325002dec Implement test discovery
`testInDir dir ...` lists all directories in `dir` which contains
`run` files, and such directories are considered tests.

This is done to make test addition/maintenance cheaper.

Convert some test directories to `testInDir`, but not all of them
because
* some directories are listed in several test groups
* other directories are have some tests disabled
2021-07-17 16:53:43 +01:00
Stiopa Koltsov
4eff6ac916 System.Directory.listDir
This function is what users want 99.9% of time.
2021-07-17 14:58:57 +01:00
Stiopa Koltsov
c7629e20fe Skip dot and dot-dot in nextDirEntry
These entries returned by `readdir` are legacy of Unix API, we don't
really need them. Most APIs do not return them (for example Java
`Files.newDirectoryStream` or Python `os.listdir`).
2021-07-17 14:58:28 +01:00
Stiopa Koltsov
0ecf74e434 System.Directory.nextDirEntry
* add `nextDirEntry` which returns `Maybe String`, so `Nothing` on
  the end of directory unlike `dirEntry` which returns unspecified error
  on the end of directory
* `dirEntry` is deprecated now, but not removed because compiler depends on it
* native implementation of `dirEntry` is patched to explicitly reset `errno`
  before the `readdir` call: without it end of directory and error were
  indistinguishable
* test added
2021-07-17 14:57:27 +01:00
Stepan Koltsov
ce44d3b50a
Change semantics of lines and unlines function to match Haskell and other languages (#1585)
* Add trailing newline on non-empty list in unlines

There are several reasons to do that:
* a line in a text file is something which ends with newline,
  and the last line is not special
* `unlines []` should be different from `unlines [""]`
* `unlines (a ++ b) = unlines a ++ unlines b`
* Haskell does it

* Change lines function behaviour
2021-07-17 14:54:23 +01:00
Ruslan Feizerakhmanov
ee063a5412
Apply "qualified do" notation to bangs and comprehensions (#1700)
* Propagate 'do qualification' to inner bangs and comprehensions

* Minor

* Remove banner in test

* Move tests from reg045 to reg047

* Move mbNS from Desugar.idr to Name.idr, renaming it to mbApplyNS
2021-07-17 14:52:22 +01:00
Kamil Shakirov
c4b41ee1ff Remove all mentions of realpath from docs
`realpath` is no longer needed to run executables.
2021-07-16 21:20:11 +06:00
Stiopa Koltsov
c4ed1395d9 Replace per signal counter with per signal flag
Operating system counter stores signals as flag set without counter.
So sending two signals to a process may result to one or two signal
handler invocation. Queueing signals inside Idris could give users
false sense of signals being are queue, while they are not.

In particular, test for signal could not work reliably for that
reason.

Also, practically we usually don't need have more than once signal
event.

This is follow-up to #1660. CC @mattpolzin
2021-07-16 11:31:53 +01:00
Giuseppe Lomurno
37c700907e Removed leak of internal names from test reflection010 2021-07-16 04:28:58 +02:00
Giuseppe Lomurno
07c62e9eef Fixed wrong reflection of records and parameters 2021-07-16 04:28:52 +02:00
Edwin Brady
f4cc2f1ea8
Merge pull request #1721 from edwinb/AliasQli-master
Updated: add doublePow to primitives
2021-07-15 23:17:53 +01:00
Stiopa Koltsov
c80a502627 Return Bool from IOArray.writeArray
As suggested in #1677.

Crashing on out-of-bounds might be more practical, but we can
reconsider it later.
2021-07-15 22:16:22 +01:00
Edwin Brady
f51aa22046 Bring #1719 up to date with latest changes 2021-07-15 22:04:49 +01:00
Edwin Brady
50c0116780
Merge pull request #1718 from edwinb/Russoul-unification
Postpone when instantiating if type is unknown
2021-07-15 21:16:00 +01:00
André Videla
e45d792283
Merge pull request #1701 from mattpolzin/alternative-errors
Show error output from multiple alternative parsing branches.
2021-07-15 20:06:25 +00:00
Edwin Brady
a709f6d369 Fix/reorganise tests 2021-07-15 20:24:40 +01:00
Edwin Brady
d9a56c5fd1 Merge branch 'unification' of https://github.com/Russoul/Idris2 into Russoul-unification 2021-07-15 20:24:27 +01:00
Mathew Polzin
948a5ba9df noticed I was not _quite_ retaining existing behavior around Alt error processing so fixed that. updated tests. 2021-07-15 12:05:23 -07:00
Edwin Brady
b192be32b8 Merge branch 'name-quote-single-brace' of https://github.com/buzden/Idris2 into buzden-name-quote-single-brace 2021-07-15 17:57:41 +01:00
Edwin Brady
b8082f4ed7
Merge pull request #1714 from edwinb/lodi-thread-data
fix arity for blodwen-set-thread-data
2021-07-15 16:21:31 +01:00
Edwin Brady
62586627d8 fix arity for blodwen-set-thread-data
This is an update of PR #540, thanks to @lodi
2021-07-15 15:02:43 +01:00
Mathew Polzin
289f1cc954 merge w/ upstream. 2021-07-15 06:29:56 -07:00
Edwin Brady
86aaed5ae1
Merge branch 'master' into fix-unquote-thing 2021-07-15 14:13:25 +01:00
Edwin Brady
35f23ac1d6
Merge pull request #1712 from edwinb/MarcelineVQ-elab-name-changes
Add more name reflections
2021-07-15 14:08:31 +01:00
Edwin Brady
9b0ebcd08b Merge branch 'elab-name-changes' of https://github.com/MarcelineVQ/Idris2 into MarcelineVQ-elab-name-changes 2021-07-15 13:16:47 +01:00
Guillaume ALLAIS
efcf44e8ba [ cosmetic ] use the whole range when underlining the problem 2021-07-15 07:32:43 +01:00
Mathew Polzin
221dadeb20 set default alt error count to 1 and create a config option that sets it to any number. 2021-07-14 20:23:29 -07:00
Mathew Polzin
1f21e787b1 Use commit to reduce the alternative parsing space as soon as an opening paren is encountered. 2021-07-14 17:22:40 -07:00
Edwin Brady
8cd265cf47
Merge pull request #1698 from stepancheg/move-rm-rf-build
Move rm -rf to the beginning of the test
2021-07-14 16:00:46 +01:00
Edwin Brady
5cb77ad675
Merge pull request #1704 from edwinb/with-params
Fix 'with' under implicit parameters
2021-07-14 15:56:58 +01:00
Edwin Brady
1dbc9a7143 Fix 'with' under implicit parameters
The 'with' type and application need to treat the parameters with the
same plicity, but the application has just always treated them as
explicit since it never looked. It's easiest just to make them all
explicit, since this isn't a user visible type. Fixes #1695.
2021-07-14 14:51:52 +01:00
Mathew Polzin
830e5dc12d Fix bug with what value was propagated from rhs of alt parse failure and add test case for '@' as value constructor. 2021-07-14 00:25:02 -07:00
Stiopa Koltsov
9f61e542b4 Move rm -rf to the beginning of the test
While the discussion about how to refactor test framework is not
finished (#1654), make this change: move `rm -rf build` in the
beginning of the test. For these reasons:

* it is useful to inspect the contents of the `build` directory
  especially after the test failure
* if build crashes mid-test (e.g. process killed), next run should
  not be affected by the `build` directory from the previous run
2021-07-13 22:54:53 +01:00
Johann Rudloff
d5abff4e46
[ fix #1260 ] Use blodwen-stringbytelen instead of C's strlen (#1261) 2021-07-13 11:52:15 +01:00
Niklas Larsson
eb0c59c908
Enable incremental compilation on Windows. (#1694) 2021-07-13 11:29:34 +01:00
CodingCellist
80e7e179ad
[ fix #1652 ] Save casefnty to TTC (#1686) 2021-07-13 11:04:07 +01:00
Stiopa Koltsov
1617d95961 System.Errno.strerror
* add `strerror` function
* move `getErrno` to `System.Errno`
* use `strerror` in `Show FileError`
* on node there's no access to `strerror`, so `strerror` just converts the number to string
2021-07-13 10:34:04 +01:00
Mathew Polzin
fd9045bc4a update tests 2021-07-12 23:25:49 -07:00
Edwin Brady
9bd32c4a3d Fix chez033 on windows
This prints lots of warnings since incremental compilation is not
available, so turn that off when running on windows for now.
2021-07-11 17:04:07 +01:00
Edwin Brady
c839c98c7d Add test for incremental compilation
Ideally we'd have a complete incremental build in CI, but that could be
a bit fiddly to set up at the moment (updating bootstrap code might make
it easier). This tests that the basic facilities work, though - there's
a lot can go wrong even in a small test like this, trust me, I have made
those mistakes :).
2021-07-11 00:05:00 +01:00
Edwin Brady
3e92863e1c
Merge pull request #1674 from edwinb/parameters
A couple of parameters block fixes
2021-07-10 21:18:07 +01:00
Edwin Brady
86c75bae2c Add test for interfaces in parameter blocks
I thought these didn't work. Apparently they do. I should find out when
that happened because it might have been a side effect of something
else!
2021-07-10 20:15:50 +01:00
Edwin Brady
b34eade6fb Placate linter again 2021-07-10 19:18:49 +01:00
Edwin Brady
2bd89cee36 Placate linter
It should not care about spacing in tests. Not an issue here in
practice, but who knows if we might want to test a spacing related thing
some day.
2021-07-10 19:17:08 +01:00
Edwin Brady
4ca8caeb13 Fix case split in parameter blocks
We need to make sure variables are bound as PVar, in the end, otherwise
the case split machinery doesn't know how to handle them.
2021-07-10 19:13:27 +01:00
Edwin Brady
26cdfc7830 Make records work in parameter blocks
This involves making 'unelab' aware of nested names so that it can
remove the parameters from names in the current block. It's a bit of a
hacky solution, but it is also the easiest one.
Ideally we'd build the getter types directly, rather than using unelab,
but that's one to save for another time.
Fixes #1482
2021-07-10 18:12:44 +01:00
Stefan Höck
599d0635e9
[ refactor ] JS backend overhaul (#1609) 2021-07-10 11:15:21 +01:00
Zoe Stafford
0ecbd517e8
[ improvement ] VMCode (#1662) 2021-07-07 17:06:59 +01:00
Stiopa Koltsov
8fd58b3bdd More reliable exception handling in Control.App
Convert `App.Control.Exception` interface to an alias to `HasErr`.

Probably `Exception` interface need to be deprecated or removed.

Note similar problem exists with `PrimIO` calling `PrimIO, Exception`,
also need to be fixed.

Fix this scenario:

```
throwBoth : Has [Exception String, Exception Int] es => App es ()

throwOne : Has [Exception Int] es => App es Int
throwOne {es} = handle {err = String} {e = es} throwBoth (\r => pure 1) (\e => pure 3)
```

With this commit it works, before this commit it failed with:

```
Error: While processing right hand side of throwOne. Can't find an implementation for Exception Int (String :: es).

TestException.idr:8:48--8:57
   |
 8 | throwOne {es} = handle {err = String} {e = es} throwBoth (\r => pure 1) (\e => pure 3)
   |                                                ^^^^^^^^^
```
2021-07-06 10:43:54 +01:00
Stiopa Koltsov
fb1d118b2d Test System.system 2021-07-06 09:34:47 +01:00
CodingCellist
fac0e32f48
[ fix ] Chez channels (#1596) 2021-07-02 13:13:50 +01:00
Stefan Höck
f5bcc81115
[ new ] Add FromChar and FromDouble interfaces to the prelude (#1641) 2021-06-29 08:37:02 +01:00
Stiopa Koltsov
35638048a3 Test for System.Info.os 2021-06-29 08:34:53 +01:00
Stefan Höck
6ed266d306
[ new ] Missing integer type interfaces (#1629)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-06-28 20:00:10 +01:00
Tim Engler
05f28724ed
[ fix #1579 ] Nat hack for comparison operators (#1580)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-06-28 16:48:08 +01:00
Kamiλ Shakirov
8e30b296c0
[ refactor ] Remove Data.Strings module (#1607) 2021-06-28 13:48:37 +01:00
Stiopa Koltsov
60d597fccd Use pragma once instead of include guard
Pragma once is supported by all compilers for the last ten years.
Better use it instead of include guards (which use different styles
in different files).
2021-06-28 12:05:22 +01:00
Edwin Brady
d6370380e6 Missing interface methods now cause an error
This was always the intended behaviour, but until now not implemented!
This caught a couple of issues in contrib and a test.
2021-06-27 20:03:19 +01:00
Edwin Brady
d88929ddd7
Merge pull request #1621 from edwinb/incremental-chez
Support for incremental compilation with Chez
2021-06-27 19:29:56 +01:00
Edwin Brady
6c319dbcaf Update API test for new Codegen fields 2021-06-27 16:00:03 +01:00
Jan de Muijnck-Hughes
f77670814e
[ fix ] test Test.Golden with non-idris2 projects. (#1613) 2021-06-25 14:04:46 +01:00
Edwin Brady
a93def90a9 Merge github.com:idris-lang/Idris2 into prepare-040 2021-06-23 18:16:36 +01:00
Edwin Brady
5689786b26
Merge pull request #1598 from gallais/show-void
[ fix ] missing Show implementations in libs
2021-06-23 18:11:40 +01:00
Edwin Brady
7d3e3e0719 Check sizes of buffers and strings in TTCs
They need to be positive or we can't make the buffer, which causes a
segfault. This happened when loading old TTCs with a different format.
Fixes #1503
2021-06-23 18:08:27 +01:00
Edwin Brady
56a9a5866d Update version number in pkg010 test 2021-06-23 17:52:00 +01:00
Edwin Brady
c1057a19af
Merge pull request #1489 from buzden/some-uninhabiteds
[ base ] Some lacking implementations for `Uninhabited`
2021-06-23 16:17:32 +01:00
Guillaume ALLAIS
4d12766886 [ fix ] expected test output 2021-06-23 16:15:35 +01:00
Edwin Brady
4ef29da87e Fix expression search on already solved holes
If it's solved by unification, expression search should just print the
unified value. In fact it almost did this, but wasn't reducing the holes
so the result was being rendered incorrectly.
2021-06-23 00:59:26 +01:00
Edwin Brady
92066c24fe Add timeout for definition/expression search
This is set to 1 second by default. Usually if it hasn't found a result
by then, it never will, but given that we find the first batch of
results then sort them, the timeout also stops us fruitlessly searching
for more solutions.

Hopefully 1s is more than enough for CI too. There is a mechanism to
change the timeout (%search_timeout) so if it turns out that CI needs
longer in some cases, we can increase it there.

I haven't documented this yet, but proof/definition search needs
documenting in general. I'll get to that.

The timer mechanism may also be useful elsewhere - I'm considering it
for ambiguity warnings, because the ambiguity depth limit isn't working
very well for that.
2021-06-23 00:42:51 +01:00
G. Allais
d2986e5fea
[ refactor ] to allow testpools to specify a backend (#1591) 2021-06-21 22:12:17 +01:00
G. Allais
49f8cefeff
[ cleanup ] Test.Golden (#1526) 2021-06-21 17:30:11 +01:00
Edwin Brady
ab2012a7dc Small change in output of reg042
No idea what happened there. Maybe a minor change in the input? Anyway,
this updates it as it should be.
2021-06-21 13:07:26 +01:00
Edwin Brady
e35930a2aa Change reg042 to look at compiler output 2021-06-21 12:41:55 +01:00
Tim Engler
68c6fe222c
[ Fix #1577 ] Actually use natMinus hack (#1578)
And also make sure that the output is truncated to 0.

Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-06-18 11:50:54 +01:00
G. Allais
f3177e0cc1
[ fix ] print postfix projections... postfix (#1557) 2021-06-18 00:00:51 +01:00
CodingCellist
55f8bc3b90
Improve case-splitting formatting to not introduce new whitespace; add a bit of comments+docs. (#1553) 2021-06-17 16:48:59 +01:00
Fabián Heredia Montiel
e0e8403317
[ new ] detect changes using sha256 rather than timestamps (#1535)
The option is hidden being a flag (`-Xcheck-hashes`) so that by default `touch`ing
a file is enough to get it recompiled.

Co-authored-by: Ben Hormann <benhormann@users.noreply.github.com>
2021-06-16 16:16:58 +01:00
Nick Drozd
ec438760d9
Simplify some lambdas (#1561) 2021-06-16 15:22:30 +01:00
Fabián Heredia Montiel
a28bc65544
Fix deadlocks [Rebased, Squashed] (#1536)
Co-authored-by: Arnaud Bailly <arnaud.oqube@gmail.com>
Co-authored-by: Guillaume Allais <guillaume.allais@ens-lyon.org>
Co-authored-by: Fabián Heredia Montiel <fabianhjr@protonmail.com>
Co-authored-by: Ruslan Feizerakhmanov <me@russoul.me>
2021-06-15 14:31:31 +01:00
Denis Buzdalov
927c358bef [ base ] Some lacking implementations for Uninhabited were added 2021-06-15 15:07:54 +03:00
Kamil Shakirov
7692de67aa Allow underscores in integer literals to aid readability 2021-06-15 13:00:53 +01:00
Fabián Heredia Montiel
757f41fbbe [test] Add preformance test of Fin/Vect
Closes idris-lang/Idris2#16
2021-06-14 17:28:58 +01:00
claymager
b946ec0277
[ fix ] Create library dir if necessary (#1300) 2021-06-14 16:12:46 +01:00
CodingCellist
ac31e17636
[ refactor ] Right-align padded numbers. (#1554) 2021-06-14 15:29:20 +01:00
Robert Wright
1875f62248 Remove freeBuffer function
Each backend is now responsible for freeing Buffers in the same way as other objects
2021-06-14 15:06:44 +01:00
Robert Wright
195e690ddc Fix RefC Buffer getInt function to work with large values 2021-06-14 15:06:44 +01:00
Robert Wright
c6a5827319 Add RefC readBufferData/writeBufferData support 2021-06-14 15:06:44 +01:00
Edwin Brady
97ee3d4cd3 Check LHS arguments are polymorphic enough
We already did this, but missed a few cases due to the way arguments are
elaborated. So now, when checking an LHS, we don't allow LHS argument
types to be inferred from the pattern, but rather they must be inferred
from elsewhere. To do this, we keep track of the constraints which would
be solved when inferring the type, and make sure they don't solve any
new metavariables. Fixes #1510, and also now gets the error location
right as a bonus!
2021-06-13 13:31:40 +01:00
Edwin Brady
19cb2681be Only fully normalise fromInteger on LHS
This reduces surprising undefined name errors on the RHS, as noted in
issue #1541
2021-06-12 14:23:25 +01:00
Edwin Brady
06f69ba177 Fix test output
Because it relies on the source file that I've just fixed for the
linter. I think I've now spent more time pleasing the linter than fixing
the actual bug...
2021-06-11 13:02:38 +01:00
Edwin Brady
f923c3677d Please the linter again 2021-06-11 12:46:08 +01:00
Edwin Brady
38bdbfba84 Please the linter
I still don't think it should be looking in test sources. One day I'll
fix this.
2021-06-11 12:43:34 +01:00
Edwin Brady
663a8381f4 Properly normalise constants on LHS
We need to fully evaluate, not just the public export names, otherwise
we don't pattern match properly and potentially generate catch all
patterns we don't mean.

Fixes #1537
2021-06-11 12:37:45 +01:00