Commit Graph

201 Commits

Author SHA1 Message Date
Edwin Brady
a130952928 Switch buffers back to scheme FFI
It's just easier to deal with the memory management! But we should do
something more flexible here later.
2020-05-17 22:49:41 +01:00
G. Allais
306aea32b8
[ test ] add test for defaulting peculiarity (#376) 2020-05-16 00:43:17 +01:00
Edwin Brady
87c54caa27 Do compiling/inlining per module
Compiled and inlined code is now written to the ttc, to save having to
compile everything at the end even if some definitions don't need
recompiling.
2020-05-14 11:42:09 +01:00
Edwin Brady
f5962e1ea4 Update test output 2020-05-13 19:06:22 +01:00
Edwin Brady
1b36dd99b1 Move putChar, getChar etc primitives to C
Back ends can still shortcut these and use their own primitives, but
doing things this way gives consistent behaviour between the simple IO
primitives and file IO, and allow us to use stdin/stdout consistently
(e.g. to flush stdout).
This also fixes the behaviour of 'replWith' to be consistent with the
Idris 1 version.
2020-05-13 11:09:05 +01:00
Edwin Brady
e7d0b33e64 Do another round of inlining, and io_bind
A big cost in IO heavy programs is io_bind, and we can often inline it
away and turn it into just sequencing operations. Things have to be
lined up right to do that though - ideally, case inlining and the
newtype optimisation will know just a little bit more to be able to do
it automatically, but for now, the inliner treats io_bind as a special
case.

Also do another round of inlining, since lots more things can become
inlinable (io_bind especially, becoming fully applied to the %World)
after the first pass.
2020-05-12 11:33:29 +01:00
Edwin Brady
0c1e428435 Fix laziness bookkeeping in unification
Need to note we can't add a laziness coercion under 'unifyInvertible',
which is where we unify things under metavariables which are known to
stand for constructor forms. Fixes #360
2020-05-09 19:19:26 +01:00
Edwin Brady
6fcf861bc1 Change argument unification order
Solving later arguments first means that they can refer to solutions of
earlier arguments. This isn't really the best solution for ensuring that
metavariables refer to things defined earlier, but it helps, and it does
fix #304.
2020-04-28 11:31:18 +01:00
Matus Tejiscak
82a23afae7 Add compatibility with the original record update syntax. 2020-04-27 18:02:25 +02:00
Edwin Brady
2fd1c40056
Merge pull request #314 from MarcelineVQ/using-fix
'using' multiple named instances in scope fix
2020-04-27 15:16:12 +01:00
Edwin Brady
c75af6d116 Update test output 2020-04-27 14:45:06 +01:00
Edwin Brady
e208ea7129
Merge pull request #298 from ziman/records
RFC: Dot syntax for records
2020-04-27 14:28:19 +01:00
Edwin Brady
c95c4c6c0c
Merge branch 'master' into prelude-inline-doc 2020-04-27 13:38:29 +01:00
Edwin Brady
1262ca2fde
Merge branch 'master' into records 2020-04-27 13:36:18 +01:00
Edwin Brady
b9907fbb21
Merge pull request #254 from jfdm/literate-modes
Enhance literate mode to recognise multi-modes.
2020-04-27 13:33:55 +01:00
Edwin Brady
ff86f6f834 Implement occurs check properly (finally!)
Instead of the previous unreliable hack, actually look for occurrences
of the solved metavariable. Block if there are any, and fail if there
are any under a constructor. I had expected this to hurt performance
quite a bit, but it seems it doesn't.
This was prompted by #304, which is now partly fixed, but there's still
a refinement to unification needed to fix it fully (and at least it
doesn't segfault due to the cycle now!)
2020-04-27 12:17:45 +01:00
Edwin Brady
4947a9981a Fix lambda multiplicity check
A bug found via the very handy, but occasionally bad for performance so
off by default, --debug-elab-check. The multiplicity of a lambda type
needs to be checked against the expected multiplicity, not the given
multiplicity. Oops!

If you have any (\0 x => e) or similar, you may find you need to fix a
type error after this update...
2020-04-24 22:28:52 +01:00
Matus Tejiscak
07bb57d3a1 Stop using :exec in record004. 2020-04-24 19:14:22 +02:00
Matus Tejiscak
4baa09a7de Sidestep the question of printing floats. 2020-04-24 19:10:23 +02:00
Edwin Brady
819c9d7af1 Evaluate primitives (fromInteger etc)
At least as long as the number is small enough (currently set to < 100).
This is because it can open up further evaluation opportunities when
typechecking, and can make the term we're working with smaller - it also
makes display a bit neater.
Overall this makes some pathological cases of terrible performance much
better, without hurting anything else.
2020-04-23 21:21:08 +01:00
MarcelineVQ
896cd486d1 update 'using' regression test
have implementation 'using' regression test also check for multiple named implementations
2020-04-22 16:53:02 -07:00
Jan de Muijnck-Hughes
e091ca5701
Update tests/idris2/literate012/expected
Co-Authored-By: G. Allais <guillaume.allais@ens-lyon.org>
2020-04-22 20:37:07 +01:00
Kamil Shakirov
1d2250062b Fix tests 2020-04-22 11:56:08 +06:00
Matus Tejiscak
934cb29a80 Fix paths in record004. 2020-04-21 23:45:55 +02:00
Matus Tejiscak
e49364ff56 Merge branch 'master' into records 2020-04-21 23:11:40 +02:00
Matus Tejiscak
cb02395acb Rename record003 to record004. 2020-04-21 22:56:20 +02:00
Jan de Muijnck-Hughes
af27bce2e2 Enhance literate mode to recognise multi-modes.
While Bird Style literate mode is useful, it does not lend itself well
to more modern markdown-like notations such as Org-Mode and CommonMark.

This commit extends Idris2's existing literate mode to recognise both
'visible' and 'invisible' code blocks and lines in predefined markdown
styles.

The styles and their elements are:

+ Bird Style :: `>` denotes a visible code line, `<` a hidden code
                line.

+ OrgMode :: Org Mode source blocks for idris are recognised as
             visible code blocks, and comment blocks are invisible
             code blocks. Invisible code lines are denoted with
             `#+IDRIS:`.

+ CommonMark :: Only code blocks denoted by standard code blocks
                labelled as idris are recognised.

For backwards compatibility, we recognise literate modes by file
extension:

+ Bird Style :: `.lidr`
+ OrgMode :: `.org`
+ CommonMark :: `.md`

In future we should add support for literate `LaTeX` files, and more
intelligent processing of literate documents using a pandoc like
library in Idris such as: [Edda](https://github.com/jfdm/edda).
2020-04-21 19:27:46 +01:00
Edwin Brady
2b6000ecac Shuffle some tests around
Making sure that tests which use chez are run after we've checked chez
is installed
2020-04-21 12:03:49 +01:00
Edwin Brady
2ad1621a3e Regression test for using named implementations 2020-04-21 11:51:44 +01:00
Edwin Brady
71cae356e2
Merge pull request #281 from ziman/fix-cast-double-int
Fix cast to integral types
2020-04-21 11:24:09 +01:00
Edwin Brady
627d2c2f2b
Merge pull request #292 from ohad/fully-abstract-records
Fully abstract records
2020-04-21 10:59:51 +01:00
Edwin Brady
8a0063a016
Merge pull request #280 from gallais/comments
[ fix #279 ] comment delimiters with more than one dash
2020-04-21 10:49:24 +01:00
Edwin Brady
1734841275 Add a lambda lifter
It's not actually used as part of any compilation pipeline yet, and I've
only tested it by eyeballing the output, but it'll be useful soon, and
it's good for it to be available to any new back ends that might need
it. It will need some optimisation.
2020-04-19 22:57:10 +01:00
Matus Tejiscak
f37d69ceb7 Add tests/idris2/record003. 2020-04-18 14:04:30 +02:00
Matus Tejiscak
2d02899679 Adjust some tests. 2020-04-18 12:19:17 +02:00
Ohad Kammar
767d9dc5f3 Add tests for default implict record type arguments 2020-04-17 12:22:36 +01:00
Ohad Kammar
aa451022b5 Add tests for fully abstract records in Idris and Yaffle 2020-04-16 02:49:32 +01:00
Matus Tejiscak
b5689e5b25 Disable tests relying on cast-string-int. 2020-04-14 22:44:18 +02:00
Matus Tejiscak
4827d0447b Add division tests. 2020-04-14 22:01:31 +02:00
Matus Tejiscak
c7fe4f1a63 Update the expectation file. 2020-04-14 21:36:14 +02:00
Matus Tejiscak
b20ae8d36b Add a test. 2020-04-14 21:30:04 +02:00
Guillaume Allais
f10edd51f5 [ fix #279 ] comment delimiters with more than one dash 2020-04-14 14:13:38 +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
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
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