Commit Graph

128 Commits

Author SHA1 Message Date
Andreas Rumpf
142a2d3551 added system.default in order to prevent the abstraction inversion that 'template default(T): untyped = (var x: T; x)' causes 2019-03-05 09:54:59 +01:00
Andreas Rumpf
c5dbb0379f disable compile-time FFI support 2019-02-23 11:34:39 +01:00
Timothee Cour
adbabf145c FFI at CT (#10150)
* enable FFI at CT
* rename useFFI=>nimHasLibFFI; improve formatting rawExecute traceCode
* disable libffi on windows (works for win32, not yet win64)
2019-02-23 11:31:01 +01:00
Arne Döring
28394153ab 32 bit fixes (#10608) 2019-02-13 23:30:14 +01:00
LemonBoy
710cfcecd3 Rework exception handling in the VM (#10544)
* Rework exception handling in the VM

Make the safepoint handling more precise and less forgiving.
The new code is clearer and more commented.
Perform cleanup on `return`.
The no-exception-thrown case in a try block should be slightly faster
since we don't parse the whole set of exceptions every time.
More tests.

* Fix silly error that broke a few tests

* Testament doesn't like files having the same name

* Remove test case that failed compilation to js
2019-02-08 11:57:47 +01:00
Arne Döring
b80dbdb77d Fix vm signed xor (#10519)
* fix #10482

* undo changes

* fix for bitwise not

* remove dead opcode
2019-02-01 12:12:10 +01:00
cooldome
1d5437e9d2 vm fix for bitwise signed ints (#10507)
* fixes #10482

* add missing file

* bug fix
2019-01-31 19:48:39 +01:00
LemonBoy
9c0e5c4c07 Harmonize the var/let and const handling (#10410)
Fixes #10333
2019-01-23 11:10:51 +01:00
Neelesh Chandola
226c15499f Fix compileTime pragma applying to whole var/let section (#10389) 2019-01-22 07:55:11 +01:00
LemonBoy
44c04b3571 Object downconversion in VM should not copy (#10378)
Hopefully the type-check phase already rejected all the invalid
conversions by the time we execute the VM bytecode.

Problem reported by chrisheller on the Nim Forum
2019-01-22 07:36:40 +01:00
Oscar Nihlgård
a4cdd25b19 Support system.reset in vm (#10400) 2019-01-21 17:00:33 +01:00
Timothee Cour
6ce3949c8a add isNamedTuple; make $(1, 2) be (1, 2) instead of (Field0: 1, Field1: 2) which leaked implementation detail (#10070)
* add `isNamedTuple`; make $(1, 2) be (1, 2) instead of leaking implementation detail (Field0: 1, Field1: 2)
  fixes this: #8670 (comment) /cc @alehander42 @Vindaar @mratsim

* Note: isNamedTuple is useful in other places, eg #10010 (comment)

* move isNamedTuple to helpers.nim to avoid exposing new symbol to system.nim

* remove workaround in tests/vm/tissues.nim failing test now that #10218 was makes it work
2019-01-08 18:37:25 -08:00
deech
e87910197a Check there are no side effects before optimizing away compile time expressions. (#9934) 2018-12-31 14:41:24 +01:00
Timothee Cour
c4e3c4ca2d add getCurrentCompilerExe to vmops (eg allows to get nim compiler at CT); add tests for vmops (#9925) 2018-12-18 09:07:12 +01:00
Araq
3b783f7e13 Testament: refactoring; makes the test joiner green 2018-12-11 21:23:23 +01:00
Arne Döring
a5ecbf823f lots of small changes 2018-12-11 21:23:22 +01:00
Arne Döring
2a4c09ff88 megatest can be executed 2018-12-11 21:23:21 +01:00
Arne Döring
1105d03644 require errormsg to be specified before file. 2018-12-11 21:23:21 +01:00
Timothee Cour
f838b1e6c1 fix #9872: setLen now works properly at CT [backport] 2018-12-08 14:33:42 -08:00
Araq
562d185cb7 cleanup tests; don't use non-working 'msg' spec field 2018-11-23 13:16:45 +01:00
Arne Döring
be553e691b more eyewash 2018-11-23 11:58:31 +01:00
Arne Döring
e012eb1001 updated tests to be executed 2018-11-23 11:58:28 +01:00
Arne Döring
031bfdec6f make run the default action of a test in tester 2018-11-23 11:58:28 +01:00
Randy Smith
6c7abe6e5b Fixes #9671 (#9750) 2018-11-19 09:22:21 +01:00
cooldome
8c1083d3b7 Of operator in vm fixes [backport] (#9717)
* fixes #9701
*  fixes #9702
* optimize of statement to bool
2018-11-15 13:03:42 +01:00
Ian
5ddeead29c #9348 Merge some small test files (#9561)
* Consolidated types issue tests
* Consolidated vm issue tests
2018-10-30 06:30:39 +01:00
Utwo
a68a4bfaf2 Remove install.txt and readme.txt (#9521)
* Remove install.txt and readme.txt

* Refactor tests that use readme.txt

* Tests open own source code
2018-10-28 13:36:52 +01:00
Arne Döring
2fa13040b9 Merge pull request #9496 from cooldome/vm_float_casts
VM: add int <-> float casts of the same size
2018-10-28 11:56:30 +01:00
Kaushal Modi
f8cef575b3 Improve dumpLisp macro (#9515)
* Improve dumpLisp macro

- Remove commas from the lisp representation of the AST.
- Make the dumpLisp output "pretty" and indented.
- Improve docs of `dumpTree` and `dumpLisp` macros.

With:

    dumpLisp:
      echo "Hello, World!"

Output before this commit:

    StmtList(Command(Ident("echo"), StrLit("Hello, World!")))

Output after this commit:

    (StmtList
     (Command
      (Ident "echo")
      (StrLit "Hello, World!")))

* Re-use the traverse proc inside treeRepr for lispRepr too

- Add module-local `treeTraverse` proc.
- Also fix treeRepr/dumpTree not printing nnkCommentStmt node contents.

* More doc string updates

* Allow unindented lispRepr output for tests

* Update a test affected by the lispRepr change

* Fix dumpTree

* Add note about lispRepr and dumpLisp to changelog [ci skip]
2018-10-27 14:10:05 +01:00
Andrii Riabushenko
a54e0703a9 Add test 2018-10-24 20:29:51 +01:00
Miran
749dbce4c6 Merge tests into a larger file (part 5 of ∞) (#9368)
* merge magics

* merge metatype tests

* merge method tests

* merge objects tests

* change `import future` to `import sugar`

Nim in Action tests are left with `import future`, to ensure compatibility.

* merge overload tests

* merge proc tests

* merge procvar tests

* merge range tests

* merge seq tests

* merge sets tests

* remove wrong assert from `tsets3`

* fix `jsTests`

* better fix
2018-10-16 10:50:10 +02:00
LemonBoy
ee14ace5d3 Field checks for everybody (#8957)
* Field checks for JS backend

* Clean nkCall nodes with no arguments

Generating a nkEmpty in place of no arguments makes no sense form the
AST point of view and also trips up the VM codegen.

* Field checks for VM backend

* Test case for #6612

This patchset fixes #6612

* Add test case for LHS double evaluation

* Prevent LHS double-eval for JS backend

* Prevent double evaluation in VM backend
2018-10-09 19:54:12 +02:00
LemonBoy
fb54f394e8 Fix for VM codegen with static[T] types
Fixes #9043
2018-09-23 18:17:00 +02:00
Andreas Rumpf
a5d014233a Merge pull request #8996 from LemonBoy/fix-2574
The VM cannot call methods
2018-09-18 10:29:49 +02:00
LemonBoy
c2e5faf959 The VM cannot call methods
Fixes #2574
2018-09-17 19:14:13 +02:00
LemonBoy
027cc5013e Fix error during field access in VM
Tuple constructors can't have nkExprColonExpr but may contain NimNodes
of that kind.

Fixes #4952
2018-09-17 18:52:40 +02:00
Araq
cfbf9dcc59 fixes #8740 2018-09-03 09:06:52 +02:00
Araq
f91a181f58 make tests green again 2018-08-13 23:16:03 +02:00
Andreas Rumpf
975114e114 make more tests green 2018-08-13 13:02:52 +02:00
Oscar Nihlgård
931273cc6b Fix ref bug in vmgen (#8424) 2018-07-30 22:28:24 +02:00
Oscar Nihlgård
7ae9c4358e Fix vm regression (#8163) 2018-06-30 13:38:52 +02:00
Oscar Nihlgård
d146045ed5 Fixes #6689 (#8135) 2018-06-30 09:16:46 +02:00
Oscar Nihlgård
ae69e571e1 VM regression fixes (#8146) 2018-06-29 16:00:53 +02:00
Andreas Rumpf
ccb1514837 Merge pull request #8108 from LemonBoy/fix-5958
Make `static` blocks introduce their own scope
2018-06-26 23:16:40 +02:00
Oscar Nihlgård
236bc06b5f Improve vm support for ref types 2018-06-26 21:25:27 +02:00
LemonBoy
f559e62e45 Adjust some tests to make them pass
The non-scoped behaviour of static blocks was exploited by those tests,
replace all the variables declared whithin one with compileTime marked
ones.
2018-06-25 15:56:13 +02:00
Oscar Nihlgård
440212a154 Fix for newStringOfCap in VM (#7901) 2018-06-04 13:38:26 +02:00
Oscar Nihlgård
7cf87dfac6 VM fix for refs 2018-05-08 17:00:00 +02:00
genotrance
c3cc52087f Added a few useful os calls to VM (#7440) 2018-04-12 13:59:14 +02:00
Arne Döring
6baca58693 Get symbol kind (#7491) 2018-04-11 16:48:01 +02:00