Commit Graph

824 Commits

Author SHA1 Message Date
André Videla
cc45ff957a
Merge pull request #2085 from andrevidela/string-parser-position
Show the line and column in diagnostic message in String.Parser
2021-11-15 11:09:57 +00:00
Mathew Polzin
d2ce85ea05
Merge pull request #2096 from madman-bob/system-run
Add the `System` `run` function
2021-11-10 08:58:39 -08:00
Robert Wright
2ee10d9b34 Add Alternating List odds and evens functions 2021-11-10 08:40:25 +00:00
André Videla
9e6678e3d3
Merge pull request #2102 from madman-bob/list-singleton
Add List singleton function
2021-11-10 00:46:40 +00:00
André Videla
7f932036e9 Show the line and column in diagnostic message
This also updates the error message of some common combinators
2021-11-10 00:44:09 +00:00
Zoe Stafford
3063218d46
[ new ] Add %nomangle (#2063)
This is (for once) not a breaking changes, instead backends will need to opt in to this change, using the utilities in Compiler.NoMangle. See the js backend for an example of how to do this.

This is the first step to being able to use idris to create libraries usable by other languages.
2021-11-09 16:23:50 +00:00
Edwin Brady
2f6ec76223
Get information about names in reflection (#2110)
* Only normalise a search goal if it's fast

While we do end up normalising it anyway on success, there might be
things blocking it that make the intermediate terms very big, so only do
it speculatively to see if it's quick.

* Get information about names in reflection

Currently this is only whether it's a function, or data or type
constructor. I expect more may be useful/possible.
2021-11-07 15:06:53 +00:00
Robert Wright
921bc24a2a Add List singleton function 2021-11-05 16:08:54 +00:00
Robert Wright
4732486bbc Add System run function 2021-11-05 11:59:17 +00:00
Robert Wright
dc47df688c Add System.File fRead function 2021-11-05 11:59:17 +00:00
Robert Wright
c1fc487bec Return error code from pclose 2021-11-05 11:59:17 +00:00
Robert Wright
c964f8d8bc Add System escapeCmd function 2021-11-05 11:59:17 +00:00
G. Allais
668c221474
[ re #2032 ] faster version of fromInteger (#2090) 2021-11-02 17:43:01 +00:00
G. Allais
15cc8243f7
[ re #2001 ] Make some prelude interfaces total (#2083)
The prelude interfaces that have default definitions for all of
their fields are declared total so that users are forced to think
about meeting the minimal requirements for an implementation to be
valid.
2021-11-02 15:34:52 +00:00
Robert Wright
12955bc5bc Add takeUntil Data.String.Parser parser 2021-11-01 13:54:46 +00:00
Edwin Brady
d531cc8dea
Cumulativity preparation: Add field for universe level to TType (#2076)
* Add field for universe level to TType

This doesn't do anything yet, other than introduce new universe
variables whenever we introduce a new type, but it's the first step
towards checking the universe hierarchy. Next step is to add constraints
when checking pi, unifying/converting types, and when adding data
constructors.

* TTC version increment

Thought I'd done this, but apparently I didn't save the file. Oops!

* Add structure for universe constraints

* Fix display of ambiguity errors

We need to store the Context in errors at the point where the error
occurs, or we might get some nonsense in the message. There's still a
couple of places in Error where we don't do this right. This fixes one
of them, and improves a few messages in the process.
2021-10-31 00:00:16 +01:00
Edwin Brady
2df3ecc2e3
Fix display of ambiguity errors (#2075)
We need to store the Context in errors at the point where the error
occurs, or we might get some nonsense in the message. There's still a
couple of places in Error where we don't do this right. This fixes one
of them, and improves a few messages in the process.
2021-10-30 23:08:53 +01:00
madman-bob
a6a64c6ddf
[ contrib ] Alternating lists of known parity (#2043) 2021-10-30 00:12:44 +01:00
Guillaume ALLAIS
a8d5e005e1 [ fix #2070 ] Look under MaybeMispelling when failing quickly 2021-10-29 17:57:55 +01:00
G. Allais
ac7a4644b8
[ fix #2046 ] only refold positive integers as nats (#2064) 2021-10-26 17:16:31 +01:00
Ellis Kesterton
9c2ce646f9
[ fix #2002 ] implicits used in record update (#2007) 2021-10-26 17:15:29 +01:00
CodingCellist
4a1bb310a7
[ fix #1175 ] case-splitting for inline case blocks (#2010) 2021-10-26 15:51:52 +01:00
Alissa Tung
1bd81dfbbb
[ fix #2053 ] do not show ambiguous private names (#2056)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-10-26 15:51:34 +01:00
G. Allais
b9834978cb
[ re #2041 ] better runtime error for holey expression (#2045) 2021-10-26 12:43:39 +01:00
Mathew Polzin
f078d5f5dc
clean up some deprecations (#2057)
* deprecate Data.Nat.Order.decideLTE

* Add properties for LTE/GTE that produce the difference.

* remove deprecated function now that it is available in the base library.

* remove two deprecated lines.

* remove module deprecated since v0.4.0

* fix prelude reference to renamed primitive.

* finish removing Data.Num.Implementations

* remove deprecated dirEntry function.

* remove deprecated fastAppend. Update CHANGELOG.

* replace fastAppend in test case

* replace fastAppend uses in compiler.

* remove new properties that weren't actually very new.
2021-10-24 12:06:57 +01:00
Giuseppe Lomurno
7f63a0103f Add user hints to expression search 2021-10-24 10:24:22 +01:00
Guillaume ALLAIS
8fde63396e [ fix #1626 ] Empty lines are still lines 2021-10-21 16:00:50 +01:00
Daniel Kröni
aa107a9754
Implemented %noinline (#2027)
* Implemented %noinline

* Removed trailing spaces.

* Added missing case in Reify FnOpt

* Added error message when both %inline and %noinline are set.

* Added test.

* Changed from perror to error
2021-10-19 15:22:36 +01:00
Edwin Brady
75716cd0d1
Fix casts in scheme evaluator (#2011)
* Fix casts in scheme evaluator

We really need test cases for all the primitives before we can use this
evaluator properly. Also test cases that run inside an environment,
which are a bit harder to construct.

* Add the cast fixes to racket support code

* More racket compile time evaluation fixes

We had the chez version of some primtives in the ct-support file. We
need a full set of tests for the primitives here too...
2021-10-16 14:19:26 +01:00
Edwin Brady
cfb7395eac
Add try primitive to reflection library (#2008) 2021-10-16 11:24:12 +01:00
stefan-hoeck
62237f74ea [ fix ] fastConcat for JS backends 2021-10-14 14:58:51 +01:00
Guillaume ALLAIS
1877e66309 [ new ] log sugared term Elab primitive 2021-10-14 14:16:14 +01:00
G. Allais
00ab9573a5
[ re #1944 ] Allow toplevel aliases (#1952)
* [ re #1944 ] Allow simple toplevel aliases
* [ done ] toplevel aliases with arguments
* [ fix ] weird nonsensical test case
* [ fix ] golden test files
2021-10-13 21:55:23 +01:00
André Videla
274954998b
Implement generic interpolation (#1967)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-10-13 17:26:54 +01:00
Zoe Stafford
5c41c81883
Optimise away case statements on unit-y types (#1844) 2021-10-13 15:46:02 +01:00
Guillaume ALLAIS
a507b6dadf [ new ] better docstrings for primitives 2021-10-13 13:17:48 +01:00
Guillaume ALLAIS
d1041cf786 [ more ] Hints for primitive types too! 2021-10-13 13:17:48 +01:00
Guillaume ALLAIS
7ebaa23439 [ new ] list hints attached to a data type 2021-10-13 13:17:48 +01:00
Edwin Brady
dd95a549d5
Fix performance regression #1991 (#1995)
* Normalise types fully at the REPL

It was a bit odd that we only normalised the scope of function types and
not the arguments, and I can't remember the reason for that if there
even was one.

* Better way of using nf_metavars_threshold

If a term is getting big and probably needs normalising, we now have a
sizeLimit flag in quote, so we can use that instead of checking the size
afterwards. This is a handy heuristic for speeding up unification when
there's a term with lots of suspended computation. Fixes #1991
2021-10-11 23:53:52 +01:00
Alissa Tung
e15c78ce9e
[ fix #1970 ] error on mod self ref (#1977) 2021-10-08 10:09:17 +01:00
Zoe Stafford
d4263441b7
[ new ] Some optimisations mainly involving Nat and Fin (#1817)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-10-07 19:21:32 +01:00
Guillaume ALLAIS
0a29d06fea [ fix ] test runner 2021-10-07 16:07:03 +01:00
Guillaume ALLAIS
384c8874c2 [ fix #1979 ] use virtualised locs rather than EmptyFCs
For error reporting purposes it's better to have an (approximate)
virtual location for code that was introduced by the elaborator
than to have an `EmptyFC` that does not help.
2021-10-07 16:07:03 +01:00
Robert Wright
937ab7157c Add Cast to JSON interface implementations 2021-10-06 18:35:25 +01:00
Robert Wright
8c44f423cc Add JSON Show as Idris code interface implementation 2021-10-06 18:35:25 +01:00
G. Allais
7936bf77d7
[ fix #1744 ] Compare names by root rather than UserName (#1975) 2021-10-05 15:06:16 +01:00
Mathew Polzin
ebc340c41e
Merge pull request #1961 from attila-lendvai/fix-test-pkg010
[tests] fix idris2/pk010: make it more roboust
2021-10-03 08:04:31 -07:00
Mathew Polzin
7b19099763
print location of implicit name shadowing with the warning. (#1968)
* print location of implicit name shadowing with the warning.

* move location output to bottom of warning.
2021-10-03 10:15:01 +01:00
Mathew Polzin
fa06e9936b
Warn about unreachable default clauses (#1942)
* so much experimentation

* tests that show preliminary evidence the new stuff is working.

* small amount of cleanup

* more cleanup of various troubleshooting code.

* new test case added.

* only log unreachable indices if there are any.

* when traversing deeper simply skip over defaults since they have already been reviewed.

* Remove fallback clause that the changes in this PR correctly identified as unreachable.

* tidying up more.

* move some common functions to a new Core.Case.Util module.

* refer to case builder and case tree under new parent module.

* update imports to look for CaseTree in new submodule.

* update api ipkg

* remove unneeded application operators.

* remove or comment out unreachable default clauses caught by the changes in this PR.

* a bit of code documentation and renaming for clarity.

* bump previous version in CI.

* fix API usage of Util module.

* Add issue 1079 test cases.

* forgot to add new test cases file.

* remove commented-out lines by request of RefC author.

* Use a SortedSet instead of nubbing a list.

* update new case tree import.

* Update src/Core/Case/Util.idr

Co-authored-by: G. Allais <guillaume.allais@ens-lyon.org>

* remove function with nothing to offer above and beyond a differently named copy of the same code.

* replace a large tuple with a record; discover not all of the tuple's fields were needed.

* fix shadowing warning.

Co-authored-by: G. Allais <guillaume.allais@ens-lyon.org>
2021-10-02 12:55:21 +01:00
Attila Lendvai
e15a859613
[tests] fix idris2/pk010: make it more roboust 2021-09-29 18:42:20 +02:00
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