summary refs log tree commit diff stats
path: root/compiler/semexprs.nim
Commit message (Collapse)AuthorAgeFilesLines
* fixes a strictdef ten years long vintage bug, which counts the same thing ↵ringabout2023-08-241-0/+1
| | | | | twice (#22549) fixes a strictdef ten years long vintage bug
* round out tuple unpacking assignment, support underscores (#22537)metagn2023-08-241-1/+32
| | | | | | | | | | | | | | | * round out tuple unpacking assignment, support underscores fixes #18710 * fix test messages * use discard instead of continue Co-authored-by: Andreas Rumpf <rumpf_a@web.de> --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* cascade tyFromExpr in type conversions in generic bodies (#22499)metagn2023-08-171-5/+7
| | | fixes #22490, fixes #22491, adapts #22029 to type conversions
* unpublic the sons field of PType; the precursor to PType refactorings (#22446)ringabout2023-08-111-1/+1
| | | | | | | | | | | * unpublic the sons field of PType * tiny fixes * fixes an omittance * fixes IC * fixes
* `initNodeTable` and friends now return (#22444)ringabout2023-08-111-2/+1
|
* use strictdefs for compiler (#22365)ringabout2023-08-061-6/+15
| | | | | | | | | | | | | | | * wip; use strictdefs for compiler * checkpoint * complete the chores * more fixes * first phase cleanup * Update compiler/bitsets.nim * cleanup
* fix #20883 Unspecified generic on default value segfaults the compiler (#21172)Bung2023-08-041-0/+3
| | | | | | | | | * fix #20883 Unspecified generic on default value segfaults the compiler * fallback to isGeneric * change to closer error * Update t20883.nim
* Add experimental inferGenericTypes switch (#22317)SirOlaf2023-08-031-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Open scope for defer (#22315)SirOlaf2023-07-221-0/+2
| | | Co-authored-by: SirOlaf <>
* fixes #19101; zero initialization union casts (#22185)ringabout2023-06-291-5/+0
| | | | | | | * zero initialization union casts * cleans up and adds a test case for #19101 * uses nimZeroMem
* fix calls in generic bodies, delay typecheck when no overloads match (#22029)metagn2023-06-131-1/+4
| | | | | | | | | | | | | | | | | | | | | | | * 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
* Remove Deprecated Nimfix (#22062)Juan Carlos2023-06-101-3/+1
| | | | * Remove Deprecated Nimfix * Trailing whitespace cleanups
* properly disallow unresolved generic proc values (#22005)metagn2023-06-051-1/+13
| | | | | | | * properly disallow unresolved generic proc values * mirrors semoperand * shallow efTypeAllowed, add back special case
* fixes #21887; Type conversion on overloaded enum field does not always call ↵ringabout2023-05-261-0/+3
| | | | | | | | | | | (#21908) * fixes #21887; Type conversion on overloaded enum field does not always call * remove comments * add a test case * restrict it to enums
* fixes #21863; Incorrect enum field access can cause internal error (#21886)ringabout2023-05-241-1/+1
| | | fixes 21863; Incorrect enum field access can cause internal error
* fix #21251 Compiler SIGSEGV when using SharedTable (#21876)Bung2023-05-231-0/+2
| | | fix #21251
* fix #14254 (#21837)metagn2023-05-201-1/+3
| | | | | | | * fix #14254 * use temporary PR branch for neo * fix url
* adds an experimental `mm:atomicArc` switch (#21798)ringabout2023-05-081-1/+1
|
* cheap fix for #10853 + better tuple subscript error message (#21767)metagn2023-05-021-1/+4
| | | | | | | * cheap fix for #10853 * also better tuple subscript error message * weird
* handle quoted routine symbols and non symbols expressions as before (#21740)ringabout2023-04-281-2/+3
|
* refactoring in preparation for better, simpler name mangling that wor… ↵Andreas Rumpf2023-04-241-5/+5
| | | | | | | | | | | (#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
* alias syntax fixes, improvements and tests (#21671)metagn2023-04-221-7/+13
| | | | | | | | | | | | | * alias syntax fixes, improvements and tests * even better, cannot use alias syntax with generics * more type tests, improve comment * fix again * consistent error message + make t5167_5 work * more comments, remove {.noalias.}
* warn on set types bigger than max size, default to 0..255 for int literals ↵metagn2023-04-171-14/+19
| | | | | | | | | | | | | | | | | | | (#21659) * test implicitly huge set types refs https://github.com/nim-lang/RFCs/issues/298 * oh my god * boot at least * don't error, fix remaining issues, no 2 len arrays * fix runnable example * test assuming 0..255 for int literal * test refactor, add changelog, test
* fixes #21674; `lent` can be used in the fields or the cast type as a ↵ringabout2023-04-181-1/+1
| | | | | | | | | parameter (#21684) * fixes #21674; `lent` can be used in the fields or the cast type as a parameter * add a test case * fix the test
* set module symbol type to None instead of nil for discard check (#21657)metagn2023-04-131-0/+6
| | | | | | | * set module symbol type to None instead of nil fixes #19225 * alright
* `proc` typeclass accounts for `iterator`, call conventions + `nil` fix + ↵metagn2023-04-111-0/+1
| | | | | | | | | | | | | document typeclass AST (#21629) * test fix #16546 #16548 + another issue * please don't tell me other packages do this * fix CI + test typeclass callconv pragma * better logic in parser * docs and changelog
* tuple unpacking for vars as just sugar, allowing nesting (#21563)metagn2023-03-281-1/+1
| | | | | | | | | | | | | | | | | | | * tuple unpacking for vars as just sugar, allowing nesting * set temp symbol AST * hopeful fix some issues, add test for #19364 * always use temp for consts * document, fix small issue * fix manual indentation * actually fix manual * use helper proc * don't resem temp tuple assignment
* fixes #14255; Crash in compiler when using `system.any` by accident. (#21562)ringabout2023-03-231-1/+1
| | | fixes #14255; Crash in compiler when using system.any by accident.
* Use `analyseIfAddressTaken` logic for checking if address is taken in ↵Jake Leahy2023-03-201-9/+15
| | | | | | | | | | | | | | | | | | | converter (#21533) * Add a test case There are way more test cases (See all branches of analyseIfAddressTaken but this covers at least a second branch * Port analyseIfAddressTaken from semexprs to sigmatch This was done since we cannot import sem or semexprs (circular import) but we need the rest of the logic. In needs to be done here since the converter isn't semmed afterwards and so we can't just leave the process til later use the version from semexprs * Less hacky solution which has the checking be done in analyseIfAddressTakenInCall This was done instead of the recommendation on removing it since sfAddrTaken is used in places other than the backend * Remove weird whitespace * Still check nkHiddenAddr if we are checking a converter
* fixes quoted variables with typedesc types (#21493)ringabout2023-03-091-1/+1
|
* fixes #21377; fixes `@[]` and `{}` type inference as returns in generics ↵ringabout2023-03-061-1/+1
| | | | | | | | | | | | | (#21475) * fixes `@[]` type inference in generics * add issue links * fixes macros and iterators * refactor * add one more test
* fixes #21326; fixes #7375; fixes #11986; fixes #9607; rework quote do; ↵ringabout2023-03-021-4/+7
| | | | | | | | | | | | | `getAst` uses type info to annotate the type of quoted variables; no more type erasures for quoted variables (#21433) * fixes #21326; getAst uses type info to annotateType quoted variables * simplify logics; sem types first * fixes important packages * add testcases * tiny
* Implemented basic macro expand functionality (#20579)Ivan Yonchovski2023-01-271-1/+29
| | | | | | | | | | | | | | | | | | * Implemented level based macro expand functionality - it can handle single macro call or expand whole function/proc/etc and it - In addition, I have altered the parser to provide the endInfo for the node. The usefulness of the `endInfo` is not limited to the `expandMacro` functionality but also it is useful for `ideOutline` functionality and I have altered the ideOutline functionality to use `endInfo`. Note `endInfo` most of the time is lost during the AST transformation thus in `nimsuggest.nim` I am using freshly parsed tree to get the location information. * Make sure we stop expanding correctly * Test CI * Fix tv3_outline.nim
* fix #21109 (#21127)Bung2022-12-191-0/+2
|
* fix #20588 (#21104)Bung2022-12-151-0/+2
|
* fix #15836 proc arg return type auto unexpectly match proc with concr… ↵Bung2022-12-121-2/+4
| | | | | | | | | (#21065) * fix #15836 proc arg return type auto unexpectly match proc with concrete type * fix #16244 * add test case for #12869
* fix #16758 Nim crashes in fixAbstractType (#20855)Bung2022-12-111-0/+3
| | | | | | | | | * fix #16758 Nim crashes in fixAbstractType * Update compiler/semexprs.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de> Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* Revert "fix #15836 proc arg return type auto unexpectly match proc with ↵ringabout2022-12-091-2/+2
| | | | | | | concr…" (#21057) Revert "fix #15836 proc arg return type auto unexpectly match proc with concr… (#21044)" This reverts commit 0cd9bdcf9f6802421e0d8e4c28fc732012af605e.
* fix #15836 proc arg return type auto unexpectly match proc with concr… ↵Bung2022-12-091-2/+2
| | | | | (#21044) fix #15836 proc arg return type auto unexpectly match proc with concrete type
* fixes #21027; cast expressions need a type (#21029)ringabout2022-12-061-0/+2
| | | | | | | * fixes #21027; cast expressions need a type * Apply suggestions from code review Thanks to @beef331
* definite assignment analysis for let (#21024)ringabout2022-12-061-9/+18
| | | | | | | | | | | | | | | | | | | * draft for let daa * patch * fixes bugs * errors for global let variable reassignments * checkpoint * out param accepts let * add more tests * add documentation * merge tests
* deprecate `do:` meaning `do ():` + misc cleanup (#20927)metagn2022-12-061-10/+5
| | | | | | | | | | | | | | | | | * test disable do: block lambda lifting * fix last test [skip ci] * deprecate `do:` meaning `do ():` + misc cleanup closes https://github.com/nim-lang/RFCs/issues/486 * oops * fix * no idea what could be causing nimsuggest failure other than this * ensure ci works
* better procvar ambiguity errors, clean up after #20457 (#20932)metagn2022-12-011-13/+34
| | | | | | | | | | | | | | | * better procvar ambiguity errors, clean up after #20457 fixes #6359, fixes #13849 * only trigger on closedsymchoice again * new approach * add manual entry for ambiguous enums too * add indent [skip ci] * move to proc
* fix bugs with dot & call operators [backport] (#20931)metagn2022-11-281-3/+6
| | | | | | | | | | | | | | | | | | | * better error messages for dot operators [backport] fixes #13063 * also fixes #7777 * fix #6981 and #9831 too * fix * minor improvement * sus test fixes * make test multiplatform lol * fix nimsuggest test, extra improvements
* Add `nkFastAsgn` into `semExpr` (#20939)Jake Leahy2022-11-271-1/+1
| | | | | * Add nkFastAsgn into case statement * Add test case
* An unnamed break in a block now gives an `UnnamedBreak` warning (#20901)ringabout2022-11-241-0/+3
| | | | | | | | | | | | | | | | | | | | | * unnamed break in the block now gives an error * bootstrap * fixes * more fixes * break with label * label again * one moee * Delete test5.txt * it now gives a UnnamedBreak warning * change the URL of bump back to the original one
* fixes #20807, refs #20450, regression with seq inference (#20818)metagn2022-11-121-1/+5
|
* fixes #20681; add efSkipFieldVisibilityCheck to skip check (#20639)ringabout2022-10-281-1/+2
| | | | | | | | | | | | | | | | | * don't sem const objectConstr defaults * fixes * add `efSkipFieldVisibilityCheck`; fixes nkBracket types * fixes #20681 * fixes tests * suggestion from @metagn * fixes tests Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com>
* fixes #20645 (#20646)Andreas Rumpf2022-10-241-5/+12
| | | | | * fixes #20645 * better bugfix
* Fix #12517 Allow single branch when nimvm statements (#20577)Can Lehmann2022-10-171-3/+6
| | | Allow single branch when statements