Commit Graph

5122 Commits

Author SHA1 Message Date
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
Vindaar
d9ee377517 fix #10339 by returning type attached to nkEmpty (#10370)
* fix #10339 by checking for nkObjConstr

* revert check for nkObjConstr, return type from nkEmpty node

The correct type needed in `semObjConstr` to fix #10339 is indeed
available, but attached to an `nkEmpty` node. These were previously
discarded in `semTypeNode`, which is used to extract the type for the
object.

* simplify return of PType from  `nkEmpty`

* also fixes #9866, add test case
2019-01-23 11:17:32 +01:00
Ico Doornekamp
efa4b9adaa Fixes #10263; [backport] 2019-01-23 11:13:44 +01:00
LemonBoy
9c0e5c4c07 Harmonize the var/let and const handling (#10410)
Fixes #10333
2019-01-23 11:10:51 +01:00
Ico Doornekamp
7fcf51248b Added --docInternal option to allow 'nim doc' to include non-exported symbols 2019-01-23 11:09:26 +01:00
Andreas Rumpf
2655f242a8 use the lastRead analysis; it's correct by construction, not a mess of special cases and seems to be just as fast as the old algorithm 2019-01-23 11:08:51 +01:00
Andreas Rumpf
112f7e650a destroyer.nim: code cleanup 2019-01-23 11:08:51 +01:00
Andreas Rumpf
1b0372c6e9 make tests green again 2019-01-23 11:08:51 +01:00
Andreas Rumpf
11022fea1b control flow graphs: introduce 'join' points for easy analyses based on abstract interpretation 2019-01-23 11:08:51 +01:00
alaviss
e962be8981 compiler/sem*: improve lineinfo for qualified and generic procs (#10427)
Previously the compiler will believe these are where `newSeq` symbol
starts:

    newSeq[int]()
          ^
    system.newSeq[int]()
                 ^

This commit moves them back to:

    newSeq[int]()
    ^
    system.newSeq[int]()
           ^
2019-01-23 09:24:21 +01:00
LemonBoy
eee9729f53 Fix semantic analysis with noReturn proc in tail pos (#10422)
Fixes #10417
2019-01-23 07:30:49 +01:00
Ray Imber
94f6a6b294 Fix for issue #10342. better message for generic subclass instantiation (#10354)
* Fix for issue #10342. better message for generic subclass instantiation errors.
2019-01-22 17:05:26 -08:00
LemonBoy
53eda40d40 Restore compatibility with old vcc versions [backport] (#10415)
Local variables are declared before anything else.

Fixes #10352
2019-01-22 22:38:52 +01:00
LemonBoy
6825430831 Restrict ptr/ref to ptr/ref implicit conversion (#10411)
* Restrict ptr/ref to ptr/ref implicit conversion

Fixes #10409

* Make the ptr conversions explicit in db_odbc
2019-01-22 11:17:20 +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
LemonBoy
3ea099bc7f Finalizer proc must be global (#10388)
Fixes #10376
2019-01-22 07:35:52 +01:00
genotrance
4b1e227531 Fix gorge caching (#10407) 2019-01-22 06:24:45 +01:00
LemonBoy
ee89ba6bdb Fix subtype conversion w/ varargs arguments (#10402)
The type matching is done on the `T` of the `varargs[T]` so the
conversion must be performed to `T` and not to the whole type.

This problem is only noticeable with the cpp backend since C doesn't
give a damn shit about your fucking (wrong) types.

Fixes #9845
2019-01-21 19:12:17 +01:00
LemonBoy
ae5d8fbd9d Proper check for tyStatic[T] -> U conversions (#10382)
Drop the outer tyStatic shell then perform the check.

Fixes #7609
2019-01-21 17:27:36 +01:00
Oscar Nihlgård
a4cdd25b19 Support system.reset in vm (#10400) 2019-01-21 17:00:33 +01:00
alaviss
413755fd45 Correct lineinfo for accent quoted symbols in proc definition (#10399)
* compiler/parser: preserve lineinfo for accent quoted symbols

Previously the lineinfo for symbol $$$ in this example is:

    proc `$$$`
             ^

After this commit:

    proc `$$$`
          ^

* compiler/semstmts: correct lineinfo for accent quoted idents

Previously nimsuggest would highlight this as:

    proc `$$$`
         ^~~

After this commit:

    proc `$$$`
          ^~~

* nimsuggest/tests: add a test for accent quoted proc

Disabled by default
2019-01-21 16:57:48 +01:00
Oscar Nihlgård
9a003bae06 Fix error lexer error messages for to large numbers (#10394) 2019-01-21 15:14:38 +01:00
Federico Ceratto
095eaacf21 Fix spelling errors (#10379) 2019-01-19 16:01:27 +01:00
Timothee Cour
27e2ed4375 fix #9629 every binary cmd line option allows on/off/empty=on (#10353)
* fix #9629 every binary cmd line option allows on/off/empty=on

* workaround refs #10359
2019-01-18 09:03:26 +01:00
cooldome
1e63f1edb3 destructors: first step towards fixing #9617 (#10341) 2019-01-18 08:51:22 +01:00
LemonBoy
15584879b9 Properly wrap discarded statements (#10322)
Failing to do so lead the codegen to emit invalid code sometimes,
especially when C++ references were involved.

Fixes #10241
2019-01-17 07:55:29 +01:00
nepeckman
7920dc2898 Added support for --genDeps on JS backend (#10320) 2019-01-15 22:58:44 +01:00
Timothee Cour
beed27b75d improve vmgen.codeListing formatting (#10306)
* improve vmgen.codeListing formatting
* address comments
2019-01-15 19:02:01 +01:00
Timothee Cour
4355f23ee5 fix #10305 nim cpp is now nan-correct at CT (#10310)
* fix #10305 nim cpp is now nan-correct at CT
* add example where simply `nim cpp -d:release` would exhibit nan bug
2019-01-15 14:50:28 +01:00
Andreas Rumpf
05c52ff34f fixes #10203 (#10290)
* fixes #10203
* make typredef test green again
* fixes the regressions differently
2019-01-15 10:15:27 +01:00
Neelesh Chandola
8922063bd8 typed/untyped return type is invalid for everything except templates and macros (#10275) 2019-01-15 08:08:12 +01:00
Timothee Cour
0a8762eb7b fix #9842 #9951: nim -r and parseopt.cmdLineRest are now correct 2019-01-14 17:00:54 -08:00
Timothee Cour
e17321aa24 improve formatting in assertEquals 2019-01-14 17:00:54 -08:00