Commit Graph

5156 Commits

Author SHA1 Message Date
Andreas Rumpf
0841c64a32 Merge branch 'devel' into araq-quirky-exceptions 2019-02-08 17:18:17 +01:00
Andreas Rumpf
444f2231c9 make tests green again 2019-02-08 16:54:12 +01:00
LemonBoy
aa6e40abe6 Fix wrong result in tuple assignment (#9340)
Fixes #9177
2019-02-08 12:24:03 +01:00
Araq
4ed7507cb2 error messages can have spaces, don't be dyslexic 2019-02-08 12:18:42 +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
LemonBoy
631a8ab57f Fix edge case in type hashing (#10601) [backport]
Empty types introduced by a template produced the same hash of the
"clean" type sharing the same name.
2019-02-08 09:56:32 +01:00
LemonBoy
6b88ce3384 Stop useless suggestion of unsafeAddr (#10598)
Fixes #10594
2019-02-08 08:59:38 +01:00
alaviss
2fdf816332 compiler/[msgs, suggest]: improve highlighter accuracy (#10496)
Previously the compiler would generate suggestions based on the symbol
identifier length, but that might not reflect the actual representation
of it within the actual source code.

This commit implements a simple source scanner for the suggest module to
address the problem outlined above.

Fixes nim-lang/nimsuggest#24
2019-02-07 17:08:15 +01:00
LemonBoy
29fbf111a8 Fix codegen when debugger is enabled (#10595)
Decrement the frame length before closing the parent scope.

Fixes #10589
2019-02-07 17:07:35 +01:00
LemonBoy
f23b0a7dc8 Fix handling of reraise in effect tracking (#10582)
This is the MVP in order not to get a completely useless error message
from the compiler.

Fixes #10579
2019-02-07 17:07:03 +01:00
Araq
84d10f7d8a fixes #10585 2019-02-07 15:04:05 +01:00
Araq
d5da450100 helpers2 now has a real name 2019-02-07 12:12:20 +01:00
Andreas Rumpf
2851f316f6 ignore nkCommentStmt in lambda lifting 2019-02-06 22:00:16 +01:00
Andreas Rumpf
4338f86acb fixes some bug 2019-02-06 22:00:16 +01:00
LemonBoy
294b2e03b2 Reject assignments with nkEmpty RHS (#9000)
Fixes #8997
2019-02-06 21:26:55 +01:00
LemonBoy
864c3e874c Merge pull request #10577 from zielmicha/fix-10568
Fixes #10568: Fix null pointer dereference in address computation for incrSeqV3.
2019-02-06 14:23:24 +01:00
LemonBoy
6c8dee4180 Avoid evaluating macros twice in type sections (#10550)
Fixes #10548
2019-02-06 11:35:44 +01:00
Michał Zieliński
580f62220c Fixes #10568: Fix null pointer dereference in address computation.
According to https://hownot2code.com/2016/08/18/null-pointer-dereferencing-causes-undefined-behavior/ this was an undefined behaviour.
2019-02-06 10:13:44 +01:00
LemonBoy
4c3f841212 Do not raise ProveInit/WanrUninit for .noinit. var (#10566) 2019-02-06 09:14:09 +01:00
Araq
2e880c726b fixes a lexer regression for 'nimble check' 2019-02-05 15:40:03 +01:00
Arne Döring
824f39b32e Vm bitops fixes (#10520) 2019-02-05 09:31:37 +01:00
Araq
9fa116b6e1 compiler: don't use 2 spaces in an error message 2019-02-04 15:59:18 +01:00
Araq
23c11987b4 make the lexer more forgiving so that nim-regex compiles again 2019-02-04 15:59:18 +01:00
Oscar Nihlgård
0091f2ad3b Implement {.booldefine.} (#10533) 2019-02-03 09:06:00 +01:00
Miran
ad4e3fd28c devel docs should point to devel src (#10529)
Currently, devel docs (https://nim-lang.github.io/Nim/lib.html)
source links point to master branch,
leading to outdated source code and showing the wrong line.
2019-02-02 13:23:10 +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
Miran
fa058773db fixes #10042 (allow spaces in import) (#10504)
This allows spaces in imports, by using the following syntax:
* `import "directory with spaces" / subdir / file`, or
* `import "directory with spaces/subdir/file"`
2019-01-31 08:20:00 +01:00
Araq
2ce9845fe4 fixes silly typo causing tons of async regressions 2019-01-30 19:48:21 +01:00
Araq
0a628f36f0 destructors: do not produce strong backrefs in closure environments so that refcounting works 2019-01-30 18:17:49 +01:00
LemonBoy
49710b9d14 The file directive is relative to the file it is in 2019-01-30 10:01:59 +01:00
LemonBoy
9031c8fb0f Make sure the test snippet directory exists 2019-01-30 10:01:59 +01:00
Andreas Rumpf
dee8e6e98a gc: destructors is beginning to work (#10483)
* kochdocs.nim: code cleanup
* docgen: nicer indentation
* parser.nim: code cleanup
* fixes #10458
* make tests green again
* make =destroy mixins
* gc:destructors: produced C code is almost working
* --gc:destructors simple program compiles (but leaks memory)
* gc:destructors make examples compile in C++ mode
* destructors: string implementation bugfixes
* strs.nim: minor code cleanup
* destructors: builtin seqs are beginning to work
* remove debugging helpers
2019-01-29 15:12:16 +01:00
Neelesh Chandola
2b0ed9995d Fixes https://github.com/nim-lang/Nim/issues/8484 (#10470) [backport] 2019-01-28 09:52:48 +01:00
slangmgh
dfa5faea0f Fixes #10352 (#10416) 2019-01-28 09:34:03 +01:00
alaviss
74a7b09412 suggest: quote operators and keywords on suggestion (#10460) 2019-01-28 09:29:49 +01:00
cooldome
690f21043d isLastRead regression fix (#10463)
* fixes #10462

* add a test
2019-01-28 08:32:14 +01:00
alaviss
0b02241fc5 semcall: correct lineinfo for accquoted symbols (#10461) 2019-01-27 14:58:10 +01:00
LemonBoy
3ce6b2acb9 Fix exception tracking in try blocks (#10455)
Exceptions raised inside a nkFinally/nkExcept block are not caught by
the block itself.

Fixes #3886
2019-01-27 10:32:44 +01:00
cooldome
1c2abb8d88 fixes double object field symbol lookups (no test case available) (#10450) 2019-01-25 09:25:11 +01:00
Araq
43613ff49d docgen: style tweak 2019-01-25 09:22:31 +01:00
Araq
3de255541a docgen: do not produce trailing commas for links 2019-01-25 09:21:51 +01:00
Araq
13d667ee53 docgen: produce links for proc names 2019-01-25 09:21:51 +01:00
Araq
46d5fb9ed7 docgen: nicer indentation 2019-01-25 09:21:51 +01:00
Miran
251b014bf4 fix #9556 (#10445)
The old logic wasn't very useful because
`relPath` is almost always shorter than `absPath`,
e.g. `../../../../../` is shorter than `C:\Program Files`.

This way allows the usage of a relative path for
at most two levels deep, e.g. `../../relPath`,
otherwise the absolute path is used.
2019-01-24 14:40:16 +01:00
alaviss
d72921ecf6 compiler/sem: correct macros lineinfo (#10438)
The compiler believes these are where a macro call starts (marked with
`^`):

    m "string"
    ^ ^

This commit addresses that.
2019-01-24 12:22:19 +01:00
Arne Döring
6555d89c2c free some registers after usage, allows more complex macros (#10443) 2019-01-24 11:33:44 +01:00
Araq
28cb81ea87 make DLLs tests compile again; remove dependency on nimbase.h slightly 2019-01-23 22:03:15 +01:00
Araq
400b4e4e0e improve the generated code size for --gc:regions 2019-01-23 22:03:15 +01:00
alaviss
35d96d8749 compiler/sem*: better lineinfo for templates (#10428)
* compiler/sem*: better lineinfo for templates

Lineinfo for templates is inconsistant across the compiler, for example:

    doAssert true
    ^        ^

    a[int](10)
    ^^    ^

The `^` marks where the compiler thinks the template starts.

For qualified call, we got the same situation with `proc`s before #10427:

    system.once
          ^

Generics lineinfo within template declaration is also incorrect, for
example, this is where the compiler believes the `T` in `[T]` is:

    template a[T](b: T)
                  ^

This PR addresses all of these problems.

* nimsuggest: add tests for template highlighting
2019-01-23 16:35:34 +01:00