summary refs log tree commit diff stats
path: root/tests/generics
Commit message (Collapse)AuthorAgeFilesLines
* Fix #21760 (#22422)SirOlaf2023-08-101-0/+8
| | | | | | | | | | | * Remove call-specific replaceTypeVarsN * Run for all call kinds and ignore typedesc * Testcase --------- Co-authored-by: SirOlaf <>
* fix #12938 index type of array in type section without static (#20529)Bung2023-08-092-0/+15
| | | | | | | | | | | | | * fix #12938 nim compiler assertion fail when literal integer is passed as template argument for array size * use new flag tfImplicitStatic * fix * fix #14193 * correct tfUnresolved add condition * clean test
* block ambiguous type conversion dotcalls in generics (#22375)metagn2023-08-094-0/+46
| | | fixes #22373
* fix #18823 Passing Natural to bitops.BitsRange[T] parameter in generi… ↵Bung2023-08-081-0/+6
| | | | | (#20683) * fix #18823 Passing Natural to bitops.BitsRange[T] parameter in generic proc is compile error
* Let inferGenericTypes continue if a param is already bound (#22384)SirOlaf2023-08-061-1/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Play with typeRel * Temp solution: Fixup call's param types * Test result type with two generic params * Asserts * Tiny cleanup * Skip sink * Ignore proc * Use changeType * Remove conversion * Remove last bits of conversion * Flag --------- Co-authored-by: SirOlaf <>
* Fix crash when using uninstantiated generic (#22379)Jake Leahy2023-08-041-0/+16
| | | | | | | * Add test case * Add in a bounds check when accessing generic types Removes idnex out of bounds exception when comparing a generic that isn't fully instantiated
* Add experimental inferGenericTypes switch (#22317)SirOlaf2023-08-031-0/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Infer generic bindings * Simple test * Add t * Allow it to work for templates too * Fix some builds by putting bindings in a template * Fix builtins * Slightly more exotic seq test * Test value-based generics using array * Pass expectedType into buildBindings * Put buildBindings into a proc * Manual entry * Remove leftover ` * Improve language used in the manual * Experimental flag and fix basic constructors * Tiny commend cleanup * Move to experimental manual * Use 'kind' so tuples continue to fail like before * Explicitly disallow tuples * Table test and document tuples * Test type reduction * Disable inferGenericTypes check for CI tests * Remove tuple info in manual * Always reduce types. Testing CI * Fixes * Ignore tyGenericInst * Prevent binding already bound generic params * tyUncheckedArray * Few more types * Update manual and check for flag again * Update tests/generics/treturn_inference.nim * var candidate, remove flag check again for CI * Enable check once more --------- Co-authored-by: SirOlaf <> Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fix scoping regression with calls in generic bodies (#22115)metagn2023-06-172-0/+34
| | | refs #22029, refs https://github.com/status-im/nim-libp2p/actions/runs/5263850340/jobs/9514434659
* fix calls in generic bodies, delay typecheck when no overloads match (#22029)metagn2023-06-132-36/+72
| | | | | | | | | | | | | | | | | | | | | | | * sacrifice "tgenericshardcases" for working statics * legacy switch for CI, maybe experimental later * convert to experimental * apparently untyped needs the experimental switch * try special case call semcheck * try fix * fix compilation * final cleanup, not experimental, make `when` work * remove last needed use of untyped * fix unused warning in test * remove untyped feature
* more test cases for generic object impl AST (#22077)metagn2023-06-112-21/+49
| | | closes #9899, closes #14708, refs #21017
* some test cleanups & category reorganization (#22010)metagn2023-06-064-5/+38
| | | | | | | | | | | | | | | | | * clean up some test categories * mention exact slice issue * magics into system * move trangechecks into overflow * move tmemory to system * try fix CI * try fix CI * final CI fix
* add test case for #7839 (#22006)Bung2023-06-051-0/+9
|
* Add anti-regression for #21958 (#21960)Mamy Ratsimbazafy2023-05-301-0/+11
| | | Add anti-regression test to close #21958
* when T is both a type symbol and a routine symbol in scope of a generic proc ↵metagn2023-05-242-0/+9
| | | | | do not account for the type symbol when doing `a.T()` (#21899) fix #21883
* fix #14254 (#21837)metagn2023-05-202-0/+6
| | | | | | | * fix #14254 * use temporary PR branch for neo * fix url
* consistent use of scForceOpen for generic dot field symbols (#21738)metagn2023-05-053-1/+62
| | | | | | | | | | | | | | | | | | | | | * always force open generic dot field symbols? fixes #21724 but might break code * alternative, should fix CI * other alternative, add test for previous CI failure * not needed * make sure call doesn't compile too * ok actual second test * ok final actual correct test * apply performance idea * don't make fromDotExpr static
* fixes #20900; Calling template through from generic function across module ↵ringabout2023-04-132-2/+11
| | | | | | | fails to build (#21649) * fixes #20900; Calling template through from generic function across module fails to build * sanother way
* fixes #3770; templates with untyped parameters resolve private fields ↵ringabout2023-03-212-0/+15
| | | | | | | | | wrongly in generics (#21554) * fixes #3770; templates with untyped parameters resolve private fields wrongly * add a test case for #3770 * rename to `nfSkipFieldChecking`
* closes #8295; add a test case (#21486)ringabout2023-03-071-0/+13
|
* closes #6231; add a test case (#21485)ringabout2023-03-071-0/+5
|
* Fix #20416. Enable the recursion limit for ref/ptr types. (#21092)Aditya Siram2022-12-131-0/+20
|
* fix #16639 (#21017)metagn2022-12-051-0/+21
|
* fix #20996 (#21016)metagn2022-12-041-0/+15
| | | | | * fix #20996 * hopefully fix
* fix #6637 array index type depends generic (#20673)Bung2022-10-271-0/+9
|
* add test case for #500 (#20661)Bung2022-10-261-0/+8
|
* closes #4466; add testcase (#20625)ringabout2022-10-231-0/+9
|
* fix #7446 Generics: type mismatch 'SomeunsignedInt or Natural' (#20522)Bung2022-10-111-0/+10
| | | | | * fix #7446 Generics: type mismatch 'SomeunsignedInt or Natural' * try fix
* 'lock levels' are deprecated, now a noop (#20539)ringabout2022-10-111-1/+1
| | | | | * 'lock levels' are deprecated, now a noop * fixes tests
* less test time costs (#20479)Bung2022-10-021-4/+4
|
* defaults to ORC (#19972)ringabout2022-09-232-11/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Fixes #20348; only respect the recursion limit if the symbol's generic type ↵Aditya Siram2022-09-221-0/+123
| | | | | has been generated by the compiler (#20377) Fixes #20348
* fixes Thread initializer for ARC/ORC on Macos (#20368)ringabout2022-09-161-1/+1
| | | | | | | | | * fixes Thread initializer for ARC/ORC * another try * fix * use int
* remove deprecated type pragma syntax, fix bugs that required it (#20199)metagn2022-09-034-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | * 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>
* No longer segfault when using a typeclass with a self referencing type (#19467)Jason Beetham2022-02-021-0/+12
|
* Fixed concept constraints for static types (#19391)Jason Beetham2022-01-151-25/+62
|
* Generic parameters now can constrain statics in type definitions (#19362)Jason Beetham2022-01-141-0/+42
| | | | | | | | | * Parameters now can constrain static in type definitions resolved regression with generic procedures * Update compiler/sigmatch.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* style usages part one (openarray => openArray) (#19321)flywind2022-01-042-3/+3
| | | | | * style usages (openArray) * revert doc changes
* Alternative to #18928 (#18931)Jason Beetham2021-09-301-1/+51
| | | | | * fixed #18841 * Added test
* semtypinst: don't wrap type nodes from expressions in static[T] (#18860)alaviss2021-09-171-0/+17
|
* Fixed #18838 (#18841) [backport]Jason Beetham2021-09-131-1/+35
|
* Generic pointer procs now error if no types supplied (#18832)Jason Beetham2021-09-111-0/+28
| | | | | | | * more precise logic for pointer procs * added test for generic pointer procs * Fixed generic getting bracket expr if erroring
* Fixes implicit and explicit generics in procedures (#18808)Jason Beetham2021-09-061-0/+45
| | | | | | | | | | | * Fixes implicit and explicit generics * moved block logic into 'maybeInstantiateGeneric' * Added more tests * Update compiler/semexprs.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* Fix recursive generic typed defs (#18809)Jason Beetham2021-09-061-0/+12
|
* improve several tests in testament (#18635)Timothee Cour2021-08-081-2/+2
| | | | | | | | | | | * silence error output from template_various.nim * any => auto in tests * avoid showing failed for parseSpec since this is expected behavior in 2 cases: tincludefile.nim, tnav1.nim * enforce InheritFromException * fixup
* typo: nonexistant => nonexistent (#17918)Timothee Cour2021-05-021-4/+4
| | | | | * typo: nonexistant => nonexistent * fix test (ordering differs because of https://github.com/nim-lang/Nim/issues/17910)
* semLambda removed, semProcAux reworked (#17379)Saem Ghani2021-03-171-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * simplified proc-like name ident to symbol code * wip - reworking generic param sem * wip - closer to removing nkEmpty generic params * it's hacky but tests pass * slowly tweaking semProcAux to take on semLambda * fix pragma superset check proto vs current * Set the symbol owner earlier * partial progress reworking proto found bug where default values between forward and impl lead to overload resolution issues. * simplified pragma handling and callConv checks Co-authored-by: Clyybber <Clyybber@users.noreply.github.com> * partially working * cgexprs issue * It works! * comment clean-up * clean-up asserts, comments, and other bits * add isGenericParams, inline isGeneric queries * seeing if this is sufficiently consistent * can use this approach or continue it in a further PR * commentary about nullary generics and clean-ups * fixed a mistake in PNode isGenericRoutine * Some small cleanups * Small cleanup * for func lambdas ensure we use lambda pragmas * add some basic compileTime func tests * [ci skip] remove comments Co-authored-by: Clyybber <Clyybber@users.noreply.github.com> Co-authored-by: Clyybber <darkmine956@gmail.com>
* `std/options`: `$some(3)` is now `"some(3)"`, etc. (#17147)Timothee Cour2021-02-241-3/+3
| | | | | | | * std/options: $some(3) is now "some(3)", not "Some(3)", `$none(int)` is now `"none(int)"` instead of `"None[int]"` * fix tests * disable optionsutils
* Deprecate TaintedString (#15423)Juan Carlos2021-01-151-3/+3
| | | | Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com>
* use doAssert in tests (#16486)flywind2020-12-283-31/+31
|
* testament: error instead of silently overwrite a spec (#16166)Timothee Cour2020-11-291-4/+16
|