Commit Graph

4544 Commits

Author SHA1 Message Date
Clyybber
4b9eea2fcc Fix forward declarations in shadow scope contexts (#15386)
* Fix forward declarations in shadow scope contexts

* Add testcase for #15385

* Less empty lines

* Fix tests

* Inline isShadowScope

* Add original testcase (with reduced amount of iterations)

* Add testcase without forward decl
2020-09-22 18:24:13 +02:00
Andreas Rumpf
1fae66e4df better nativestacktrace support; refs #15284; backport [1.2] (#15384)
* nimStackTraceOverride: enable stack traces in exceptions

This is a two-step stack trace collection scheme, because re-raised
exceptions will collect multiple stack traces but use them rarely, when
printing info about an uncaught exception, so it makes sense to only do
the cheap stack unwinding all the time and the relatively expensive
debugging information collection on-demand.

`asyncfutures` implements its own `$` proc for printing
`seq[StackTraceEntry]`, so we have to add the debugging info there, just
like we do for the private `$` proc in `system/excpt`.

* cleaned up PR #15284

Co-authored-by: Ștefan Talpalaru <stefantalpalaru@yahoo.com>
2020-09-22 13:03:24 +02:00
Clyybber
d67c5cb751 Add strutils.indentation and make unindent use it (#15264)
* Add strutils.indentation and make unindent use it

* Code style

* Fix bootstrapping

* Improve wording

* Fix test

* Introduce without breaking change

* Fix

* Reduce diff

* Fix docs link

* Add since annotation

* Update changelog
2020-09-22 10:43:12 +02:00
flywind
40a868bccc add testcase for #6060 (#15366)
* add testcase for #6060

* Remove overspecific testament spec

Co-authored-by: Clyybber <darkmine956@gmail.com>
2020-09-21 13:37:14 +02:00
flywind
6c83eb48c2 add testcase for #7165 (#15368)
* add testcase for #7165

* Remove overspecific testament spec

Co-authored-by: Clyybber <darkmine956@gmail.com>
2020-09-21 13:32:05 +02:00
Andreas Rumpf
c2434d939e fixes #15360 [backport:1.2] (#15378) 2020-09-21 12:35:23 +02:00
flywind
0a1e4cad7f add testcase for #9710 (#15365)
* string is not nil anymore

* tatus
2020-09-21 12:21:05 +02:00
Andreas Rumpf
4d75059e8b added a basic ORC test I still had lying around (#15376) 2020-09-20 22:47:48 +02:00
Araq
cdac67376c arc: added tmarshal.nim test case 2020-09-20 10:43:57 +02:00
Araq
33be7c6f5e arc: =deepcopy fixes 2020-09-20 10:43:57 +02:00
Andreas Rumpf
ebb632ccba fixes #15369 (#15371) 2020-09-20 01:07:13 +02:00
Andreas Rumpf
d19316bbb9 more ORC bugfixes (#15355)
* introduced --define:nimArcIds

* ORC: bugfixes
2020-09-18 11:55:58 +02:00
jcosborn
e56d50d747 fix infinite recursion in typeRel (#15241)
* fix generic constraints

Co-authored-by: James Osborn <osborn@Jamess-MacBook-Pro.local>
2020-09-18 11:21:37 +02:00
Andreas Rumpf
bc9967f05a Revert "Introduce explicit copy (#15330)" (#15346)
This reverts commit a3e9cc5234.
2020-09-16 23:24:17 +02:00
cooldome
d938c6411e fix #15326 (#15341) 2020-09-16 21:37:23 +02:00
cooldome
341be0b61c proc params as syms (#15332)
* proc params are now syms

* Fix typesrenderer

* Add testcase for disrupteks issue

* fix test

* Trigger build

* Trigger build

* Trigger build

Co-authored-by: Clyybber <darkmine956@gmail.com>
2020-09-16 17:25:24 +01:00
cooldome
a3e9cc5234 Introduce explicit copy (#15330) 2020-09-16 17:26:45 +02:00
Andreas Rumpf
ae4ede6b00 fixes #15325 (#15340) 2020-09-16 17:26:13 +02:00
Andreas Rumpf
fd31e8ff6f allow old styled RTTI for arc/orc (#15331) 2020-09-16 14:57:01 +02:00
Andreas Rumpf
bc179ccc3f fixes #15076 (#15329) 2020-09-15 12:40:23 +02:00
Andreas Rumpf
c38487aa22 fixes a critical ORC bug, refs #15076 (#15323) 2020-09-14 12:50:23 +02:00
flywind
e111b610ca test cookies with comma for #15319 (#15322)
* test cookies with comma for #15319

* space
2020-09-14 12:20:42 +02:00
Jaremy Creechley
6c49767a6c Fixing issue #15302 -- lwip doesn't support signals (#15303)
* Fixing issue #15302 -- lwip doesn't support signals

* Adding test to catch issue #15302 -- lwip/freertos net library
don't try to build / run on windows, it'll compile only but not run

Fixing issue #15302 -- reworking test to compile on other platforms
2020-09-14 08:57:49 +02:00
Andreas Rumpf
1df5cfba52 fixes #15147 (#15315) 2020-09-12 23:11:38 +02:00
Clyybber
60ad95f799 Add testcase for invalid if statement (#15313) 2020-09-12 14:28:19 +02:00
Clyybber
1881fc5812 Fix #15305 (#15311)
* Fix #15305

* Fix test
2020-09-12 12:39:46 +01:00
Andreas Rumpf
0c41ac792b fixes #15122 (#15301) 2020-09-11 01:50:42 +02:00
Andreas Rumpf
9a110047cb testament improvement: allow inline error messages inside test cases (#15294)
* testament support for inline error messages
* adapt teffects1.nim test to show the potential
2020-09-10 16:30:20 +02:00
cooldome
61c85e034d Fix #15286 (#15292)
* fix #15286

* fix spacing
2020-09-10 12:40:39 +02:00
Andreas Rumpf
3f00a738db fixes #15280 [backport:1.2] (#15281)
* fixes #15280 [backport:1.2]

* make tests green again

* adapt tests
2020-09-09 14:20:10 +02:00
Andreas Rumpf
217675cf84 borrow checking refinements (#15290)
* added basic borrowing test
2020-09-09 14:19:22 +02:00
Ivan Bobev
ccd77b42af Add some enhancements to jsonutils.nim (#15133)
* Add some enhancements to `jsonutils.nim`

* Use `jsonutils.nim` hookable API to add a possibility to deserialize
  JSON arrays directly to `HashSet` and `OrderedSet` types and
  respectively to serialize those types to JSON arrays.

* Also add a possibility to deserialize JSON `null` objects to Nim
  option objects and respectively to serialize Nim option object to JSON
  object if some or to JSON `null` object if none.

* Move serialization/deserialization functionality for `Table` and
  `OrderedTable` types from `jsonutils.nim` to `tables.nim` via the
  hookable API.

* Add object `jsonutils.Joptions` and parameter from its type to
  `jsonutils.fromJson` procedure to control whether to allow
  deserializing JSON objects to Nim objects when the JSON has some
  extra or missing keys.

* Add unit tests for the added functionalities to `tjsonutils.nim`.

* improve fromJsonFields

* Add changelog entry for the jsonutils enhancements

* Add TODO in `jsonutils.nim`

* Added an entry to "Future directions" section in `jsonutils.nim` as
  suggestion for future support of serialization and de-serialization of
  nested variant objects.

* Added currently disabled test case in `tjsonutils.nim` for testing
  serialization and de-serialization of nested variant objects.

* Move JSON hooks to `jsonutils.nim`

Move `fromJsonHook` and `toJsonHook` procedures for different types to
`jsonutils.nim` module to avoid a dependency of collections modules to
the `json.nim` module.

The hooks are removed from the following modules:

  * `tables.nim`

  * `sets.nim`

  * `options.nim`

  * `strtabs.nim`

* Add some tests about `StringTableRef`

Add tests for `StringTableRef`'s `fromJsonHook` and `toJsonHook` to
`tjsonutils.nim`.

* Disable a warning in `jsonutils.nim`

Mark `fun` template in `jsonutils` module with `{.used.}` pragma in
order to disable `[XDeclaredButNotUsed]` hint. The template is actually
used by the `initCaseObject` macro in the same module.

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
2020-09-09 14:18:59 +02:00
flywind
8c82144ba5 add getprotobyname (#15273)
* add getprotobyname

* tests, docs, changelog

* add since
2020-09-09 12:47:22 +02:00
Clyybber
f3552b86c1 Better semiStmtList parsing (#15123)
* Better semiStmtList parsing
* Add examples from forums and wiki
* Move parseIfExpr near parseIfOrWhen
* Update grammar
2020-09-09 07:36:31 +02:00
Andreas Rumpf
10988d4840 borrow checking (#15282)
* refactoring: move procs to typeallowed.nim
* frontend preparations for first class openArray support
* prepare the code generator for first class openArray
* code generation for first class openArray; WIP
* code generation for open arrays, progress
* added isViewType proc
* preparations for borrow checking
* added borrow checking to the front end
2020-09-09 07:32:03 +02:00
Miran
c49b88163c "for-loop macros" are no longer an experimental feature (#15288) 2020-09-08 14:25:25 +02:00
Scott Wadden
098a8a7c52 nimeval errorHook support (#15255) 2020-09-07 20:05:07 +02:00
flywind
e08b802d79 more Protocol supports in windows (#15274) [backport:1.2] 2020-09-07 12:10:20 +02:00
Andreas Rumpf
2f6d04fd5d strict funcs: use control flow information for a more precise analysis (#15271)
* strict funcs: use control flow information for a more precise analysis

* cursor inference uses control flow information
2020-09-06 22:01:39 +02:00
Clyybber
35ff17410f Expand hoisted default params in sem (#15270)
* Expand hoisted default params in sem
Introduce ast.newTree{I,IT}
Add test for default params in procs

* Cleanup

* Simplify hoist transformation and expand test
2020-09-05 22:01:47 +02:00
cooldome
77df02313d fix #15238 (#15262)
* fix_15238

* fix test
2020-09-04 10:26:14 +02:00
Miran
4fb17bc03b fix #15257, toHex couldn't handle large uint64 (#15261) [backport:1.2] 2020-09-04 09:23:27 +02:00
Andreas Rumpf
ff13f8cc3c fixes #15210 [backport:1.2] (#15237)
* fixes #15210 [backport:1.2]

* use patched version of bigints library
2020-08-31 14:46:23 +02:00
cooldome
f8c48fc186 fix #15035 (#15236) 2020-08-28 17:57:52 +02:00
Clyybber
fb58066b61 Fix #5691 (#15158)
* Fix #5691
* Cleanup and thoughts
* Use scope approach
* Seperate defined/declared/declaredInScope magics
* Fix declaredInScope
* Update spec accordingly
2020-08-27 15:50:59 +02:00
jcosborn
d11933ad99 fix some issues overloading with generics and inheritance (#15211)
* fix some issues overloading with generics and inheritance

* fix passing procs with subtype matches
2020-08-27 12:56:38 +02:00
Bung
7cee63bba3 avoid #8231, bitwise move to mul,div (#15070)
* avoid #8231, bitwise move to mul,div

* add test for #8231

* fix bitwise move when div result is float

* bitwise move depends on typ.size
2020-08-25 09:58:32 +02:00
Miran
15ff89cec1 [backport] fix #15064, strscans.scanf edge case for '$+' (#15223) 2020-08-25 09:57:15 +02:00
Elijah Shaw-Rutschman
8a004e2fc0 Add test coverage for atomics (#15193)
* Add test coverage for atomics

Signed-off-by: Elijah Shaw-Rutschman <elijahr@gmail.com>

* Fix compareExchange bugs for non-trivial objects

Bugs fixed:

1. compareExchange would not set the desired value in the success case.
2. compareExchange would not set var expected to the found value in the failure case.
3. withLock would spin forever running the unit tests. try..body..finally prevents this. Not sure why this makes a difference, since an exception wasn’t being raised, but clearing the guard in a finally block seems correct anyways.

Signed-off-by: Elijah Shaw-Rutschman <elijahr@gmail.com>
2020-08-18 18:02:10 +02:00
jcosborn
e194cb41a4 fix overloading issue with generic invocation (#15135)
* fix overloading issue with generic alias

* add test for inheritance depth
2020-08-18 08:23:19 +02:00