Commit Graph

659 Commits

Author SHA1 Message Date
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
Edwin Brady
a75887ffa6 Update error018 test output 2021-06-10 12:42:54 +01:00
Edwin Brady
18c7e2c4da Merge github.com:idris-lang/Idris2 into normalise-tweaks 2021-06-10 12:22:02 +01:00
Edwin Brady
7d235272e3 Remove redundant converstion checks in Pi types
We've already checked argument and scope types, so only need to check
mulitplicities. This saves a lot of repetition when checking lambdas.
2021-06-10 12:19:41 +01:00
CodingCellist
abd5432885
[ fix ] indentation of impossible clauses (#1520) 2021-06-08 17:03:06 +01:00
Robert Wright
aa94dd2351 Add RefC Char pattern matching support 2021-06-07 15:15:37 +01:00
Ruslan Feizerakhmanov
7aee7c9b7c
[ new ] --install-with-src; refactoring around FCs (#1450)
Why:

* To implement robust cross-project go-to-definition in LSP
  i.e you can jump to definition of any global name coming
  from library dependencies, as well as from the local project files.

What it does:

*  Modify `FC`s to carry `ModuleIdent` for .idr sources,
   file name for .ipkg sources or nothing for interactive runs.

*  Add `--install-with-src` to install the source code alongside
   the ttc binaries. The source is installed into the same directory
   as the corresponding ttc file. Installed sources are made read-only.

*  As we install the sources pinned to the related ttc files we gain
   the versioning of sources for free.
2021-06-05 12:53:22 +01:00
Stefan Höck
baa6051d69
[ fix ] use twos complement truncation for signed ints (#1471) 2021-06-04 10:35:07 +01:00
Edwin Brady
48f3825266
Merge pull request #1501 from edwinb/hash-fix
Read import hashes correctly
2021-06-03 23:13:10 +01:00
Edwin Brady
5fa272b8bf Read import hashes correctly
Need to use the 8 byte version of Ints for the shortcut version of
reading TTCs too, otherwise we'll read the wrong hash and build things
unnecessarily.
2021-06-03 21:57:10 +01:00
G. Allais
9e7625e613
[ log ] more readable output for elab.ambiguous (#1500) 2021-06-03 18:19:08 +01:00
madman-bob
98d67499db
RefC Integer Support (#1480)
* Add utility functions to treat All as a heterogeneous container
* Distinguish RefC Int and Bits types
* Change RefC Integers to be arbitrary precision
* Add RefC Bits maths operations
* Make RefC div and mod Euclidean
* Add RefC bit-ops tests
* Add RefC integer comparison tests
* Add RefC IntN support
2021-06-03 10:44:42 +01:00
Stefan Höck
eccce3b7b1
[ fix ] Memoize intermediary results in JS backends (#1494) 2021-06-03 10:20:07 +01:00
Zoe Stafford
24f7c9d5be
Add foldMap to Foldable (#1483) 2021-06-01 15:05:04 +01:00
Guillaume ALLAIS
6df80ffee9 [ cleanup ] tests/Main.idr import list 2021-05-29 11:19:42 +01:00
Guillaume ALLAIS
6f839240c5 [ warn ] holes are not shadowed by implicits 2021-05-27 17:18:09 +01:00
Fabián Heredia Montiel
30c178c815
[ feature ] Implement -Werror (WarningsAsErrors) (#1466)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-05-27 09:23:20 +01:00
Edwin Brady
1329e69b5d
Merge pull request #1469 from edwinb/issue1365
Cache intermediate results in totality checking
2021-05-26 16:29:57 +01:00
Edwin Brady
a9b754e9fa Remove whitespace again
Didn't I just do this? Grr.
2021-05-26 15:54:57 +01:00
Edwin Brady
9cce0e1340 Remove whitespace in test file 2021-05-26 15:52:21 +01:00
Edwin Brady
68f6f4dbd5 Cache intermediate results in totality checking
This saves a lot of unnecessary exploring of size change graphs, which
can get over the top quite quickly if there's complex mutual
definitions, or even just a single function with an interesting variety
of recursive calls.

Fixes #1365
Fixes #1277
Fixes #645
2021-05-26 15:48:09 +01:00
Ben Hormann
1aefab3af0 [ fix ] nproc missing for non-GNU systems 2021-05-26 09:05:13 +01:00
Fabián Heredia Montiel
f1085b98a5 [ test #18 ] Add passing tests from issue to avoid regressions 2021-05-25 23:07:59 +01:00
Fabián Heredia Montiel
704a2525f1 [ fix #55 ] Propagate linear context from Definition to Clauses 2021-05-25 19:27:02 +01:00
Mathew Polzin
a0a417240e
Simple signal handling (#1458) 2021-05-25 16:45:46 +01:00
stefan-hoeck
6f90e5d2e2 [ test ] node test for System.getArgs 2021-05-25 13:26:42 +01:00
Kamiλ Shakirov
ad656a8d47
Remove realpath (#1457) 2021-05-25 11:01:28 +01:00
Guillaume ALLAIS
6904cf5db6 [ :doc ] Adding projections to the record doc 2021-05-21 18:23:13 +01:00
G. Allais
e9f5038cb7
[ fix ] Version encoding should be stable (#1443) 2021-05-21 10:04:27 +01:00
Robert Wright
5aef7a2dff fixup! 04dfba03 2021-05-20 14:25:16 +01:00
Robert Wright
c57bb5a65f Add RefC StringIterator support 2021-05-20 14:25:16 +01:00
Robert Wright
cd3906645b Add RefC getArgs support 2021-05-20 14:25:16 +01:00
Robert Wright
f3aae06b28 Add RefC Clock support 2021-05-20 14:25:16 +01:00
Robert Wright
cf2b05ce02 Add RefC Buffer support 2021-05-20 14:25:16 +01:00
Robert Wright
204b96fe6c Add RefC math library linking 2021-05-20 14:25:16 +01:00
Robert Wright
c34c6e0959 Complete RefC standard String support
- Fix off-by-one error in String reverse
- Correct order of arguments in strSubstr
- Actually use start index of strSubstr
- Reduce memory usage of strSubstr in case of overrunning string end
- Add fastPack/fastUnpack/fastConcat
- Use unsigned chars for character comparisons
- Fix generated C character encodings
2021-05-20 14:25:16 +01:00
Ohad Kammar
618c71477e
[ close #1384 ] built-in Snoc-lists [< 1, 2, 3 ] (#1383) 2021-05-20 12:56:25 +01:00
Guillaume ALLAIS
31a5175a02 [ re #1031 ] Disallow ? patterns on the LHS
We do this during desugaring because elaboration may insert valid
`?` values on the LHS (e.g. when elaborating things that cannot be
pattern-matched on and should be checked to be forced).
2021-05-20 10:23:00 +01:00
Edwin Brady
7f210b52aa Inline small metavariables
Where 'small' means they don't refer to other metavariables, except
right at the top level, and they don't go beyond a certain small depth,
arrived at by experimenting.

We already did a bit of this, but only for depth 0. The effect of this
is that we don't need to save out lots of metavariables, so ttc loading
is faster. This takes about 8s off the Idris build time!
2021-05-18 17:56:36 +01:00
Guillaume ALLAIS
2f66f3e006 [ test ] case for the fix 2021-05-17 22:27:28 +01:00
Guillaume ALLAIS
ac4b31b41f [ fix #1421 ] Use resolved names for the impossible LHS 2021-05-17 21:06:37 +01:00
Edwin Brady
70d8e4b337 Merge github.com:idris-lang/Idris2 into unify-postponing 2021-05-15 20:10:43 +01:00
Edwin Brady
45fc100f6c Store postponed unification problems as values
We stored them as equations between terms, I think because terms are
easy to re-evaluate with new information, and because I thought we might
want to save them out. It's not usually a problem to do that. However...
Going back and forth between terms and values can be expensive if
we're stuck in the middle of a complicated unification problem, the like
of which can turn up a lot if your types are complicated. So, we need to
be able to handle this.
Now store the postponed problems as NF, rather than Term, and add a
fuction to resume evaluating a NF with an updated context.
2021-05-15 20:03:33 +01:00
G. Allais
349308396c
[ fix #621 ] add warnings for shadowed global definition (#1407) 2021-05-14 17:35:21 +01:00
Edwin Brady
c87a6d52bb
Merge pull request #1400 from edwinb/tweak-cg
Some compilation/code generation improvements
2021-05-14 16:09:09 +01:00
Guillaume ALLAIS
4917d124aa [ fix ] highlighting of tuples 2021-05-14 13:47:35 +01:00
Guillaume ALLAIS
3610464a10 [ fix ] record projections 2021-05-14 13:47:35 +01:00
Zoe Stafford
7fe8c42116
[ builtin ] O(1) integerToNat for any 'Nat'-like type (#1403) 2021-05-13 18:44:24 +01:00
Johann Rudloff
2477d060a8 Use sysctl instead of nproc to get number of processors on FreeBSD
On FreeBSD `nproc` is not available in a standard installation, so the
equivalent `sysctl -n hw.ncpu` is used.
2021-05-13 18:27:57 +01:00
Guillaume ALLAIS
210026061d [ fix ] Handle ambiguous DPair/MkDPair 2021-05-13 18:26:06 +01:00
Edwin Brady
1d762d4920 Print constructor labels correctly 2021-05-13 16:09:12 +01:00
Edwin Brady
f21a495711 Merge github.com:idris-lang/Idris2 into tweak-cg 2021-05-11 11:37:12 +01:00
Edwin Brady
efaf290d88 Calculate whether an inlining is safe
It's safe if all top level arguments are used at most once, meaning that
there's no risk of duplication.
2021-05-11 11:29:01 +01:00
G. Allais
004cc45e9d
[ test ] cosmetic changes & retest capability (#1394)
* Banners for test pools
* Summary with the list of failing tests at the end
* Option to write the list of failing tests to a file
* Option to read the list of tests to run from a file
* Using these two latest features to add a new make target to rerun precisely the tests that failed last time
2021-05-11 09:46:21 +01:00
G. Allais
ab241213f3
[ breaking ] making toList part of Foldable (#1395) 2021-05-11 08:26:00 +01:00
Matúš Tejiščák
4de7b2133a
[ new ] Add chez-sep codegen (#1359)
Co-authored-by: Johann Rudloff <johann@sinyax.net>
2021-05-11 08:20:19 +01:00
Stefan Höck
f028981e5a
[ fix #801 ] Use Number for up to 32 bit integers on JS backends (#1375) 2021-05-10 12:17:09 +01:00
Zoe Stafford
8a7aeca1b0
[ builtin ] O(1) natToInteger for any 'Nat'-like type (#1363) 2021-05-10 12:14:19 +01:00
Guillaume ALLAIS
08d61d70c4 [ fix #1370 ] use the lambda's type for eta-expansion 2021-05-10 12:13:29 +01:00
Zoe Stafford
25ae664ef6
[ fix #1378 ] Collect constructors after inlining (#1380) 2021-05-10 11:19:18 +01:00
Ohad Kammar
e58bcfc7ef
Semantic highlighting (#1335)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-05-10 09:05:43 +01:00
Edwin Brady
251d77b92d Swap 'False' and 'True' constructors
It has always bothered me that 'False' got mapped to tag 1 and 'True'
got mapped to tag 0. This doesn't change much in practice (except that
perhaps a code generator might notice some useful things in intToBool)
but I'm changing it now anyway. Also added a couple of inlinings of
boolean operations.
2021-05-09 20:08:38 +01:00
Edwin Brady
e8eab6d763 Flag records and option types
This saves a small amount of allocation, especially since we never
actually look at the tag in a record. We can use null? for Nothing just
like for Nil.
2021-05-09 16:49:59 +01:00
Edwin Brady
fafa76c55c Generalise NIL/CONS to all list shaped things
Also pairs turn into CONS, because we don't need to look at the tag if
there's only one constructor.
2021-05-09 01:43:59 +01:00
Edwin Brady
4389224694 Merge github.com:idris-lang/Idris2 into caseofcase 2021-05-08 18:19:21 +01:00
Edwin Brady
66930113bd Compile lists as scheme lists
This also involves adding a flag to constructors and case alternatives
in CExp which say whether it's a NIL or CONS. Currently, we only do this
for Prelude.List, which already has an effect, but soon I'll extend this
to work for all list-shaped things and rather than being hard coded. We
could also imagine spotting other shapes (enumerations especially) for
code generators to spot as they see fit.

This will require code generators to be fixed to recognise the new
ConInfo flag, but you can just ignore it.

Bootstrap code also updated, because we don't currently have a way of
having separate support.ss/rkt for the bootstrap and normal builds!
2021-05-08 15:42:51 +01:00