summary refs log tree commit diff stats
path: root/tests/ccgbugs
Commit message (Collapse)AuthorAgeFilesLines
* handle explicit generic routine instantiations in sigmatch (#24010)metagn2024-09-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fixes #16376 The way the compiler handled generic proc instantiations in calls (like `foo[int](...)`) up to this point was to instantiate `foo[int]`, create a symbol for the instantiated proc (or a symchoice for multiple procs excluding ones with mismatching generic param counts), then perform overload resolution on this symbol/symchoice. The exception to this was when the called symbol was already a symchoice node, in which case it wasn't instantiated and overloading was called directly ([these lines](https://github.com/nim-lang/Nim/blob/b7b1313d21deb687adab2b4a162e716ba561a26b/compiler/semexprs.nim#L3366-L3371)). This has several problems: * Templates and macros can't create instantiated symbols, so they couldn't participate in overloaded explicit generic instantiations, causing the issue #16376. * Every single proc that can be instantiated with the given generic params is fully instantiated including the body. #9997 is about this but isn't fixed here since the instantiation isn't in a call. The way overload resolution handles explicit instantiations by itself is also buggy: * It doesn't check constraints. * It allows only partially providing the generic parameters, which makes sense for implicit generics, but can cause ambiguity in overloading. Here is how this PR deals with these problems: * Overload resolution now always handles explicit generic instantiations in calls, in `initCandidate`, as long as the symbol resolves to a routine symbol. * Overload resolution now checks the generic params for constraints and correct parameter count (ignoring implicit params). If these don't match, the entire overload is considered as not matching and not instantiated. * Special error messages are added for mismatching/missing/extra generic params. This is almost all of the diff in `semcall`. * Procs with matching generic parameters now instantiate only the type of the signature in overload resolution, not the proc itself, which also works for templates and macros. Unfortunately we can't entirely remove instantiations because overload resolution can't handle some cases with uninstantiated types even though it's resolved in the binding (see the last 2 blocks in `texplicitgenerics`). There are also some instantiation issues with default params that #24005 didn't fix but I didn't want this to become the 3rd huge generics PR in a row so I didn't dive too deep into trying to fix them. There is still a minor instantiation fix in `semtypinst` though for subscripts in calls. Additional changes: * Overloading of `[]` wasn't documented properly, it somewhat is now because we need to mention the limitation that it can't be done for generic procs/types. * Tests can now enable the new type mismatch errors with just `-d:testsConciseTypeMismatch` in the command. Package PRs: - using fork for now: [combparser](https://github.com/PMunch/combparser/pull/7) (partial generic instantiation) - merged: [cligen](https://github.com/c-blake/cligen/pull/233) (partial generic instantiation but non-overloaded + template) - merged: [neo](https://github.com/andreaferretti/neo/pull/56) (trying to instantiate template with no generic param)
* remove nontoplevel type hack + consider symbol disamb in type hash (#23969)metagn2024-08-161-0/+9
| | | | | | | | | | | | | | fixes #22571 Removes the hack added in #13589 which made non-top-level object type symbols `gensym` because they couldn't be mangled into different names for codegen vs. top-level types. Now we consider the new `disamb` field (added in #21667) of the type symbols in the type hash (which is used for the mangled name) to differentiate between the types. In other parts of the compiler, specifically the [proc mangling](https://github.com/nim-lang/Nim/blob/298ada3412c9cf5971abc2b3b891b9bb8612e170/compiler/mangleutils.nim#L59), `itemId.item` is used instead of the `disamb` field, but I didn't use it in case it's the outdated method.
* [backport] fixes #23796; remove extra indirection for args in importc'ed ↵Alexander Kernozhitsky2024-07-061-0/+25
| | | | | functions in cpp (#23800) fixes #23796
* fixes #9940; genericAssign does not take care of the importC variables in ↵ringabout2024-06-262-2/+33
| | | | | refc [backport] (#23761) fixes #9940
* fixes openarray hoist with gcc 14 (#23647)ringabout2024-06-041-1/+2
| | | | | | | blocks https://github.com/nim-lang/Nim/pull/23673 --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fixes regression #23280; Operations on inline toOpenArray len return a wrong ↵ringabout2024-02-061-0/+10
| | | | | result (#23285) fixes #23280
* Fix reset code gen for range types (#22462, #23214) (#23215)Giuliano Mega2024-01-181-0/+20
| | | | | | This PR modifies `specializeResetT` so that it generates the proper reset code for range types. I've tested it in the examples for issues #23214 and #22462 as well as our codebase, and it seems to fix the issues I had been experiencing.
* fixes #22286; enforce Non-var T destructors by `nimPreviewNonVarDestructor` ↵ringabout2023-11-251-2/+1
| | | | | | | | | | | | | | | | | | (#22975) fixes #22286 ref https://forum.nim-lang.org/t/10642 For backwards compatibilities, we might need to keep the changes under a preview compiler flag. Let's see how many packags it break. **TODO** in the following PRs - [ ] Turn the `var T` destructors warning into an error with `nimPreviewNonVarDestructor` --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fixes #16331; aliasing of tuple construction within a single assignme… ↵Andreas Rumpf2023-06-161-0/+15
| | | | | | | (#22113) * fixes #16331; aliasing of tuple construction within a single assignment, great coding style * added test case
* fixes #21995: align C++ with C backend behavior for empty raise state… ↵heterodoxic2023-06-071-0/+9
| | | | | | | (#21998) * fixes #21995: align C with C++ backend behavior for empty raise statements * make runtime behavior match across both C and C++ backend and all exception modes
* shallow fix for #21972, #18552 by moving std::exception_ptr to the parent ↵heterodoxic2023-06-041-0/+33
| | | | | sco… (#21988) shallow fix for #21972 by moving std::exception_ptr to the parent scope, minor cleanup
* partially fixes #20787 by having a char dummy member prepended to objs only ↵heterodoxic2023-06-011-0/+4
| | | | | containing an UncheckedArray (i.e. C FAM) (#21979) partial fix for #20787
* fixes #15428 by updating deep open array copy codegen (#21935)heterodoxic2023-05-271-0/+22
| | | | | * fix #15428 * add test
* fix #10964 by honoring pointer deref syntax if a reified openarray is used ↵heterodoxic2023-05-271-0/+6
| | | | | | | to get an array's length (#21925) * fix #10964 * add test
* refactoring in preparation for better, simpler name mangling that wor… ↵Andreas Rumpf2023-04-241-1/+1
| | | | | | | | | | | (#21667) * refactoring in preparation for better, simpler name mangling that works with IC flawlessly * use new disamb field * see if this makes tests green * make tests green again
* stdlib tests now check refc too (#21664)ringabout2023-04-211-1/+1
| | | | | | | | | | | * stdlib tests now check refc too * typo * fixes line numbers * disable cpp * do not touch
* fixes #21540; deref block at transf phase to make injectdestructors function ↵ringabout2023-04-191-2/+53
| | | | | | | | | | | | | properly (#21688) * fixes #21540; deref block at transf phase to make injectdestructors function properly * add a test case * add one more test * fixes the type of block * transform block
* fixes #21505 (overload resolution of explicit constructors for imported C++ ↵heterodoxic2023-03-271-0/+39
| | | | | types) (#21511) hacky attempt to reconcile default explicit constructors with enforcement of brace initialization, instead of memsetting imported objects to 0
* fixes #20139; hash types based on its path relative to its package path ↵ringabout2023-03-023-0/+18
| | | | | | | | | | | | | | | (#21274) [backport:1.6] * fixes #20139; hash types based on its path relative its project * add a test case * fixes procs * better implementation and test case --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fixes #21116; always mangles the param (#21121)ringabout2022-12-172-1/+11
| | | | | | | | | * fixes #21116; always mangles the param * idOrSig * fixes tests * Apply suggestions from code review
* replace data init function with consts for typeinfov2 (#20977)ringabout2022-12-011-1/+0
| | | | | | | | | | | | | * replace data initial function with consts for typeinfov2 * fixes * fixes * workaround C++ * C++ keeps the previous implementaion * fixes
* move widestrs out of system (#20462)metagn2022-10-011-0/+1
| | | | | * move widestrs out of system * fix osproc
* fixes #20141; dereferencing pointer to incomplete type error with cast (#20147)ringabout2022-09-281-0/+27
| | | Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com>
* defaults to ORC (#19972)ringabout2022-09-237-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * defaults to Orc * bootstrap using refc * use gc * init orc defines * unregister orc * fix gc * fix commands * add prepareMutation for orc * enable deepcopy for orc * prepareMutation * more fixes * some cases * bug #20081 * partial fixes * partial fixes * fixes command line * more fixes * build Nim with refc * use gc * more fixes * rstore * orc doesn't support threadpool * more shallowCopy * more fixes * fixes unsafeNew * workarounds * small * more fixes * fixes some megatest * tcodegenbugs1 refc * fxies megatest * build nimble with refc * workaround tensordsl tests * replace shallowCopy with move * fixes action * workaround * add todo * fixes important packages * unpublic unregisterArcOrc * fixes cpp * enable windows Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com>
* remove deprecated type pragma syntax, fix bugs that required it (#20199)metagn2022-09-033-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | * remove deprecated pragma syntax from 0.20.0 closes #4651, closes #16653 with a cheap fix for now due to how early `tfFinal` is set * remove type pragma between name and generics * undo removal, try removing bind expression (0.8.14) * fix test, unremove bind expr * remove again * Update changelog.md Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> * dependencies @ HEAD & weave test dependencies * try fix package ci Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
* fixes the regressions caused by the fix for #20107 [backport] (#20287)Andreas Rumpf2022-08-311-0/+1
| | | | * fixes the regressions caused by the fix for #20107 [backport]
* fixes #20107 (#20246) [backport]Andreas Rumpf2022-08-191-0/+24
|
* Refactor and doc package handling, module name mangling (#19821)quantimnot2022-05-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Refactor and doc package handling, module name mangling * Consolidate, de-duplicate and extend package handling * Alter how duplicate module names of a package are handled * Alter how module names are mangled * Fix crash when another package is named 'stdlib' (test case added) * Doc what defines a package in the manual Modules with duplicate names within a package used to be given 'fake' packages to resolve conflicts. That prevented the ability to discern if a module belonged to the current project package or a foreign package. They now have the proper package owner and the names are mangled in a consistent manner to prevent codegen clashes. All module names are now mangled the same. Stdlib was treated special before, but now it is same as any other package. This fixes a crash when a foreign package is named 'stdlib'. Module mangling is altered for both file paths and symbols used by the backends. Removed an unused module name to package mapping that may have been intended for IC. The mapping was removed because it wasn't being used and was complicating the issue of package modules with duplicate names not having the proper package owner assigned. * Fix some tests * Refactor `packagehandling` * Remove `packagehandling.withPackageName` and its uses * Move module path mangling from `packagehandling` to `modulepaths` * Move `options.toRodFile` to `ic` to break import cycle * Changed import style to match preferred style Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
* output byref types into --header file [backport: 1.6] (#19505)flywind2022-03-232-0/+16
| | | | | | | | | * output byref types into --header file fix #19445 * fix comments * set targets
* fixes #19631 (#19618)Andreas Rumpf2022-03-201-0/+31
| | | Aliasing is hard and we have to watch out not to compile 'x = f(x.a)' into 'f(x.a, addr x)'
* mangle names in nimbase.h using cppDefine (#19395) [backport]flywind2022-01-171-0/+16
| | | | mangle names in nimbase.h fix comments
* deprecate unsafeAddr; extend addr (#19373)flywind2022-01-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | * deprecate unsafeAddr; extend addr addr is now available for all addressable locations, unsafeAddr is deprecated and become an alias for addr * follow @Vindaar's advice * change the signature of addr * unsafeAddr => addr (stdlib) * Update changelog.md * unsafeAddr => addr (tests) * Revert "unsafeAddr => addr (stdlib)" This reverts commit ab83c99c507048a8396e636bf22d55fdd84d7d1c. * doc changes; thanks to @konsumlamm Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
* fix marshal bugs in VM (#19161) [backport:1.6]flywind2021-11-171-4/+8
|
* fixes #19051 [backport:1.6] (#19133)Andreas Rumpf2021-11-121-1/+8
|
* fix #10128 (#18852)flywind2021-09-141-0/+18
|
* add testcase for #7308 (#18849)flywind2021-09-141-0/+43
|
* improve tsets.nim, twrong_setconstr.nim and avoid name clashes with compiler ↵Timothee Cour2021-04-291-146/+0
| | | | | | | sets (#17876) * improve tests/sets/tsets.nim and avoid name clashes with compiler sets * avoid name clashes in twrong_setconstr.nim and merge into tsets
* type with same name in different scope now works (#17710)Timothee Cour2021-04-141-0/+111
| | | | * type with same name in different scope now works * fix tests/enum/tenum.nim which was wrong because it was affected by this bug
* Fix #14325 (#17308)Clyybber2021-03-111-0/+17
| | | | | * Fix #14325 * Refactor and fix
* attempt to fix #16374 (#17232)flywind2021-03-021-0/+38
| | | | | | | | | * remove unnecessary when statement * remove outdated codes * attempt to fix #16374 * fix
* `--nilseqs` is now a deprecated noop (#17211)Timothee Cour2021-03-011-1/+1
| | | | | * --nilseqs is now a deprecated noop * fix tests; fix: future => sugar
* use typeof instead type (#16962)flywind2021-02-082-2/+2
|
* Add testcase for #14880 (#16795)Clyybber2021-01-221-0/+10
|
* close #9655 add testcase (#16683)flywind2021-01-111-0/+30
|
* use doAssert in tests (#16486)flywind2020-12-282-3/+3
|
* testament: error instead of silently ignore invalid targets; remove ↵Timothee Cour2020-12-142-2/+2
| | | | | | | | | | | pointless alias target vs targets; document matrix; DRY (#16343) * testament: error instead of silently ignore invalid targets * s/target/targets/ * fix test; refs #16344 * address comments * Update testament/specs.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* make megatest consistent with unjoined tests wrt newlines, honor newlines in ↵Timothee Cour2020-11-281-0/+2
| | | | | | | output spec (#16151) * fix megatest newlines * still allow missing trailing newline for now but in a more strict way than before
* updated repr tests (#16147)Andreas Rumpf2020-11-261-1/+0
|
* fixes https://github.com/status-im/nimbus-eth2/issues/1549 (#16146)Andreas Rumpf2020-11-261-0/+1
| | | | | * fixes https://github.com/status-im/nimbus-eth2/issues/1549 [backport:1.4] * test fixup
* fix #6497 (#16027)flywind2020-11-181-0/+13
| | | | | * fix #6497 * add testcase for #16027