Commit Graph

73 Commits

Author SHA1 Message Date
Stefan Höck
2739c3a389
[ codegen ] more flexible array implementation on JS backends (#2966) 2023-05-14 06:45:50 +01:00
Mathew Polzin
ad12f8335c
[ new ] popen/pclose for the NodeJS backend. (#2857)
* implement popen and pclose (to an extent) for NodeJS

* bring node020 back into tests.

* ah, I see what was being done here. Fix the idris for the test.

* fix test's unreachable clause warning

* fix expectation

* Add note to CHANGELOG

* small tweaks to get popen into merge-ready state.
2023-01-30 09:38:42 -06:00
Stefan Höck
57c589ca80
[ performance ] More stack safety in the Prelude (#2704) 2022-10-26 09:54:53 +01:00
stefan-hoeck
eb7b7912b9 [ test ] fix node args test 2022-09-27 08:28:01 +02:00
Zoe Stafford
86c060ef13
Reimplement %nomangle in terms of %export (#2604)
* Reimplement %nomangle in terms of %export
Also deprecate %nomangle

* [ lint ] fix linter errors
2022-08-15 13:26:06 +01:00
Nil Geisweiller
719b5ad17f
[ cleanup ] Remove extraneous show and simplify printLn (#2618) 2022-08-10 21:22:58 +01:00
G. Allais
84a504738c
[ doc ] add comments to generated javascript (#2594) 2022-07-18 17:30:56 +01:00
Zoe Stafford
8c7fc581c6 Fix prim__div_Double on Node/js backend
problem was found by @kuruczgy on the idris discord

Also add tests
2022-03-26 19:00:46 +00:00
Denis Buzdalov
e8d3d788c1
[ base ] Add some more properties, functions and interface implementations (#2361) 2022-03-23 13:33:13 +00:00
G. Allais
35b2362487
[ new ] failing blocks (#2360) 2022-03-23 12:01:13 +00:00
stefan-hoeck
405f80946b [ fix ] euclidian div and mod for JS backend 2022-03-08 17:40:29 +00:00
James Cook
e82600c4d6
[ opt ] transform rule making List.length tail-recursive. (#2100) 2022-01-24 16:12:29 +00:00
Edwin Brady
26a47ddafe
Make prim_js2idris_array iterative (#2267)
I was getting a stack overflow on the tailrec002 test, caused by this
primitive being recursive. I've made it iterative. I'm no JS expert but
I've tested its behaviour against the old version.
2022-01-16 19:15:26 +00:00
Steven Dunham
e8660cab97 [ tests ] Add test case for #2243 2022-01-07 21:53:46 -08:00
alissa-tung
158cb1c75e [ nodejs ] pid 2021-12-22 22:25:21 +08:00
Denis Buzdalov
a09c5082c5
[ base ] Use Fin n as index in Bits (#2192) 2021-12-16 18:26:52 +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
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
Robert Wright
c1fc487bec Return error code from pclose 2021-11-05 11:59:17 +00:00
stefan-hoeck
62237f74ea [ fix ] fastConcat for JS backends 2021-10-14 14:58:51 +01:00
Zoe Stafford
5c41c81883
Optimise away case statements on unit-y types (#1844) 2021-10-13 15:46:02 +01:00
James Cook
971afa9f5d
Add a transform rule making (++) for List tail-recursive. (#1888) 2021-09-16 15:35:29 +01:00
stefan-hoeck
281ae86ece [ fix ] string casts on js backends 2021-09-10 08:48:29 +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
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
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
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
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
Stefan Höck
599d0635e9
[ refactor ] JS backend overhaul (#1609) 2021-07-10 11:15:21 +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
Kamiλ Shakirov
8e30b296c0
[ refactor ] Remove Data.Strings module (#1607) 2021-06-28 13:48:37 +01:00
claymager
b946ec0277
[ fix ] Create library dir if necessary (#1300) 2021-06-14 16:12:46 +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
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
Stefan Höck
eccce3b7b1
[ fix ] Memoize intermediary results in JS backends (#1494) 2021-06-03 10:20:07 +01:00
stefan-hoeck
6f90e5d2e2 [ test ] node test for System.getArgs 2021-05-25 13:26:42 +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
Stefan Höck
6cdf05f1ec
[ new ] Add Int(8/16/32/64) (#1352)
This adds new `Int8`, `Int16`, `Int32` and `Int64` data types
to the compiler, thus working towards properly specified integer
types as discussed in #1048.

In addition, the following changes / corrections are made:

* Support casts from `Char`, `String`, and `Double` to all integer
  types (and back). This fixes #1270.
* Make sure that all casts to limited-precision integers are properly
  bounds checked (this was not the case so far for casts from `String`
  and `Double` to `Int`)
* Add a thorough set of tests to make sure all bounds checks work
  correctly for all supported casts and arithmetic operations
2021-05-04 08:22:06 +01:00
Sören Tempel
c725b11c89 Flush standard out after writing prompt to it
On Unix-like operating systems stdio.h is usually line-buffered. As
putStr uses fputs(3) from stdio.h internally, output will be written to
standard out after a newline character is written to the buffer. Since
the prompt does not contain a newline, it will only be written to
standard output after the user presses return. I encountered this issue
on Alpine Linux which uses musl libc (instead of glibc). However, I
believe this issue is likely also reproducible with glibc. This commit
fixes this issue by flushing standard output after writing the prompt to
it. Surprisingly, `src/Idris/IDEMode/REPL.idr` already does this
correctly, `src/Idris/REPL.idr` does not though.
2021-04-09 15:17:00 +01:00
Stefan Höck
8d4321eb9a
Add Data.Bits to base (#1033) 2021-03-04 20:59:56 +00:00
G. Allais
d2eeb7ce86
[ fix #758 ] desugar non-binding sequencing in do blocks to (>>) (#1095) 2021-02-24 11:07:16 +00:00
Stefan Hoeck
7401961425
[ new ] Bitwise XOR for Bits64 and Integer (#1026) 2021-02-16 15:14:56 +00:00
Andy Lok
bb1edab3aa Show more codes in error report 2021-02-12 18:37:12 +00:00
stefan-hoeck
f50b22548f tests for bitops 2021-02-08 15:47:23 +00:00
stefan-hoeck
1104776430 fix 1037 2021-02-08 15:47:23 +00:00
stefan-hoeck
606bc577b5 fixed whitespace for *.sh 2021-01-22 15:08:49 +00:00
Johann Rudloff
043336ba5c [ fix #959 ] ES Codegen: Add casts from integer types to double
A new test is included to verify the cases mentioned in the original
issue.
2021-01-21 12:28:40 +00:00
Stefan Hoeck
fb08004041
removed trailing whitespace (#955) 2021-01-21 11:33:03 +00:00
Stiopa Koltsov
b76c9d91e0 Remove trailing whitespaces and add trailing newlines 2021-01-16 10:00:03 +00:00