Commit Graph

659 Commits

Author SHA1 Message Date
LemonBoy
e89aaaeaab Open a new scope for static: expr blocks (#10649)
Bring this in line with how plain blocks are analysed and avoids codegen
errors if one references variables defined in such a block.
2019-02-23 12:05:07 +01:00
Andreas Rumpf
ea409fb15a first steps in implementing 'owned' pointers; undocumented, do not use 2019-02-23 08:44:08 +01:00
LemonBoy
6b88ce3384 Stop useless suggestion of unsafeAddr (#10598)
Fixes #10594
2019-02-08 08:59:38 +01:00
LemonBoy
294b2e03b2 Reject assignments with nkEmpty RHS (#9000)
Fixes #8997
2019-02-06 21:26:55 +01:00
cooldome
1c2abb8d88 fixes double object field symbol lookups (no test case available) (#10450) 2019-01-25 09:25:11 +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
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
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
Federico Ceratto
095eaacf21 Fix spelling errors (#10379) 2019-01-19 16:01:27 +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
Araq
ab99bdfc40 fixes #10136 2019-01-13 14:56:50 +01:00
Neelesh Chandola
387831d657 Show error when trying to export individual enum field (#10109) 2019-01-07 16:02:47 +01:00
zah
87f8ec5b92 Fix #10073 (#10218) 2019-01-07 12:10:54 +01:00
Neelesh Chandola
e77dd683eb Fix defer not not-working at top level (#10191) 2019-01-07 00:51:17 +01:00
Neelesh Chandola
9faad7591e Deprecate gc v2 (#10151)
* Deprecate gc v2

* warnDeprecated now has custom messages
2019-01-01 13:50:48 +01:00
deech
e87910197a Check there are no side effects before optimizing away compile time expressions. (#9934) 2018-12-31 14:41:24 +01:00
Araq
e874705971 fixes nested gensym'ed parameters; fixes #9476 2018-12-08 13:30:06 +01:00
Araq
1711a60f7b fixes #9868 2018-12-05 16:16:58 +01:00
Timothee Cour
9a2736d999 fix #8289 (#9828) 2018-11-30 09:09:32 +01:00
Arne Döring
2f13d27720 improve line info retreival (#9822)
* improve line info
* fix error message
2018-11-30 08:12:11 +01:00
Arne Döring
56c4a4ae1f fix #9759 (#9789) 2018-11-23 16:19:35 +01:00
Araq
2418d0cac5 fixes #9743 2018-11-19 11:28:06 +01:00
cooldome
c5c4da4f3c Converter bug fixes (#9700)
* Fixes #9698
* Fixes #9699
2018-11-15 13:14:48 +01:00
Andreas Rumpf
6e8ed8c6fa added first version of a nimfind tool for the poor souls that don't have a good nimsuggest integretation 2018-11-14 16:04:54 +01:00
Arne Döring
b306e0bfe2 feedback injected 2018-11-08 22:28:29 +01:00
Arne Döring
a147166710 fix #8335 2018-11-08 22:28:29 +01:00
PMunch
e9ed4dccb6 Quote do now works with result in block (#7343)
* Fix result not being able to use in quote do

This fixes the annoying issue of not be able to use result inside a
quote do block. It works by a simple trick. The quote do mechanic is
based on dynamically creating a template and immediately calling it with
the arguments found within the quote do block. Since this is called in
the scope of the macro the result variable is shadowed. This trick works
by changing all occurences of result (which shouldn't cause any issues
as result isn't used for anything else for the same reason) to another
name and then passing in an IdentNode with result as a named parameter
with that name.

Note that currently this just replaces it with a fixed named variable
"res" which should be changed to a non-colliding, dynamically created
name.

* Fix hard coded parameter "res" to anonymous symbol

This fixes the hard coded parameter "res" to be an anonymous symbol
instead so it won't collide with other parts of the argument list.

* Add test case for result in quote do block

A simple test case based on GitHub issue #7323 on how you can't put
result in a quote do block. This test verifies that it actually works
correctly now.

* Add test for explicit capturing of result

* Rebased against devel
2018-10-31 22:14:29 +01:00
Mamy Ratsimbazafy
5b97762787 Openmp parallel iterator improvements (#9493)
* More flexibility in OpenMP pragma
* Use static to constrain to compile-time annotation string
* Update changelog with OpenMP change
2018-10-25 18:09:35 +02:00
Araq
c844a9169c fixes #9498, typeof is for everybody 2018-10-25 13:04:51 +02:00
LemonBoy
6ef198e07b Relax the restrictions on the index types (#9412) 2018-10-18 11:08:05 +02:00
Andreas Rumpf
0d48bafcf0 fixes a regression about indexing into UncheckedArray 2018-10-16 20:09:12 +02:00
Araq
f8e805a614 fixes #2760 2018-10-15 10:43:56 +02:00
LemonBoy
4808ef72db [WIP] Early evaluation of mIs (#8723)
* Early evaluation of mIs

The `evalIs` implementation was just a broken copy of `isOpImpl` so
let's just avoid it alltogether: `mIs` nodes are either resolved during
the semantic phase or bust.

* Remove dead code and tidy it up
2018-10-14 08:53:41 +02:00
Timothee Cour
745f1642d6 implement sizeof and alignof operator (manually squashed #5664) (#9356) 2018-10-14 00:52:28 +02:00
LemonBoy
166720bdf9 Make sure the annotation for || is avail. at CT (#9354)
Closes #9353
2018-10-14 00:00:21 +02:00
xzfc
8fc7cecfa2 compiler: show name of instantiating context in error traces (#6763) (#9207) 2018-10-11 09:34:56 +02:00
LemonBoy
0ead36dae6 Unchecked arrays now have their own type (#9267) 2018-10-10 21:03:18 +02:00
Andreas Rumpf
9c6dde1b70 Merge pull request #8990 from LemonBoy/fix-8259
Always check the deduced type validity for result
2018-09-17 22:45:12 +02:00
Andreas Rumpf
3467c455c0 fixes #1616; fixes 'nim doc' regressions 2018-09-17 19:54:56 +02:00
LemonBoy
3588240226 Always check the deduced type validity for result
Fixes #8259
2018-09-17 15:33:44 +02:00
Andreas Rumpf
84d122b5c8 extended system.type/typeof to support an upcoming 'collect' macro that works much better than sugar.lc 2018-09-11 19:02:05 +02:00
LemonBoy
e69d8ec416 Fix type comparison in semConv (#8907)
Fixes #8905
2018-09-07 21:06:30 +02:00
Andreas Rumpf
1948eadc24 change runnableExamples implementation; fixes #8641; fixes #7135; runnableExamples works for templates and generics 2018-09-02 22:56:26 +02:00
Andreas Rumpf
df4d5b77a1 introduce precise string '[]', '[]=' accessors; fixes #8049 (#8817) 2018-08-30 23:01:15 +02:00
Andreas Rumpf
361a2d830a enforce the condition of a 'when' condition to be of type bool; refs #8603 2018-08-23 17:54:04 +02:00
Araq
30597e643f fixes merge conflict 2018-08-23 11:30:55 +02:00
LemonBoy
a87341775a Don't consider tyAnd/tyNot/tyOr/tyAnything as generic (#8700)
* Don't consider tyAnd/tyNot/tyOr/tyAnything as generic

`containsGenericType` was too shallow and didn't check all the branches.
The resulting half-processed nodes are often simplified by the constant
folding pass but when that's not possible we get a nasty error during
codegen.

Fixes #8693

* Move the blame onto the semFold pass

Slightly better evaluation of `is` forms.
2018-08-22 09:40:31 +02:00
Andreas Rumpf
ddaf2e3805 some progress on destructors for builtin seqs 2018-08-20 17:59:47 +02:00
Araq
96c6c82d55 fixes #8425 2018-08-04 20:10:03 +02:00