summary refs log tree commit diff stats
path: root/compiler
Commit message (Collapse)AuthorAgeFilesLines
* fixes #20155; repr range with distinct types is broken with ORC (#20158)ringabout2022-09-111-0/+3
| | | | | * fixes #20155; repr range with distinct types is broken with ORC * skipRanges
* Implement Markdown definition lists (+ migration) (#20333)Andrey Makarov2022-09-112-2/+7
| | | | | | | | | | | | | | | Implements definition lists Markdown extension adopted in a few implementations including: * [Pandoc]( https://pandoc.org/MANUAL.html#definition-lists) * [kramdown]( https://kramdown.gettalong.org/quickref.html#definition-lists) * [PHP extra Markdown]( https://michelf.ca/projects/php-markdown/extra/#def-list) Also affected files have been migrated. RST definition lists are turned off for Markdown: this solves the problem of broken formatting mentioned in https://github.com/nim-lang/Nim/pull/20292.
* fix #13515 [backport] (#20315)metagn2022-09-111-1/+7
| | | | | | | | | | | * fix #13515 * only compile test * no idea why this PR is unlocking this * don't rope in symchoices * even more restrictive
* fixes nightlies build regression (#20322)ringabout2022-09-081-1/+1
| | | fixes nightlies build
* fixes #20303; wasMoved expressions with side effects for ORC (#20307) [backport]ringabout2022-09-081-2/+25
| | | fixes #20303; wasMoved expressions with side effects
* Replace `if` by `case` in JS `isSimpleExpr` (#20267)Amjad Ben Hedhili2022-09-061-5/+7
| | | use case stmt
* use arrow precedence in spec (#20166)metagn2022-09-061-1/+1
| | | | | | | * test using arrow precedence in spec refs #8759 * add test for #8759
* fixes #9462; jsondoc --index can generate a theindex.json (#20205)ringabout2022-09-062-1/+21
|
* overloadable enums no longer experimental (#20298)metagn2022-09-056-23/+7
| | | depends on #20126
* Prevent use-after-free bugs in object variants. Fixes bug #20305 (#20300) ↵Antonis Geralis2022-09-051-0/+3
| | | | | | | | | | | [backport] prevent use-after-free bugs in cased objects the bug happens specifically when deleting an item in a seq. The item taking it's place might not have the same case fields. Then =sink(x[i], move x[xl]) might leave the deleted fields still in memory! If the new item switches branches again, you get a use-after-free bug.
* only allow enums to overload enums + extra test (#20126)metagn2022-09-031-2/+2
| | | mirror behavior without overloadableEnums
* remove deprecated type pragma syntax, fix bugs that required it (#20199)metagn2022-09-032-30/+27
| | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Fix #16937; --clib option pass library name to backend C compiler correctly ↵Tomohiro2022-09-011-1/+1
| | | | | | | | | | | | | (#19754) * Fix 16937: Make --clib option works * Make tests/compiler/tcmdlineclib.nim works from any current dir * Try to fix link error on macosx * Add a comment to tests/compiler/tcmdlineclib.nims Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
* support cstring in `case` (#20130)metagn2022-09-019-18/+42
| | | | | | | | | | | | | | | * implement case for cstring for now just converts to string on C backend * custom implementation for cstring * remove leftover * revert even more * add nil + fix packages weird variant literal bug * update docs
* Markdown code blocks part 6 (#20292)Andrey Makarov2022-08-313-11/+8
|
* fixes the regressions caused by the fix for #20107 [backport] (#20287)Andreas Rumpf2022-08-312-1/+2
| | | | * fixes the regressions caused by the fix for #20107 [backport]
* [nimsuggest] fix def call on identifier 2 times on the line (#20228)Ivan Yonchovski2022-08-302-10/+27
| | | | | | | - apparently TLineInfo's implementation of `==` ignores the column. After I fixed the code to use exact TLineInfo comparison I fixed several other issues hidden by that issue. - Replaced `tuple[sym, info]` with `SymInfoPair`
* fix `nim md2tex` and `koch pdf` commands (#20280)Andrey Makarov2022-08-281-1/+2
| | | | | * fix `nim md2tex` and `koch pdf` commands * change rst2tex -> md2tex also
* Fix auto links to subheader when TOC is present (#20279)Andrey Makarov2022-08-272-12/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix links to subheader when TOC is present It was observed (in https://github.com/nim-lang/Nim/pull/20112) that links to 2nd- (and subsequent) -level headings fail if TOC is present, e.g.: ```nim .. contents:: Type relations ============== Convertible relation -------------------- Ref. `Convertible relation`_ ``` The problem here is that links are resolved in `rst.nim` but later `rstgen.nim` fixes ("fixes") anchors to make them unique so that TOC always works (if e.g. there was another sub-section like "Convertible relation"). The solution implemented in this PR is to move that fix-up of anchors into `rst.nim`, so that link resolution could know final anchors. The bug seems to be added in https://github.com/nim-lang/Nim/pull/2332 in 2015, that is it is present in Nim 1.0.
* provide better error messages for large set (#20207)ringabout2022-08-251-1/+1
| | | Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* remove unused sfProcvar, "procvar" mentions (#20204)metagn2022-08-243-5/+6
| | | refs #12975. doesn't close it because wProcvar isn't removed
* move formatfloat out of system (#20195)ringabout2022-08-2411-10/+16
| | | | | | | | | | | | | | | * move formatfloat out of system * fixes doc * Update changelog.md * careless * fixes * deprecate system/formatfloat * better handling
* fixes #20227; skip distinct types for genObjConstr [JS backend] (#20229)ringabout2022-08-241-1/+2
| | | fixes #20227; skip distinct types for genObjConstr
* test removing dollar for objects out of system (#20242)metagn2022-08-242-0/+5
| | | | | | | | | | | * test removing dollar for objects out of system * test & fixes * fix bootstrap * use nimPreviewSlimSystem, test stdlib category * fix test
* fixes #20219; ignore comment/empty node in stmtListExpr (#20249)ringabout2022-08-241-0/+4
|
* top-down type inference, implements rfc 149 (#20091)metagn2022-08-2412-187/+324
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * micro implementation of rfc 149 refs https://github.com/nim-lang/RFCs/issues/149 * number/array/seq literals, more statements * try fix number literal alias issue * renew expectedType with if/case/try branch types * fix (nerf) index type handling and float typed int * use typeAllowed * tweaks + const test (tested locally) [skip ci] * fill out more of the checklist * more literals, change @ order, type conversions Not copying the full call tree before the typedesc call check in `semIndirectOp` is also a small performance improvement. * disable self-conversion warning * revert type conversions (maybe separate op later) * deal with CI for now (seems unrelated), try enums * workaround CI different way * proper fix * again * see sizes * lol * overload selection, simplify int literal -> float * range, new @ solution, try use fitNode for nil * use new magic * try fix ranges, new magic, deal with #20193 * add documentation, support templates Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* new .redefine pragma for templates, warn on redefinition without it (#20211)metagn2022-08-237-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * test CI for template redefinitions * adapt asyncmacro * fix quote * fix again * try something else * revert * fix ioselectors_select, disable packages CI * adapt more tests & simplify * more * more * more * rename to redefine, warn on implicit redefinition * basic documentation [skip ci] * Update compiler/lineinfos.nim Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
* Add `doctype: RST|Markdown|RstMarkdown` pragma (#20252)Andrey Makarov2022-08-233-2/+49
| | | | | | | | | | | | | | | | | | | | | | | | * Add `doctype: RST|Markdown|RstMarkdown` pragma Implements https://github.com/nim-lang/RFCs/issues/68 , see also discussion in https://github.com/nim-lang/Nim/issues/17987 The permitted values: * `markdown`, which is default. It still contains nearly all of the RST supported but it is assumed that in time we will give up most or all RST features in this mode * `rst`, without any extensions * `RstMarkdown` — compatibility with Nim 1.x. It's basically RST with those Markdown features enabled that don't conflict with RST. * Apply suggestions from code review Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com> * Additional fix in spirit of review * Fix test after #20188 Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
* fixes #18983 #5282 #13008; recursive types casue infinite type (#20172)ringabout2022-08-231-2/+27
| | | | | | | * fixes #18983 #5282 #13008; recursive types casue infinite type * re * add testcases
* remove {.this.} pragma, deprecated since 0.19 (#20201)metagn2022-08-236-77/+2
| | | Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* remove a special case in sigmatch; distinct pointer types no longer match ↵ringabout2022-08-231-2/+0
| | | | | | | | | | | | | | | | `nil` type (#20251) * remove a special case in sigmatch; distinct pointer types no longer match `nil` type * add tests * fixes tests * Update changelog.md Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> Co-authored-by: Andreas Rumpf <rumpf_a@web.de> Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
* remove unused nimfind defines (#20250)ringabout2022-08-231-23/+8
| | | remove unused nimfind
* remove `shallow` usages for ORC (#20109)ringabout2022-08-232-3/+6
|
* fixes #19967; reset does not work on set [backport: 1.2] (#19968)ringabout2022-08-231-1/+14
| | | | | | | | | | | | | * fixes #19967 * use case * add testcase * fix typos * explictly specify other branches Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com>
* fixes #20162; locals doesn't work with ORC [backport] (#20163)ringabout2022-08-231-1/+1
| | | fixes #20162; locals doesn't work with ORC
* document compiler procs regarding `&` (#20257)ringabout2022-08-223-2/+8
|
* fixes #11953; jsondoc creates no files unless the htmldocs dir is created ↵ringabout2022-08-201-0/+2
| | | | | | | | | (#20198) * fixes #11953; jsondoc creates no files unless the htmldocs dir is created * target * fixes runner
* fixes #20149; fixes #16762; hintAsError and warningAsError now ignore ↵ringabout2022-08-191-7/+5
| | | | | | | | | | | | | | | | | | | foreign packages (#20151) * fixes #20149; hintAsError/warningAsError ignores foreign packages * add changelog * fixes the test * remove * fixes tests again * fix * I'm careless Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com>
* make implicit cstring conversions explicit (#19488)ee72022-08-192-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Nim manual says that an implicit conversion to cstring will eventually not be allowed [1]: A Nim `string` is implicitly convertible to `cstring` for convenience. [...] Even though the conversion is implicit, it is not *safe*: The garbage collector does not consider a `cstring` to be a root and may collect the underlying memory. For this reason, the implicit conversion will be removed in future releases of the Nim compiler. Certain idioms like conversion of a `const` string to `cstring` are safe and will remain to be allowed. And from Nim 1.6.0, such a conversion triggers a warning [2]: A dangerous implicit conversion to `cstring` now triggers a `[CStringConv]` warning. This warning will become an error in future versions! Use an explicit conversion like `cstring(x)` in order to silence the warning. However, some files in this repo produced such a warning. For example, before this commit, compiling `parsejson.nim` would produce: /foo/Nim/lib/pure/parsejson.nim(221, 37) Warning: implicit conversion to 'cstring' from a non-const location: my.buf; this will become a compile time error in the future [CStringConv] /foo/Nim/lib/pure/parsejson.nim(231, 39) Warning: implicit conversion to 'cstring' from a non-const location: my.buf; this will become a compile time error in the future [CStringConv] This commit resolves the most visible `CStringConv` warnings, making the cstring conversions explicit. [1] https://github.com/nim-lang/Nim/blob/d2318d9ccfe6/doc/manual.md#cstring-type [2] https://github.com/nim-lang/Nim/blob/d2318d9ccfe6/changelogs/changelog_1_6_0.md#type-system
* fixes #20107 (#20246) [backport]Andreas Rumpf2022-08-191-0/+14
|
* Don't require blank line before Markdown code (#20215)Andrey Makarov2022-08-151-2/+1
| | | | Fixes bug reported in https://github.com/nim-lang/Nim/pull/20189 affecting nimforum.
* bootstrap the compiler with nimPreviewSlimSystem (#20176)ringabout2022-08-098-1/+26
| | | | | * bootstrap the compiler with nimPreviewSlimSystem * threads
* fixes #20132; fixes the broken jsondoc comand [backport] (#20135)ringabout2022-08-041-1/+2
| | | | | * fixes #20132; fixes the broken jsondoc comand * add testcase
* Fixed compilation of void closureiters with try stmt (#20138) [backport]Yuriy Glukhov2022-08-031-4/+7
|
* Warn when casting to a larger type (#20103)konsumlamm2022-07-282-8/+12
| | | | | * Warn when casting to a larger type * Revert change to error message to fix CI
* Fixed noinit pragma for closure variables (#20101)Yuriy Glukhov2022-07-282-2/+3
|
* fixes #20031; uint64 is an ordinal type since 1.0 (#20094)ringabout2022-07-271-1/+1
| | | | | * fixes #20031; uint64 is an ordinal type since 1.0 * Update compiler/semstmts.nim
* remove shallowCopy for ARC/ORC (#20070)ringabout2022-07-265-9/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | * remove shallowCopy for ARC/ORC * use move * fix * more fixes * typo * Update lib/system.nim * follow * add nodestroy * move * copy string * add a changelog entry Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com> Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* .forbids pragma: defining forbidden tags (#20050)Lancer112112022-07-269-17/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * .forbids pragma: defining illegal effects for proc types This patch intends to define the opposite of the .tags pragma: a way to define effects which are not allowed in a proc. * updated documentation and changelogs for the forbids pragma * renamed notTagEffects to forbiddenEffects * corrected issues of forbids pragma the forbids pragma didn't handle simple restrictions properly and it also had issues with subtyping * removed incorrect character from changelog * added test to cover the interaction of methods and the forbids pragma * covering the interaction of the tags and forbids pragmas * updated manual about the forbids pragma * removed useless statement * corrected the subtyping of proc types using the forbids pragma * updated manual for the forbids pragma * updated documentations for forbids pragma * updated nim docs * updated docs with rsttester.nim * regenerated documentation * updated rst docs * Update changelog.md Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com> * updated changelog * corrected typo Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
* Correctly detect major version of GCC (#20059)kraptor2022-07-181-20/+6
| | | | | | | | | | | | | | | We were doing a very poor job detecting the major version of GCC by parsing the output of --version. This patches uses -dumpversion to make this parsing straightforward and it also fixes a bunch of compiling issues on different platforms with custom output for --version switches. For example, openSUSE first line of the output includes the revision number and the parsing that was being done did mix that number with the major version and breaks building the nim compiler (as it doesn't find the 3 dots for an X.Y.Z semver format, hence returning "false"). In this patch, we simply use -dumpversion (which has been at least from 1993, so we are safe :)