Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a check in unittest generated by template doesn't show actual value #6736

Closed
alehander92 opened this issue Nov 13, 2017 · 1 comment
Closed

Comments

@alehander92
Copy link
Contributor

import unittest

type
  A = object
    b: int

template t: untyped =
  check(a.b == 2)

suite "0":
  test "1":

    var a = A(b: 0)
    check(a.b == 2)

suite "1":
  test "1":

    var a = A(b: 0)
    t()

[Suite] 0
t2.nim(14, 14): Check failed: a.b == 2
a.b was 0
[FAILED] 1

[Suite] 1
t2.nim(8, 12): Check failed: a.b == 2
[FAILED] 1

@chrisheller
Copy link
Contributor

While I was looking at unittest.nim for #12031, I took a quick look at this. The reason that the template doesn't print the actual value is because the check macro is testing for nnkIdent for the equality test, but the template has not been resolved yet, so the "==" is still nnkOpenSymChoice at that point.

Updating unittest.nim with this change makes the above test code work properly.

diff --git a/lib/pure/unittest.nim b/lib/pure/unittest.nim
index 469e75c16..0b65fc888 100644
--- a/lib/pure/unittest.nim
+++ b/lib/pure/unittest.nim
@@ -610,7 +610,7 @@ macro check*(conditions: untyped): untyped =
 
     var counter = 0
 
-    if exp[0].kind == nnkIdent and
+    if exp[0].kind in {nnkIdent, nnkOpenSymChoice} and
         $exp[0] in ["not", "in", "notin", "==", "<=",
                     ">=", "<", ">", "!=", "is", "isnot"]:

There is another place in that same section of code that also checks for nnkIdent, but I didn't have an immediate test case to trigger any incorrect behavior there, so I didn't change anything.

narimiran added a commit to narimiran/Nim that referenced this issue Feb 7, 2020
@Araq Araq closed this as completed in f3117d3 Feb 7, 2020
dom96 pushed a commit that referenced this issue Feb 15, 2020
* Add osOpen alias for the operating system specific open command

* Add `--git.devel` option to the documentation
remove unused import (#12900)

fix json regression D20191212T144944 (#12902) [backport]

Peer Review Feedback #12901 (comment)

Merge branch 'devel' of https://github.com/nim-lang/Nim into osopen

Peer Review Feedback #12901 (comment)

Update lib/pure/browsers.nim

Co-Authored-By: Dominik Picheta <dominikpicheta@googlemail.com>
Peer Review Feedback #12901 (comment)

allow typed/untyped in magic procs (#12911)

NaN floatFormat with clang_cl  (#12910)

* clang_cl nan floatFormat

* format

add $nimeq for gdb (#12909)

ARC: cycle detector (#12823)

* first implementation of the =trace and =dispose hooks for the cycle collector
* a cycle collector for ARC: progress
* manual: the .acyclic pragma is a thing once again
* gcbench: adaptations for --gc:arc
* enable valgrind tests for the strutils tests
* testament: better valgrind support
* ARC refactoring: growable jumpstacks
* ARC cycle detector: non-recursive algorithm
* moved and renamed core/ files back to system/
* refactoring: --gc:arc vs --gc:orc since 'orc' is even more experimental and we want to ship --gc:arc soonish

Cleanup leftovers of #12911(#12916)

Fix single match output (#12920)

fixes #12899 (#12921)

* fixes #12899

* fixes regression: destroy global variables in reverse declaration order, closureleak test relies on it

Implement NixOS distro check (#12914)

Better case coverage error message for alias and range enum (#12913)

fix error in assertions document (#12925) [backport]

fix cmdline bugs affecting nimBetterRun correctness (#12933) [backport]

fix #12919 tasyncclosestall flaky: Address already in use (#12934)

system.reset is no longer magic (#12937)

It has now means setting x to default for new and old runtime alike
Fix #12785 (#12943)

* Fix #12785 and add test

* better variable name

update documentation for `closureScope` and `capture` (#12886)

fixes #12735 on osx, call dsymutil for debug builds (#12931)

* fix #12735 osx: dsymutil needs to be called for debug builds
* also write dsymutil command to extraCmds in json build file

Auto-initialize deques (#12879)

case coverage error message for `char` (#12948)

lenVarargs: number of varargs elements (#12907)

docs: tiny style improvements

added guidelines for evolving Nim's stdlib

fixes a bug that kept sugar.collect from working with for loop macros [backport]

fixes #12826

fixes a regression

a better bugfix

fixes a test case

fixes a silly regression

fixes the distros.nim regression

ported channels to ARC

ported osproc.nim to ARC

ported re.nim to ARC

ARC: default to a shared heap with --threads:on

osproc: fixes regression

fixes another regression

fixes #12945 (#12959)

minor refactorings

Fixes stackoverflow links in readme (#12963) [backport]

Allow customize Host header
[ci skip] docfix .. < => ..< (#12981) [backport]

parsecfg: retain CRLF line breaks, fixes #12970 (#12971)

generic stack trace overriding mechanism (#12922)

* libbacktrace support

* switch to a generic stack trace overriding mechanism

When "nimStackTraceOverride" is defined, once of the imported modules
can register its own procedure to replace the default stack trace
generation by calling `registerStackTraceOverride(myOwnProc)`.

Tested with `./koch boot -d:release --debugger:native -d:nimStackTraceOverride --import:libbacktrace`
for the compiler itself and `./bin/nim c -r -f --stacktrace:off --debugger:native -d:nimStackTraceOverride --import:libbacktrace foo.nim`
for an external program.

* make the StackTraceOverrideProc {.noinline.}

Added fix for handling TaintedStrings in streams and httpclient (#12969)

* Added fix for taint mode in streams and httpclient

* Removed taintMode export from system.nim

Check pqntuples > 0 in getValue. Fixes #12973 (#12974)

c_fflush() the rawWrite() buffer (#12987)

Stack traces on an unbuffered stderr get out of sync with line-buffered
stdout - usually on Windows terminals or CI logs. This fixes it by
calling C's fflush() on the output buffer in the procedure used for
printing stack traces.
fixes #12989

Revert "fixes #12989"

This reverts commit 928c2fe.

fixes #12965 (#12991)

fixes #12989 (#12992)

* fixes #12989
* Revert "remove unwanted changes"

This reverts commit 5018297.

fixes disruptek/nimph#102 multi-level nim.cfg use (#13001) [backport]

--exception:goto switch for deterministic exception handling (#12977)

This implements "deterministic" exception handling for Nim based on goto instead of setjmp. This means raising an exception is much cheaper than in C++'s table based implementations. Supports hard realtime systems. Default for --gc:arc and the C target because it's generally a good idea and arc is all about deterministic behavior.

Note: This implies that fatal runtime traps are not catchable anymore! This needs to be documented.
fix #12985 {.push.} now does not apply to generic instantiations (#12986)

Sink to MemMove optimization in injectdestructors (#13002)

remove default argument for readLines (#12807) [backport]

fixes #12978 (#13012)

Fix typo (#13015) [backport]

fixes #12961 (#13019)

fixes #12956 (#13020)

fix #12988 (#13022)

fix #12988
Fixes #13026 (#13028)

fixes #12964 (#13027)

fixes #13032

VM: support importc var, ptr/pointer types, cast int <=> ptr/pointer (#12877)

* VM: allow certain hardcoded special var variables at CT
* VM: allow all importc var, cast[int](ptr)
* fix tests tests/vm/tstaticprintseq.nim, tests/cpp/t8241.nim
* VM: == works for ptr/pointer nodes
* bugfix: ==, cast now also works for pointer, not just ptr
* VM supports cast PtrLikeKinds <=> PtrLikeKinds / int
* improve cname handling
* fixup + bug fix
* VM: support cast from ref to int
* address comment: opcLdGlobalDeref => opcLdGlobalDerefFFI
* defensive check against typ == nil

fix enumtostr crash for enum-range (#13035)

fixes #13013, reverts previous changes to readLines() (#13036) [backport]

* Revert "remove default argument for readLines (#12807) [backport]"

This reverts commit c949b81.

reprjs: style changes

fixes #12996

Rst parser respect `:start-after:` and `:end-before:` in `include` directive (#12972)

* [FEATURE] rst parser respect :start-after: in include

Rst parser now respects `:start-after:` and `:end-before:` attributes
for `include` directive.

* [DOC] include directive parsing proc update

* [TEST] Added unit tests for include rst directive in `rst` module

Allow `-o` option for `buildIndex` (#13037) [backport]

Addressing #12771

This is also included in the docgen documentation [here](https://nim-lang.org/docs/docgen.html) but its not respected as reported in the issue.
[cleanup] remove disabled (and obsolete) ttypetraits; rename ttypetraits2 => ttypetraits (#13041)

* remove disabled (and obsolete) ttypetraits; rename ttypetraits2 => ttypetraits

* D20200105T085828 fix super strange bug that causes CI to fail: builds.sr.ht with: `Error: Settle timed out after 120 attempts`

Continue #13002 (#13021)

testament/important_packages dont run hts (#13052)

Modify the test command for nimly (nimble-package) (#13053)

clean up deprecated stuff and unused imports in tests (#13059)

--styleCheck:hint now works (#13055)

[easy] --hint:link:on now shows link cmd instead of nothing (#13056)

* --hint:link:on now shows link cmd instead of nothing

* update doc for --listCmd

add pqserverVersion,pqconnectionNeedsPassword,pqconnectionUsedPassword (#13060)

basename supports pragmaexpr (#13045)

* basename supports pragmaexpr

* update changelog

distinctBase type trait for distinct types (#13031)

make SuccessX show project file + output file (#13043)

* make SuccessX show project file + output file
* address comments
* fix test and add `result.err = reNimcCrash` otherwise hard to see where reNimcCrash used
* address comments

move entries from the wrong changelog file [ci skip]

fix crash due to errant symbols in nim.cfg (#13073) [backport]

Deleted misplaced separator (#13085) [backport]

Misplaced separator, which was constantly breaking compilation on Haiku OS, was deleted.
take the one good idea from --os:standalone and enable it via -d:StandaloneHeapSize (#13077)

remove all remaining warnings when build nim (with -d:nimHasLibFFI) (#13084)

* cleanup deprecations in evalffi + elsewhere

* remove dead code getOrdValue64

Use '__noinline' instead of 'noinline' for N_NOINLINE gcc attribute, this prevents clashes with systems where 'noinline' might be already defined (#13089)

Fix error check code in osproc (#13090) [backport]

fixes #13072; no test case because it will be added later with more exception handling related bugfixes

fixes #13070

typetraits: fixes #6454; genericParams; added lenTuple; added tuple type get (#13064)

[backport] system/io.nim fix wrong documentation comment [ci skip]

fixes an asyncftpclient bug; refs #13096 [backport]

System cleanup, part 1 (#13069)

* system.nim: mark what every .pop does

* system.nim: un-nest when statements

[backport] fix #12813, fix #13079 (#13099)

Correctly remove a key from CountTable when it is set to zero.
more arc features (#13098)

* config update
* ARC now supports 'repr' and 'new' with finalizers is supported

Remove some unused/disabled OpenSSL functions (#13106)

Add link to posix_utils.html in posix.nim (#13111)

VM FFI: write(stderr, msg) and fprintf(cstderr, msg) now work at CT (#13083)

fix the ftp store function read the local file bug (#13108) [backport]

* Update asyncftpclient.nim

When use newStringOfCap function not have assign memory for the string data,so if use this address the fault is rasise.

* complelete the bugfix

fix rtti sizeof for varargs in global scope (#13125) [backport]

fixes #13122 (#13126)

* fixes #13122

* moved tests to where they belong

fixes #13112 (#13127)

* improve line error information

* fixes #13112

Expose more openSSL methods. (#13131)

fixes #13100 nim doc now treats `export localSymbol` correctly (#13123) [backport]

* fix #13100 nim doc now treats `export localSymbol` correctly
* use owner instead

fixes #13119 (#13128)

* fixes #13119
* fixes a regression

fixes #13105 (#13138)

fixes #10665 (#13141) [backport]

pass platform argument only if vccexe is used (#13078)

* pass platform only if vccexe is used
* fixes #12297

fixes #13104 [backport] (#13142)

fixes #9674 [backport] (#13143)

Fix typo in doc/destructors.rst (#13148)

Added 'ansic' os support for minimal (embedded) targets (#13088)

* os:any implementation
* os:asny: omit flock/funlock calls in echoBinSafe
* Disabled default "unhandled expection" reporting for `--os:any` to reduce
code size. Added unhandledExceptionHook instead which can be used to get
a notification from Nim and handle it from the application.

System cleanup, part 2 (#13155)

* create basic_types, arithmetics, exceptions, comparisons
* create setops.nim
* create memalloc.nim
* create gc_interface.nim
* create iterators_1.nim

export normalizePathEnd (#13152)

successX now correctly shows html output for `nim doc`, `nim jsondoc`; fix #13121 (#13116)

* successX now correctly shows html output for nim doc
* fixes #13121
* fixup hintSuccessX to be less weird

ARC: misc bugfixes (#13156)

* fixes #13102
* closes #13149
* ARC: fixes a move optimizer bug (there are more left regarding array and tuple indexing)
* proper fix; fixes #12957
* fixes yet another case object '=' code generation problem

CI fix timeout error (#13134)

Remove obsolete code from osalloc (#13158)

style fix: change 'JS' to 'js' to make it consistent (#13168)

Working towards arc codegen (#13153)

fixes #13029
fixes #12998 nim doc regression (#13117)

fix tsizeof3 for aarch64 (#13169)

Cleanup DFA (#13173)

Fix docs (#13176)

fixes #13095 (#13181)

* fixes #13095

* fix typo

make case-object transitions explicit, make unknownLineInfo a const, replace a few magic numbers with consts (#13170)

ARC works for async on Windows (#13179)

make sink operator optional (#13068)

* make sink operator optional

* bug fix, add changelog entry

* Trigger build

* fix one regression

* fix test

* Trigger build

* fix typos

Fix docs for subdirs too (#13180)

* Fix doc subdirs
* Extract to helper proc, and fix on windows

followup on #10435 : should be diff, not show (#13162)

fixes #13157

refs #13054 correctly handle {.exportc,dynlib.} and {.exportcpp,dynlib.}  (#13136)

* refs #13054 correctly handle {.exportc,dynlib.} and {.exportcpp,dynlib.}
* put back NIM_EXTERNC for N_LIB_EXPORT; causes issues with compilerproc

fixes #13144 (#13145)

* fixup: genscript now does not copy nimbase.h but uses -I$nim/lib

times: toUnixFloat, fromUnixFloat (#13044)

maybe: allows optional chaining of field access and indexing when LHS i snil (#13023)

* maybe: allows optional chaining
* fix tools/kochdocs.nim
* improve semantics to distinguish valid from invalid values
* for now, wrapnil, isValid, unwrap are not exported

fix docs + API for fieldPairs, fields (#13189)

more on arc codegen (#13178)

* arc codegen for union type

* add more tests

* fix offsetof

* fix tsizeof test

* fix style

Add link to packaging.html (#13194)

Fixes #13186 (#13188)

fixes #13195

revert last commit

Merge branch 'devel' of https://github.com/nim-lang/Nim into devel

Revert "fixes #13195"

This reverts commit cd7904f.

fixes #13110 (#13197)

fixes #13195 (#13198)

* fixes #13195

* extra fix

* fix typo

compiler/ccgtypes: hide exportc proc unless it has dynlib (#13199)

This hides most of stdlib's internal functions from resulting
binaries/libraries, where they aren't needed on *nix. Static libraries
are not affected by this change (visibility doesn't apply to them).
fix range[enum] type conversion (#13204) [backport]

Idxmin & idxmax, continuation (#13208)

* Add idxmin() which returns the index of the minimum value

* Add idxmax() which returns the index of the maximum value

* Add tests for idxmin()

* Add tests for idxmax()

* Remove initialization of result = 0

* Adds overloading for arrays (no enums indexed arrays yet)

* Add support for enum index arrays

* Fix tests with enum

* Fix tests for idxmax

* Change names of the procedures to minIndex and maxIndex

* address Araq's comments:

- remove 'array' versions
- add .since pragma
- return 'int' instead of 'Natural'
- add changelog entry

Co-authored-by: Federico A. Corazza <20555025+Imperator26@users.noreply.github.com>

fix #13211 relativePath("foo", ".") (#13213)

fixes a critical times.nim bug reported on IRC [backport] (#13216)

httpclient, maxredirects to Natural, newHttpClient/newAsyncHttpClient add headers argument instead of hardcoded empty (#13207)

added note to re constructor regarding performance (#13224)

Since I was new to regex I did not know that there is a compilation going on with ``re"[abc]"`` constructor and so I followed the other examples in the docs blindly, that is I just put the constructor directly in the arguments of match, find, etc., which was inside a loop and then wondered why my performance was so bad. Of course putting it outside the loop made it vastly more performant. People like me would benefit from the small note I added I would think :)
[backport] Documentation Fix #12251 (#13226) [ci skip]

[backport] times/getClockStr(): fix mistake in doc (#13229) [ci skip]

new os.isRelativeTo (#13212)

[backport] Fix typo and improve in code-block of 'lib/pure/parseutils.nim' (#13231) [ci skip]

[backport] fix #11440, add docs to isNil for seq types needing nilseq (#13234) [ci skip]

VM: allow overriding MaxLoopIterations without rebuilding nim (#13233)

kochdocs: use a glob instead of hardcoded list; generate docs for compiler/; bugfixes (#13221)

* kochdocs: use a glob instead of hardcoded list; generate docs for compiler/; bugfixes
* fixup after #13212 isRelativeTo got merged

fix lots of bugs with parentDir, refs #8734 (#13236)

Unexport even more symbols (#13214)

* system/gc: don't export markStackAndRegisters

* compiler/cgen: unexport internal symbols

As these functions are Nim-specific walkaround against C's optimization
schemes, they don't serve any purpose being exported.

* compiler/cgen: don't export global var unless marked

* compiler/ccgthreadvars: don't export threadvar unless marked

* tests/dll/visibility: also check for exports

This ensure that these changes don't break manual exports.

* compiler/cgen: hide all variables created for constants

* compiler/ccgtypes: don't export RTTI variables

* compiler/ccgexprs: make all complex const static

* nimbase.h: fix export for windows

* compiler/cgen, ccgthreadvars: export variables correctly

For C/C++ variables, `extern` means that the variable is defined in an
another unit. Added a new N_LIB_EXPORT_VAR to correctly export
variables.

Removed lib/system/allocators.nim. seqs_v2 and strs_v2 now uses allocShared0. (#13190)

* Cleanup, remove lib/system/allocators.nim. seqs_v2 and strs_v2 now use
allocShared0 by default.

* Fixed -d:useMalloc allocShared / reallocShared / deallocShared. These now use the alloc/dealloc/realloc implementation that also takes care of zeroing memory at realloc.

* Removed debug printfs

* Removed unpairedEnvAllocs() from tests/destructor/tnewruntime_misc

* More mmdisp cleanups. The shared allocators do not need to zero memory or throw since the regular ones already do that

* Introduced realloc0 and reallocShared0, these procs are now used by
strs_v2 and seqs_v2. This also allowed the -d:useMalloc allocator to
drop the extra header with allocation length.

* Moved strs_v2/seqs_v2 'allocated' flag into 'cap' field

* Added 'getAllocStats()' to get low level alloc/dealloc counters. Enable with -d:allocStats

* *allocShared implementations for boehm and go allocators now depend on the proper *allocImpl procs

[backport] documentation: Add channels examples (#13202) [ci skip]

[backport] Make all parseutils examples auto-checking (#13238)

- Also fix one example's output (ikString -> ikStr, ikVar instead of ikExpr)
Updated 'nim for embedded systems' section to use --os:any and --gc:arc (#13237)

* Updated 'nim for embedded systems' section to use --os:any and --gc:arc

* Added section about size optimization to embedded systems

Remove name attribute from docutils.nimble (#13239)

Fixes asyncftpclient multiline reading, fixes #4684 (#13242)

Previously, the 4th character of `result` was checked for `'-'` every time, instead of each new line.

Also made it work for taint mode.
Fix typo for literal `[` (#13243)

The literal value for the `tkBracketLe` token was incorrectly set to `]` rather than `[`. I've had a quick glance at the code and it doesn't look like this change will affect anything at all, but I haven't tested yet - let's see if the CI explodes...
Add "origin" to window.location (#13251)

Add "origin" to window location: https://www.w3schools.com/jsref/prop_loc_origin.asp
nim dump: add libpath (#13249)

contributing docs: symbols need package prefix; changed allocStats to nimAllocStats (#13247)

testament/azure: major rewrite (#13246)

This commit features a major rewrite of Azure Pipelines integration,
turning the spaghetti it originally was into something maintainable.

Key changes:
- No longer requires a ton of hooks into testament.
- Results are now cached then bulk-uploaded to prevent throttling from
  Azure Pipelines, avoiding costly timeouts.
- A low timeout is also employed to avoid inflated test time.
- The integration is now documented.
Cleaned up mmdisp.nim, moved implementations into lib/system/mm/ (#13254)

make goto based exceptions available for 'nim cpp' (#13244)

* make goto based exceptions available for 'nim cpp'
* optimize seq.add to be comparable to C++'s emplace_back

ARC: remove unnecessary code

ARC: optimize complete object constructors to use nimNewObjUninit

make nre compile with --gc:arc

Rename isNilOrWhitespace to isEmptyOrWhitespace and make it use allCharsInSet (#13258)

* Rename isNilOrWhitespace to isEmptyOrWhitespace

* Make isEmptyOrWhitespace use allCharsInSet(Whitespace)

Clearer final objects error; fixes #13256 (#13257)

scrollTop must be settable (#13263)

* scrollTop must be assignable

Make scrollTop settable

* add missing export

fixes #13219 (#13272)

fixes #13281 (#13282)

* fixes ##13281

* add comment to test

unittest add resetOutputFormatters proc (#13267)

* add resetOutputFormatters

* remove space

* resolve comments

TlSF Alloctor: use less memory for --gc:arc (#13280)

Tiny since cleanup (#13286)

nimv2 widestring indexing (#13279)

Repr v2 progress (#13268)

* progress on repr_v2

* repr progress

* add ref objects with distrinct

* fix failing tests

refactor htmldocs; gitignore it

removed unused import

fix stdout(etc) for emscripten

csize => csize_t for sysctl

Thread attributes should be destroyed using the pthread_attr_destroy() (#13293)

On some OSes (such as FreeBSD or Solaris), pthread_attr_init allocate
memory. So it is necessary to deallocate that memory by using
pthread_attr_destroy.
fix critical bug discovered by #11591 (#13290) [backport]

miscellaneous bug fixes (#13291)

* fix for emscripten etc

* add testcase for #13290

* replace deprecated isNilOrWhitespace

CT FFI: fix for windows; fix case transition; error msg shows more useful context (#13292)

* evalffi: fix case transition
* evalffi: fix for windows
* evallffi: `cannot import` errmsg now also shows which library it tried to import symbol from

refs #8391 std/os now shows runtime context for raiseOSError exceptions (#13294)

* refs #8391: fix errmsg for setCurrentDir

* raiseOSError calls for copyFile

* refs #8391 std/os now shows runtime context for raiseOSError exceptions

build_all.sh: building csources 5X faster thanks to make -j (#13300)

* build_all.sh: building csources 5X faster thanks to make -j
* fix for freebsd
* use OS-dependent formula to get number of logical cores
* make is an optional dependency

Fix capture for object types (#13315)

* Fix capture for object|tuple|... types

* Add test case

Quote nim executable before executing. (#13316) [backport]

In case nim executable is located in PATH containing spaces.

fixes #13311
ReSync with devel

Make build_all.sh more portable and a bit simpler (#13308)

koch: enable checks in the compiler when running CI (#13323)

fix #13132 tnetdial (#13318)

enable testing -d:nimHasLibFFI mode (#13091)

Fix #10717, fix #13284 (#13307)

Fixed codegen for constant cstring with --gc:arc (#13326)

* Fixed codegen for constant cstring with --gc:arc, fixes  #13321

* Added test for #13321

Option to allow the request body to be processed outside the asynchttpserver library. (#13147)

Allow the request body to be processed outside the asynchttpserver library to break big files into chunks of data. This change does not break anything.

build_all.sh update (#13320)

* Don't overload the system, don't crash when you can't determine the CPU count and don't rely on bash

* Extract to variable

* Limit number of spawned jobs for systems with weak IO

* Use proper arithmetic braces

contributing.rst: Add a special rule for 'outplace'-like features

[backport] -d:danger should imply -d:release (#13336)

nim secret: support linenoise when available (#13328)

fix #13150 `nim doc --project` now works reliably (#13223)

* fix #13150 `nim doc --project` works with duplicate names and with imports below main project file

* add to help; fixup after #13212 isRelativeTo got merged
* fix test tests/compilerapi/tcompilerapi.nim
* remove nimblePkg field; compute on the fly instead
* kochdocs: compiler docs now under compiler/
* --docRoot now has smart default: best among @pkg, @path

make monotimes have zero overhead if you don't use it (#13338) [backport]

fix #13349 regression: isNamedTuple now works with generic tuples (#13350)

fixes #13269 (#13344)

adding sqlite3 backup functions (#13346)

* adding sqlite3 backup functions

* changing sleep to sqlite3_sleep to prevent clashes

Added a basic example how to handle a Post request. (#13339)

* Added a basic example how to handle a Post request.

They were also made minor cosmetic changes.

* Minor fixes suggested by Yardanico

* Fixed a wrong value in chunkSize constant.

* Re-added the request.body for compatibility!

replace old problematic isNamedTuple implementation by TypeTrait isNamedTuple in dollars.nim (#13347)

* replace old problematic isNamedTuple implementation by TypeTrait isNamedTuple

* fix for bootstrap

fix #13182: `proc fun(a: varargs[Foo, conv])` now can be overloaded (#13345) [backport]

miscellaneous bug fixes (part 3) (#13304)

* fix deprecation; fix indentation

* git clone: use -q

* fix Warning: pragma before generic parameter list is deprecated; fix typo

* bugfix: sysTypeFromName("float64") was never cached

testament: introduce 'matrix' for testing multiple options (#13343)

printing float values will have one more digit. (#13276) [backport]

* printing float values will have one more digit. Fixes #13196

[backport] fix #13352

[backport] remove 'CountTable.mget' (#13355)

It didn't work, and it was an oversight to be included in v1.0.
fix #6736: templates in unittest now show actual value (#13354)

Revert "printing float values will have one more digit. (#13276) [backport]" (#13363)

This reverts commit b2c6db9.
Add sideEffect pragma to importC procs in posix, winlean and time module (#13370)

* Add sideEffect pragma to procs in winlean
* Add sideEffect pragma to procs in posix
* Add test for #13306
* Add sideEffect pragma to procs in times
* Fixes #13306
fixes #3339 by documenting the limitations of case-statement (#13366)

fixes #13314 (#13372)

testament: this now works: "testament r /abspath/to/test.nim" (#13358)

fix `is` with generic types; fix `genericHead(Foo[T])` (#13303)

* fix #9855, fix #9855, fix genericHead
* render TTypeKind via toHumanStr

fix #13255 (#13275) [backport]

remove outplace version of 'merge' for CountTables (#13377)

* remove outplace version of 'merge' for CountTables

* remove 'merge' tests

fix #13374 `nim c -r -` now generates $nimcache/stdinfile (#13380) [backport]

fix #9634 don't crash on execCmdEx/readLine when inside gdb/lldb (#13232)

* fix #9634 debugging a program using execCmdEx now works

* only apply EINTR to c_gets for now

This reverts commit c0f5305.

lib.rst: add a link for jsconsole [backport] (#13383)

Make vccexe parse response files (#13329)

expectLen now shows the length that we got (#13387)

fix several bugs with `repr`  (#13386)

fixes #13378 [backport] (#13392)

remove dead code test_nimhcr_integration.(bat,sh) (#13388)

* enable test for osx: import tests/dll/nimhcr_integration

* re-disable osx test

fix linenoise regression (#13395)

* fix nightlies linenoise regression

* fix other installers

Revert "remove dead code test_nimhcr_integration.(bat,sh) (#13388)" (#13396)

This reverts commit 90491ea.
fixes #13368 (#13397)

fix bug in int128 (#13403)

isolate the build process from external config files (#13411)

add ggplotnim to important_packages (#13206)

Fix to asynchttpserver form data/body broken with #13147 (#13394)

* Fix to asynchttpserver form data/body broken with #13147
* New implementation that use a interator instance of future streams
* asynchttpserver now can handle chunks of data.

Merge branch 'devel' of https://github.com/nim-lang/Nim into osopen

Squash Commits; Peer review feedbacks #12901 (comment)
narimiran pushed a commit to narimiran/Nim that referenced this issue Feb 19, 2020
* Add osOpen alias for the operating system specific open command

* Add `--git.devel` option to the documentation
remove unused import (nim-lang#12900)

fix json regression D20191212T144944 (nim-lang#12902) [backport]

Peer Review Feedback nim-lang#12901 (comment)

Merge branch 'devel' of https://github.com/nim-lang/Nim into osopen

Peer Review Feedback nim-lang#12901 (comment)

Update lib/pure/browsers.nim

Co-Authored-By: Dominik Picheta <dominikpicheta@googlemail.com>
Peer Review Feedback nim-lang#12901 (comment)

allow typed/untyped in magic procs (nim-lang#12911)

NaN floatFormat with clang_cl  (nim-lang#12910)

* clang_cl nan floatFormat

* format

add $nimeq for gdb (nim-lang#12909)

ARC: cycle detector (nim-lang#12823)

* first implementation of the =trace and =dispose hooks for the cycle collector
* a cycle collector for ARC: progress
* manual: the .acyclic pragma is a thing once again
* gcbench: adaptations for --gc:arc
* enable valgrind tests for the strutils tests
* testament: better valgrind support
* ARC refactoring: growable jumpstacks
* ARC cycle detector: non-recursive algorithm
* moved and renamed core/ files back to system/
* refactoring: --gc:arc vs --gc:orc since 'orc' is even more experimental and we want to ship --gc:arc soonish

Cleanup leftovers of nim-lang#12911(nim-lang#12916)

Fix single match output (nim-lang#12920)

fixes nim-lang#12899 (nim-lang#12921)

* fixes nim-lang#12899

* fixes regression: destroy global variables in reverse declaration order, closureleak test relies on it

Implement NixOS distro check (nim-lang#12914)

Better case coverage error message for alias and range enum (nim-lang#12913)

fix error in assertions document (nim-lang#12925) [backport]

fix cmdline bugs affecting nimBetterRun correctness (nim-lang#12933) [backport]

fix nim-lang#12919 tasyncclosestall flaky: Address already in use (nim-lang#12934)

system.reset is no longer magic (nim-lang#12937)

It has now means setting x to default for new and old runtime alike
Fix nim-lang#12785 (nim-lang#12943)

* Fix nim-lang#12785 and add test

* better variable name

update documentation for `closureScope` and `capture` (nim-lang#12886)

fixes nim-lang#12735 on osx, call dsymutil for debug builds (nim-lang#12931)

* fix nim-lang#12735 osx: dsymutil needs to be called for debug builds
* also write dsymutil command to extraCmds in json build file

Auto-initialize deques (nim-lang#12879)

case coverage error message for `char` (nim-lang#12948)

lenVarargs: number of varargs elements (nim-lang#12907)

docs: tiny style improvements

added guidelines for evolving Nim's stdlib

fixes a bug that kept sugar.collect from working with for loop macros [backport]

fixes nim-lang#12826

fixes a regression

a better bugfix

fixes a test case

fixes a silly regression

fixes the distros.nim regression

ported channels to ARC

ported osproc.nim to ARC

ported re.nim to ARC

ARC: default to a shared heap with --threads:on

osproc: fixes regression

fixes another regression

fixes nim-lang#12945 (nim-lang#12959)

minor refactorings

Fixes stackoverflow links in readme (nim-lang#12963) [backport]

Allow customize Host header
[ci skip] docfix .. < => ..< (nim-lang#12981) [backport]

parsecfg: retain CRLF line breaks, fixes nim-lang#12970 (nim-lang#12971)

generic stack trace overriding mechanism (nim-lang#12922)

* libbacktrace support

* switch to a generic stack trace overriding mechanism

When "nimStackTraceOverride" is defined, once of the imported modules
can register its own procedure to replace the default stack trace
generation by calling `registerStackTraceOverride(myOwnProc)`.

Tested with `./koch boot -d:release --debugger:native -d:nimStackTraceOverride --import:libbacktrace`
for the compiler itself and `./bin/nim c -r -f --stacktrace:off --debugger:native -d:nimStackTraceOverride --import:libbacktrace foo.nim`
for an external program.

* make the StackTraceOverrideProc {.noinline.}

Added fix for handling TaintedStrings in streams and httpclient (nim-lang#12969)

* Added fix for taint mode in streams and httpclient

* Removed taintMode export from system.nim

Check pqntuples > 0 in getValue. Fixes nim-lang#12973 (nim-lang#12974)

c_fflush() the rawWrite() buffer (nim-lang#12987)

Stack traces on an unbuffered stderr get out of sync with line-buffered
stdout - usually on Windows terminals or CI logs. This fixes it by
calling C's fflush() on the output buffer in the procedure used for
printing stack traces.
fixes nim-lang#12989

Revert "fixes nim-lang#12989"

This reverts commit 928c2fe.

fixes nim-lang#12965 (nim-lang#12991)

fixes nim-lang#12989 (nim-lang#12992)

* fixes nim-lang#12989
* Revert "remove unwanted changes"

This reverts commit 5018297.

fixes disruptek/nimph#102 multi-level nim.cfg use (nim-lang#13001) [backport]

--exception:goto switch for deterministic exception handling (nim-lang#12977)

This implements "deterministic" exception handling for Nim based on goto instead of setjmp. This means raising an exception is much cheaper than in C++'s table based implementations. Supports hard realtime systems. Default for --gc:arc and the C target because it's generally a good idea and arc is all about deterministic behavior.

Note: This implies that fatal runtime traps are not catchable anymore! This needs to be documented.
fix nim-lang#12985 {.push.} now does not apply to generic instantiations (nim-lang#12986)

Sink to MemMove optimization in injectdestructors (nim-lang#13002)

remove default argument for readLines (nim-lang#12807) [backport]

fixes nim-lang#12978 (nim-lang#13012)

Fix typo (nim-lang#13015) [backport]

fixes nim-lang#12961 (nim-lang#13019)

fixes nim-lang#12956 (nim-lang#13020)

fix nim-lang#12988 (nim-lang#13022)

fix nim-lang#12988
Fixes nim-lang#13026 (nim-lang#13028)

fixes nim-lang#12964 (nim-lang#13027)

fixes nim-lang#13032

VM: support importc var, ptr/pointer types, cast int <=> ptr/pointer (nim-lang#12877)

* VM: allow certain hardcoded special var variables at CT
* VM: allow all importc var, cast[int](ptr)
* fix tests tests/vm/tstaticprintseq.nim, tests/cpp/t8241.nim
* VM: == works for ptr/pointer nodes
* bugfix: ==, cast now also works for pointer, not just ptr
* VM supports cast PtrLikeKinds <=> PtrLikeKinds / int
* improve cname handling
* fixup + bug fix
* VM: support cast from ref to int
* address comment: opcLdGlobalDeref => opcLdGlobalDerefFFI
* defensive check against typ == nil

fix enumtostr crash for enum-range (nim-lang#13035)

fixes nim-lang#13013, reverts previous changes to readLines() (nim-lang#13036) [backport]

* Revert "remove default argument for readLines (nim-lang#12807) [backport]"

This reverts commit c949b81.

reprjs: style changes

fixes nim-lang#12996

Rst parser respect `:start-after:` and `:end-before:` in `include` directive (nim-lang#12972)

* [FEATURE] rst parser respect :start-after: in include

Rst parser now respects `:start-after:` and `:end-before:` attributes
for `include` directive.

* [DOC] include directive parsing proc update

* [TEST] Added unit tests for include rst directive in `rst` module

Allow `-o` option for `buildIndex` (nim-lang#13037) [backport]

Addressing nim-lang#12771

This is also included in the docgen documentation [here](https://nim-lang.org/docs/docgen.html) but its not respected as reported in the issue.
[cleanup] remove disabled (and obsolete) ttypetraits; rename ttypetraits2 => ttypetraits (nim-lang#13041)

* remove disabled (and obsolete) ttypetraits; rename ttypetraits2 => ttypetraits

* D20200105T085828 fix super strange bug that causes CI to fail: builds.sr.ht with: `Error: Settle timed out after 120 attempts`

Continue nim-lang#13002 (nim-lang#13021)

testament/important_packages dont run hts (nim-lang#13052)

Modify the test command for nimly (nimble-package) (nim-lang#13053)

clean up deprecated stuff and unused imports in tests (nim-lang#13059)

--styleCheck:hint now works (nim-lang#13055)

[easy] --hint:link:on now shows link cmd instead of nothing (nim-lang#13056)

* --hint:link:on now shows link cmd instead of nothing

* update doc for --listCmd

add pqserverVersion,pqconnectionNeedsPassword,pqconnectionUsedPassword (nim-lang#13060)

basename supports pragmaexpr (nim-lang#13045)

* basename supports pragmaexpr

* update changelog

distinctBase type trait for distinct types (nim-lang#13031)

make SuccessX show project file + output file (nim-lang#13043)

* make SuccessX show project file + output file
* address comments
* fix test and add `result.err = reNimcCrash` otherwise hard to see where reNimcCrash used
* address comments

move entries from the wrong changelog file [ci skip]

fix crash due to errant symbols in nim.cfg (nim-lang#13073) [backport]

Deleted misplaced separator (nim-lang#13085) [backport]

Misplaced separator, which was constantly breaking compilation on Haiku OS, was deleted.
take the one good idea from --os:standalone and enable it via -d:StandaloneHeapSize (nim-lang#13077)

remove all remaining warnings when build nim (with -d:nimHasLibFFI) (nim-lang#13084)

* cleanup deprecations in evalffi + elsewhere

* remove dead code getOrdValue64

Use '__noinline' instead of 'noinline' for N_NOINLINE gcc attribute, this prevents clashes with systems where 'noinline' might be already defined (nim-lang#13089)

Fix error check code in osproc (nim-lang#13090) [backport]

fixes nim-lang#13072; no test case because it will be added later with more exception handling related bugfixes

fixes nim-lang#13070

typetraits: fixes nim-lang#6454; genericParams; added lenTuple; added tuple type get (nim-lang#13064)

[backport] system/io.nim fix wrong documentation comment [ci skip]

fixes an asyncftpclient bug; refs nim-lang#13096 [backport]

System cleanup, part 1 (nim-lang#13069)

* system.nim: mark what every .pop does

* system.nim: un-nest when statements

[backport] fix nim-lang#12813, fix nim-lang#13079 (nim-lang#13099)

Correctly remove a key from CountTable when it is set to zero.
more arc features (nim-lang#13098)

* config update
* ARC now supports 'repr' and 'new' with finalizers is supported

Remove some unused/disabled OpenSSL functions (nim-lang#13106)

Add link to posix_utils.html in posix.nim (nim-lang#13111)

VM FFI: write(stderr, msg) and fprintf(cstderr, msg) now work at CT (nim-lang#13083)

fix the ftp store function read the local file bug (nim-lang#13108) [backport]

* Update asyncftpclient.nim

When use newStringOfCap function not have assign memory for the string data,so if use this address the fault is rasise.

* complelete the bugfix

fix rtti sizeof for varargs in global scope (nim-lang#13125) [backport]

fixes nim-lang#13122 (nim-lang#13126)

* fixes nim-lang#13122

* moved tests to where they belong

fixes nim-lang#13112 (nim-lang#13127)

* improve line error information

* fixes nim-lang#13112

Expose more openSSL methods. (nim-lang#13131)

fixes nim-lang#13100 nim doc now treats `export localSymbol` correctly (nim-lang#13123) [backport]

* fix nim-lang#13100 nim doc now treats `export localSymbol` correctly
* use owner instead

fixes nim-lang#13119 (nim-lang#13128)

* fixes nim-lang#13119
* fixes a regression

fixes nim-lang#13105 (nim-lang#13138)

fixes nim-lang#10665 (nim-lang#13141) [backport]

pass platform argument only if vccexe is used (nim-lang#13078)

* pass platform only if vccexe is used
* fixes nim-lang#12297

fixes nim-lang#13104 [backport] (nim-lang#13142)

fixes nim-lang#9674 [backport] (nim-lang#13143)

Fix typo in doc/destructors.rst (nim-lang#13148)

Added 'ansic' os support for minimal (embedded) targets (nim-lang#13088)

* os:any implementation
* os:asny: omit flock/funlock calls in echoBinSafe
* Disabled default "unhandled expection" reporting for `--os:any` to reduce
code size. Added unhandledExceptionHook instead which can be used to get
a notification from Nim and handle it from the application.

System cleanup, part 2 (nim-lang#13155)

* create basic_types, arithmetics, exceptions, comparisons
* create setops.nim
* create memalloc.nim
* create gc_interface.nim
* create iterators_1.nim

export normalizePathEnd (nim-lang#13152)

successX now correctly shows html output for `nim doc`, `nim jsondoc`; fix nim-lang#13121 (nim-lang#13116)

* successX now correctly shows html output for nim doc
* fixes nim-lang#13121
* fixup hintSuccessX to be less weird

ARC: misc bugfixes (nim-lang#13156)

* fixes nim-lang#13102
* closes nim-lang#13149
* ARC: fixes a move optimizer bug (there are more left regarding array and tuple indexing)
* proper fix; fixes nim-lang#12957
* fixes yet another case object '=' code generation problem

CI fix timeout error (nim-lang#13134)

Remove obsolete code from osalloc (nim-lang#13158)

style fix: change 'JS' to 'js' to make it consistent (nim-lang#13168)

Working towards arc codegen (nim-lang#13153)

fixes nim-lang#13029
fixes nim-lang#12998 nim doc regression (nim-lang#13117)

fix tsizeof3 for aarch64 (nim-lang#13169)

Cleanup DFA (nim-lang#13173)

Fix docs (nim-lang#13176)

fixes nim-lang#13095 (nim-lang#13181)

* fixes nim-lang#13095

* fix typo

make case-object transitions explicit, make unknownLineInfo a const, replace a few magic numbers with consts (nim-lang#13170)

ARC works for async on Windows (nim-lang#13179)

make sink operator optional (nim-lang#13068)

* make sink operator optional

* bug fix, add changelog entry

* Trigger build

* fix one regression

* fix test

* Trigger build

* fix typos

Fix docs for subdirs too (nim-lang#13180)

* Fix doc subdirs
* Extract to helper proc, and fix on windows

followup on nim-lang#10435 : should be diff, not show (nim-lang#13162)

fixes nim-lang#13157

refs nim-lang#13054 correctly handle {.exportc,dynlib.} and {.exportcpp,dynlib.}  (nim-lang#13136)

* refs nim-lang#13054 correctly handle {.exportc,dynlib.} and {.exportcpp,dynlib.}
* put back NIM_EXTERNC for N_LIB_EXPORT; causes issues with compilerproc

fixes nim-lang#13144 (nim-lang#13145)

* fixup: genscript now does not copy nimbase.h but uses -I$nim/lib

times: toUnixFloat, fromUnixFloat (nim-lang#13044)

maybe: allows optional chaining of field access and indexing when LHS i snil (nim-lang#13023)

* maybe: allows optional chaining
* fix tools/kochdocs.nim
* improve semantics to distinguish valid from invalid values
* for now, wrapnil, isValid, unwrap are not exported

fix docs + API for fieldPairs, fields (nim-lang#13189)

more on arc codegen (nim-lang#13178)

* arc codegen for union type

* add more tests

* fix offsetof

* fix tsizeof test

* fix style

Add link to packaging.html (nim-lang#13194)

Fixes nim-lang#13186 (nim-lang#13188)

fixes nim-lang#13195

revert last commit

Merge branch 'devel' of https://github.com/nim-lang/Nim into devel

Revert "fixes nim-lang#13195"

This reverts commit cd7904f.

fixes nim-lang#13110 (nim-lang#13197)

fixes nim-lang#13195 (nim-lang#13198)

* fixes nim-lang#13195

* extra fix

* fix typo

compiler/ccgtypes: hide exportc proc unless it has dynlib (nim-lang#13199)

This hides most of stdlib's internal functions from resulting
binaries/libraries, where they aren't needed on *nix. Static libraries
are not affected by this change (visibility doesn't apply to them).
fix range[enum] type conversion (nim-lang#13204) [backport]

Idxmin & idxmax, continuation (nim-lang#13208)

* Add idxmin() which returns the index of the minimum value

* Add idxmax() which returns the index of the maximum value

* Add tests for idxmin()

* Add tests for idxmax()

* Remove initialization of result = 0

* Adds overloading for arrays (no enums indexed arrays yet)

* Add support for enum index arrays

* Fix tests with enum

* Fix tests for idxmax

* Change names of the procedures to minIndex and maxIndex

* address Araq's comments:

- remove 'array' versions
- add .since pragma
- return 'int' instead of 'Natural'
- add changelog entry

Co-authored-by: Federico A. Corazza <20555025+Imperator26@users.noreply.github.com>

fix nim-lang#13211 relativePath("foo", ".") (nim-lang#13213)

fixes a critical times.nim bug reported on IRC [backport] (nim-lang#13216)

httpclient, maxredirects to Natural, newHttpClient/newAsyncHttpClient add headers argument instead of hardcoded empty (nim-lang#13207)

added note to re constructor regarding performance (nim-lang#13224)

Since I was new to regex I did not know that there is a compilation going on with ``re"[abc]"`` constructor and so I followed the other examples in the docs blindly, that is I just put the constructor directly in the arguments of match, find, etc., which was inside a loop and then wondered why my performance was so bad. Of course putting it outside the loop made it vastly more performant. People like me would benefit from the small note I added I would think :)
[backport] Documentation Fix nim-lang#12251 (nim-lang#13226) [ci skip]

[backport] times/getClockStr(): fix mistake in doc (nim-lang#13229) [ci skip]

new os.isRelativeTo (nim-lang#13212)

[backport] Fix typo and improve in code-block of 'lib/pure/parseutils.nim' (nim-lang#13231) [ci skip]

[backport] fix nim-lang#11440, add docs to isNil for seq types needing nilseq (nim-lang#13234) [ci skip]

VM: allow overriding MaxLoopIterations without rebuilding nim (nim-lang#13233)

kochdocs: use a glob instead of hardcoded list; generate docs for compiler/; bugfixes (nim-lang#13221)

* kochdocs: use a glob instead of hardcoded list; generate docs for compiler/; bugfixes
* fixup after nim-lang#13212 isRelativeTo got merged

fix lots of bugs with parentDir, refs nim-lang#8734 (nim-lang#13236)

Unexport even more symbols (nim-lang#13214)

* system/gc: don't export markStackAndRegisters

* compiler/cgen: unexport internal symbols

As these functions are Nim-specific walkaround against C's optimization
schemes, they don't serve any purpose being exported.

* compiler/cgen: don't export global var unless marked

* compiler/ccgthreadvars: don't export threadvar unless marked

* tests/dll/visibility: also check for exports

This ensure that these changes don't break manual exports.

* compiler/cgen: hide all variables created for constants

* compiler/ccgtypes: don't export RTTI variables

* compiler/ccgexprs: make all complex const static

* nimbase.h: fix export for windows

* compiler/cgen, ccgthreadvars: export variables correctly

For C/C++ variables, `extern` means that the variable is defined in an
another unit. Added a new N_LIB_EXPORT_VAR to correctly export
variables.

Removed lib/system/allocators.nim. seqs_v2 and strs_v2 now uses allocShared0. (nim-lang#13190)

* Cleanup, remove lib/system/allocators.nim. seqs_v2 and strs_v2 now use
allocShared0 by default.

* Fixed -d:useMalloc allocShared / reallocShared / deallocShared. These now use the alloc/dealloc/realloc implementation that also takes care of zeroing memory at realloc.

* Removed debug printfs

* Removed unpairedEnvAllocs() from tests/destructor/tnewruntime_misc

* More mmdisp cleanups. The shared allocators do not need to zero memory or throw since the regular ones already do that

* Introduced realloc0 and reallocShared0, these procs are now used by
strs_v2 and seqs_v2. This also allowed the -d:useMalloc allocator to
drop the extra header with allocation length.

* Moved strs_v2/seqs_v2 'allocated' flag into 'cap' field

* Added 'getAllocStats()' to get low level alloc/dealloc counters. Enable with -d:allocStats

* *allocShared implementations for boehm and go allocators now depend on the proper *allocImpl procs

[backport] documentation: Add channels examples (nim-lang#13202) [ci skip]

[backport] Make all parseutils examples auto-checking (nim-lang#13238)

- Also fix one example's output (ikString -> ikStr, ikVar instead of ikExpr)
Updated 'nim for embedded systems' section to use --os:any and --gc:arc (nim-lang#13237)

* Updated 'nim for embedded systems' section to use --os:any and --gc:arc

* Added section about size optimization to embedded systems

Remove name attribute from docutils.nimble (nim-lang#13239)

Fixes asyncftpclient multiline reading, fixes nim-lang#4684 (nim-lang#13242)

Previously, the 4th character of `result` was checked for `'-'` every time, instead of each new line.

Also made it work for taint mode.
Fix typo for literal `[` (nim-lang#13243)

The literal value for the `tkBracketLe` token was incorrectly set to `]` rather than `[`. I've had a quick glance at the code and it doesn't look like this change will affect anything at all, but I haven't tested yet - let's see if the CI explodes...
Add "origin" to window.location (nim-lang#13251)

Add "origin" to window location: https://www.w3schools.com/jsref/prop_loc_origin.asp
nim dump: add libpath (nim-lang#13249)

contributing docs: symbols need package prefix; changed allocStats to nimAllocStats (nim-lang#13247)

testament/azure: major rewrite (nim-lang#13246)

This commit features a major rewrite of Azure Pipelines integration,
turning the spaghetti it originally was into something maintainable.

Key changes:
- No longer requires a ton of hooks into testament.
- Results are now cached then bulk-uploaded to prevent throttling from
  Azure Pipelines, avoiding costly timeouts.
- A low timeout is also employed to avoid inflated test time.
- The integration is now documented.
Cleaned up mmdisp.nim, moved implementations into lib/system/mm/ (nim-lang#13254)

make goto based exceptions available for 'nim cpp' (nim-lang#13244)

* make goto based exceptions available for 'nim cpp'
* optimize seq.add to be comparable to C++'s emplace_back

ARC: remove unnecessary code

ARC: optimize complete object constructors to use nimNewObjUninit

make nre compile with --gc:arc

Rename isNilOrWhitespace to isEmptyOrWhitespace and make it use allCharsInSet (nim-lang#13258)

* Rename isNilOrWhitespace to isEmptyOrWhitespace

* Make isEmptyOrWhitespace use allCharsInSet(Whitespace)

Clearer final objects error; fixes nim-lang#13256 (nim-lang#13257)

scrollTop must be settable (nim-lang#13263)

* scrollTop must be assignable

Make scrollTop settable

* add missing export

fixes nim-lang#13219 (nim-lang#13272)

fixes nim-lang#13281 (nim-lang#13282)

* fixes #nim-lang#13281

* add comment to test

unittest add resetOutputFormatters proc (nim-lang#13267)

* add resetOutputFormatters

* remove space

* resolve comments

TlSF Alloctor: use less memory for --gc:arc (nim-lang#13280)

Tiny since cleanup (nim-lang#13286)

nimv2 widestring indexing (nim-lang#13279)

Repr v2 progress (nim-lang#13268)

* progress on repr_v2

* repr progress

* add ref objects with distrinct

* fix failing tests

refactor htmldocs; gitignore it

removed unused import

fix stdout(etc) for emscripten

csize => csize_t for sysctl

Thread attributes should be destroyed using the pthread_attr_destroy() (nim-lang#13293)

On some OSes (such as FreeBSD or Solaris), pthread_attr_init allocate
memory. So it is necessary to deallocate that memory by using
pthread_attr_destroy.
fix critical bug discovered by nim-lang#11591 (nim-lang#13290) [backport]

miscellaneous bug fixes (nim-lang#13291)

* fix for emscripten etc

* add testcase for nim-lang#13290

* replace deprecated isNilOrWhitespace

CT FFI: fix for windows; fix case transition; error msg shows more useful context (nim-lang#13292)

* evalffi: fix case transition
* evalffi: fix for windows
* evallffi: `cannot import` errmsg now also shows which library it tried to import symbol from

refs nim-lang#8391 std/os now shows runtime context for raiseOSError exceptions (nim-lang#13294)

* refs nim-lang#8391: fix errmsg for setCurrentDir

* raiseOSError calls for copyFile

* refs nim-lang#8391 std/os now shows runtime context for raiseOSError exceptions

build_all.sh: building csources 5X faster thanks to make -j (nim-lang#13300)

* build_all.sh: building csources 5X faster thanks to make -j
* fix for freebsd
* use OS-dependent formula to get number of logical cores
* make is an optional dependency

Fix capture for object types (nim-lang#13315)

* Fix capture for object|tuple|... types

* Add test case

Quote nim executable before executing. (nim-lang#13316) [backport]

In case nim executable is located in PATH containing spaces.

fixes nim-lang#13311
ReSync with devel

Make build_all.sh more portable and a bit simpler (nim-lang#13308)

koch: enable checks in the compiler when running CI (nim-lang#13323)

fix nim-lang#13132 tnetdial (nim-lang#13318)

enable testing -d:nimHasLibFFI mode (nim-lang#13091)

Fix nim-lang#10717, fix nim-lang#13284 (nim-lang#13307)

Fixed codegen for constant cstring with --gc:arc (nim-lang#13326)

* Fixed codegen for constant cstring with --gc:arc, fixes  nim-lang#13321

* Added test for nim-lang#13321

Option to allow the request body to be processed outside the asynchttpserver library. (nim-lang#13147)

Allow the request body to be processed outside the asynchttpserver library to break big files into chunks of data. This change does not break anything.

build_all.sh update (nim-lang#13320)

* Don't overload the system, don't crash when you can't determine the CPU count and don't rely on bash

* Extract to variable

* Limit number of spawned jobs for systems with weak IO

* Use proper arithmetic braces

contributing.rst: Add a special rule for 'outplace'-like features

[backport] -d:danger should imply -d:release (nim-lang#13336)

nim secret: support linenoise when available (nim-lang#13328)

fix nim-lang#13150 `nim doc --project` now works reliably (nim-lang#13223)

* fix nim-lang#13150 `nim doc --project` works with duplicate names and with imports below main project file

* add to help; fixup after nim-lang#13212 isRelativeTo got merged
* fix test tests/compilerapi/tcompilerapi.nim
* remove nimblePkg field; compute on the fly instead
* kochdocs: compiler docs now under compiler/
* --docRoot now has smart default: best among @pkg, @path

make monotimes have zero overhead if you don't use it (nim-lang#13338) [backport]

fix nim-lang#13349 regression: isNamedTuple now works with generic tuples (nim-lang#13350)

fixes nim-lang#13269 (nim-lang#13344)

adding sqlite3 backup functions (nim-lang#13346)

* adding sqlite3 backup functions

* changing sleep to sqlite3_sleep to prevent clashes

Added a basic example how to handle a Post request. (nim-lang#13339)

* Added a basic example how to handle a Post request.

They were also made minor cosmetic changes.

* Minor fixes suggested by Yardanico

* Fixed a wrong value in chunkSize constant.

* Re-added the request.body for compatibility!

replace old problematic isNamedTuple implementation by TypeTrait isNamedTuple in dollars.nim (nim-lang#13347)

* replace old problematic isNamedTuple implementation by TypeTrait isNamedTuple

* fix for bootstrap

fix nim-lang#13182: `proc fun(a: varargs[Foo, conv])` now can be overloaded (nim-lang#13345) [backport]

miscellaneous bug fixes (part 3) (nim-lang#13304)

* fix deprecation; fix indentation

* git clone: use -q

* fix Warning: pragma before generic parameter list is deprecated; fix typo

* bugfix: sysTypeFromName("float64") was never cached

testament: introduce 'matrix' for testing multiple options (nim-lang#13343)

printing float values will have one more digit. (nim-lang#13276) [backport]

* printing float values will have one more digit. Fixes nim-lang#13196

[backport] fix nim-lang#13352

[backport] remove 'CountTable.mget' (nim-lang#13355)

It didn't work, and it was an oversight to be included in v1.0.
fix nim-lang#6736: templates in unittest now show actual value (nim-lang#13354)

Revert "printing float values will have one more digit. (nim-lang#13276) [backport]" (nim-lang#13363)

This reverts commit b2c6db9.
Add sideEffect pragma to importC procs in posix, winlean and time module (nim-lang#13370)

* Add sideEffect pragma to procs in winlean
* Add sideEffect pragma to procs in posix
* Add test for nim-lang#13306
* Add sideEffect pragma to procs in times
* Fixes nim-lang#13306
fixes nim-lang#3339 by documenting the limitations of case-statement (nim-lang#13366)

fixes nim-lang#13314 (nim-lang#13372)

testament: this now works: "testament r /abspath/to/test.nim" (nim-lang#13358)

fix `is` with generic types; fix `genericHead(Foo[T])` (nim-lang#13303)

* fix nim-lang#9855, fix nim-lang#9855, fix genericHead
* render TTypeKind via toHumanStr

fix nim-lang#13255 (nim-lang#13275) [backport]

remove outplace version of 'merge' for CountTables (nim-lang#13377)

* remove outplace version of 'merge' for CountTables

* remove 'merge' tests

fix nim-lang#13374 `nim c -r -` now generates $nimcache/stdinfile (nim-lang#13380) [backport]

fix nim-lang#9634 don't crash on execCmdEx/readLine when inside gdb/lldb (nim-lang#13232)

* fix nim-lang#9634 debugging a program using execCmdEx now works

* only apply EINTR to c_gets for now

This reverts commit c0f5305.

lib.rst: add a link for jsconsole [backport] (nim-lang#13383)

Make vccexe parse response files (nim-lang#13329)

expectLen now shows the length that we got (nim-lang#13387)

fix several bugs with `repr`  (nim-lang#13386)

fixes nim-lang#13378 [backport] (nim-lang#13392)

remove dead code test_nimhcr_integration.(bat,sh) (nim-lang#13388)

* enable test for osx: import tests/dll/nimhcr_integration

* re-disable osx test

fix linenoise regression (nim-lang#13395)

* fix nightlies linenoise regression

* fix other installers

Revert "remove dead code test_nimhcr_integration.(bat,sh) (nim-lang#13388)" (nim-lang#13396)

This reverts commit 90491ea.
fixes nim-lang#13368 (nim-lang#13397)

fix bug in int128 (nim-lang#13403)

isolate the build process from external config files (nim-lang#13411)

add ggplotnim to important_packages (nim-lang#13206)

Fix to asynchttpserver form data/body broken with nim-lang#13147 (nim-lang#13394)

* Fix to asynchttpserver form data/body broken with nim-lang#13147
* New implementation that use a interator instance of future streams
* asynchttpserver now can handle chunks of data.

Merge branch 'devel' of https://github.com/nim-lang/Nim into osopen

Squash Commits; Peer review feedbacks nim-lang#12901 (comment)

(cherry picked from commit ba25f84)
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Apr 5, 2020
Changelog:
# v1.2.0 - 2020-04-02

## Standard library additions and changes

- Added overloaded `strformat.fmt` macro that use specified characters as
  delimiter instead of '{' and '}'.
- Added new procs in `tables.nim`: `OrderedTable.pop`, `CountTable.del`,
  `CountTable.pop`, `Table.pop`.
- Added `strtabs.clear` overload that reuses the existing mode.
- Added `browsers.osOpen` const alias for the operating system specific *"open"* command.
- Added `sugar.dup` for turning in-place algorithms like `sort` and `shuffle`
  into operations that work on a copy of the data and return the mutated copy,
  like the existing `sorted` does.
- Added `sugar.collect` that does comprehension for seq/set/table collections.
- Added `sugar.capture` for capturing some local loop variables when creating a
  closure. This is an enhanced version of `closureScope`.
- Added `typetraits.tupleLen` to get number of elements of a tuple/type tuple,
  and `typetraits.get` to get the ith element of a type tuple.
- Added `typetraits.genericParams` to return a tuple of generic params from a
  generic instantiation.
- `options` now treats `proc` like other pointer types, meaning `nil` proc variables
  are converted to `None`.
- Added `os.normalizePathEnd` for additional path sanitization.
- Added `times.fromUnixFloat,toUnixFloat`, sub-second resolution versions of
  `fromUnix`,`toUnixFloat`.
- Added `wrapnils` module for chains of field-access and indexing where the LHS
  can be nil. This simplifies code by reducing need for if-else branches around
  intermediate maybe nil values. E.g. `echo ?.n.typ.kind`.
- Added `minIndex`, `maxIndex` and `unzip` to the `sequtils` module.
- Added `os.isRelativeTo` to tell whether a path is relative to another.
- Added `resetOutputFormatters` to `unittest`.
- Added `expectIdent` to the `macros` module.
- Added `os.isValidFilename` that returns `true` if `filename` argument is valid
  for cross-platform use.
- Added `times.isLeapDay`
- `base64` adds URL-Safe Base64, implements RFC-4648 Section-7.
- Added a new module, `std / compilesettings` for querying the compiler about
  diverse configuration settings.
- Added `net.getPeerCertificates` and `asyncnet.getPeerCertificates` for
  retrieving the verified certificate chain of the peer we are connected to
  through an SSL-wrapped `Socket`/`AsyncSocket`.
- Added `browsers.openDefaultBrowser` without URL, implements IETF RFC-6694 Section-3.
- Added `jsconsole.trace`, `jsconsole.table`, `jsconsole.exception` for JavaScript target.
- Added `distinctBase` overload for values: `assert 12.MyInt.distinctBase == 12`
- Added new module `std/stackframes`, in particular `setFrameMsg`, which enables
  custom runtime annotation of stackframes, see #13351 for examples.
  Turn on/off via `--stackTraceMsgs:on/off`.
- Added `sequtils.countIt`, allowing for counting items using a predicate.
- Added a `with` macro for easy function chaining that's available everywhere,
  there is no need to concern your APIs with returning the first argument
  to enable "chaining", instead use the dedicated macro `with` that
  was designed for it. For example:

```nim
type
  Foo = object
    col, pos: string

proc setColor(f: var Foo; r, g, b: int) = f.col = $(r, g, b)
proc setPosition(f: var Foo; x, y: float) = f.pos = $(x, y)

var f: Foo
with(f, setColor(2, 3, 4), setPosition(0.0, 1.0))
echo f
```

- `macros.newLit` now works for ref object types.
- `macro pragmas` can now be used in type sections.
- 5 new pragmas were added to Nim in order to make the upcoming tooling more
  convenient to use. Nim compiler checks these pragmas for syntax but otherwise
  ignores them. The pragmas are `requires`, `ensures`, `assume`, `assert`, `invariant`.
- `system.writeFile` has been overloaded to also support `openarray[byte]`.
- `asyncdispatch.drain` now properly takes into account `selector.hasPendingOperations`
  and only returns once all pending async operations are guaranteed to have completed.
- `sequtils.zip` now returns a sequence of anonymous tuples i.e. those tuples
  now do not have fields named "a" and "b".
- `distinctBase` has been moved from `sugar` to `typetraits` and now it is
  implemented as compiler type trait instead of macro. `distinctBase` in sugar
  module is now deprecated.
- `CountTable.mget` has been removed from `tables.nim`. It didn't work, and it
  was an oversight to be included in v1.0.
- `tables.merge(CountTable, CountTable): CountTable` has been removed.
  It didn't work well together with the existing inplace version of the same proc
  (`tables.merge(var CountTable, CountTable)`).
  It was an oversight to be included in v1.0.
- `asyncdispatch.drain` now consistently uses the passed timeout value for all
  iterations of the event loop, and not just the first iteration.
  This is more consistent with the other asyncdispatch APIs, and allows
  `asyncdispatch.drain` to be more efficient.
- `base64.encode` and `base64.decode` were made faster by about 50%.
- `htmlgen` adds [MathML](https://wikipedia.org/wiki/MathML) support
  (ISO 40314).
- `macros.eqIdent` is now invariant to export markers and backtick quotes.
- `htmlgen.html` allows `lang` in the `<html>` tag and common valid attributes.
- `macros.basename` and `basename=` got support for `PragmaExpr`,
  so that an expression like `MyEnum {.pure.}` is handled correctly.
- `httpclient.maxredirects` changed from `int` to `Natural`, because negative values
  serve no purpose whatsoever.
- `httpclient.newHttpClient` and `httpclient.newAsyncHttpClient` added `headers`
  argument to set initial HTTP Headers, instead of a hardcoded empty `newHttpHeader()`.
- `parseutils.parseUntil` has now a different behaviour if the `until` parameter is
  empty. This was required for intuitive behaviour of the strscans module
  (see bug #13605).
- `strutils.formatFloat` with `precision = 0` has the same behavior in all
  backends, and it is compatible with Python's behavior,
  e.g. `formatFloat(3.14159, precision = 0)` is now `3`, not `3.`.
- `times.parse` now only uses input to compute its result, and not `now`:
  `parse("2020", "YYYY", utc())` is now `2020-01-01T00:00:00Z` instead of
  `2020-03-02T00:00:00Z` if run on 03-02; it also doesn't crash anymore when
  used on 29th, 30th, 31st of each month.
- `httpcore.==(string, HttpCode)` is now deprecated due to lack of practical
  usage. The `$` operator can be used to obtain the string form of `HttpCode`
  for comparison if desired.
- `std/oswalkdir` was buggy, it's now deprecated and reuses `std/os` procs.
- `net.newContext` now performs SSL Certificate checking on Linux and OSX.
  Define `nimDisableCertificateValidation` to disable it globally.
- `os.walkDir` and `os.walkDirRec` now have new flag, `checkDir` (default: false).
  If it is set to true, it will throw if input dir is invalid instead of a noop
  (which is the default behaviour, as it was before this change),
  `os.walkDirRec` only throws if top-level dir is invalid, but ignores errors for
  subdirs, otherwise it would be impossible to resume iteration.
- The `FD` variant of `selector.unregister` for `ioselector_epoll` and
  `ioselector_select` now properly handle the `Event.User` select event type.
- `joinPath` path normalization when `/` is the first argument works correctly:
  `assert "/" / "/a" == "/a"`. Fixed the edge case: `assert "" / "" == ""`.
- `xmltree` now adds indentation consistently to child nodes for any number
  of children nodes.
- `os.splitPath()` behavior synchronized with `os.splitFile()` to return "/"
  as the dir component of `/root_sub_dir` instead of the empty string.
- The deprecated `lc` macro has been removed from `sugar`. It is now replaced with the
  more powerful `collect` macro.
- `os.relativePath("foo", "foo")` is now `"."`, not `""`, as `""` means invalid
  path and shouldn't be conflated with `"."`; use `-d:nimOldRelativePathBehavior`
  to restore the old behavior.
- `os.joinPath(a, b)` now honors trailing slashes in `b` (or `a` if `b` = "").
- `base64.encode` no longer supports `lineLen` and `newLine`.
  Use `base64.encodeMime` instead.


## Language changes

- An `align` pragma can now be used for variables and object fields, similar
  to the `alignas` declaration modifier in C/C++.
- `=sink` type bound operator is now optional. Compiler can now use combination
  of `=destroy` and `copyMem` to move objects efficiently.
- Unsigned integer operators have been fixed to allow promotion of the first operand.
- Conversions to unsigned integers are unchecked at runtime, imitating earlier Nim
  versions. The documentation was improved to acknowledge this special case.
  See nim-lang/RFCs#175 for more details.
- New syntax for lvalue references: `var b {.byaddr.} = expr` enabled by
  `import std/decls`.
- `var a {.foo.}: MyType = expr` now lowers to `foo(a, MyType, expr)` for
  non-builtin pragmas, enabling things like lvalue references (see `decls.byaddr`).


## Compiler changes

- Generated JS code uses spaces, instead of mixed spaces and tabs.
- The Nim compiler now supports the ``--asm`` command option for easier
  inspection of the produced assembler code.
- The Nim compiler now supports a new pragma called ``.localPassc`` to
  pass specific compiler options to the C(++) backend for the C(++) file
  that was produced from the current Nim module.
- The compiler now inferes "sink parameters". To disable this for a specific routine,
  annotate it with `.nosinks`. To disable it for a section of code, use
  `{.push sinkInference: off.}`...`{.pop.}`.
- The compiler now supports a new switch `--panics:on` that turns runtime
  errors like `IndexError` or `OverflowError` into fatal errors that **cannot**
  be caught via Nim's `try` statement. `--panics:on` can improve the
  runtime efficiency and code size of your program significantly.
- The compiler now warns about inheriting directly from `system.Exception` as
  this is **very bad** style. You should inherit from `ValueError`, `IOError`,
  `OSError` or from a different specific exception type that inherits from
  `CatchableError` and cannot be confused with a `Defect`.
- The error reporting for Nim's effect system has been improved.
- Implicit conversions for `const` behave correctly now, meaning that code like
  `const SOMECONST = 0.int; procThatTakesInt32(SOMECONST)` will be illegal now.
  Simply write `const SOMECONST = 0` instead.
- The `{.dynlib.}` pragma is now required for exporting symbols when making
  shared objects on POSIX and macOS, which make it consistent with the behavior
  on Windows.
- The compiler is now more strict about type conversions concerning proc
  types: Type conversions cannot be used to hide `.raise` effects or side
  effects, instead a `cast` must be used. With the flag `--useVersion:1.0` the
  old behaviour is emulated.
- The Nim compiler now implements a faster way to detect overflows based
  on GCC's `__builtin_sadd_overflow` family of functions. (Clang also
  supports these). Some versions of GCC lack this feature and unfortunately
  we cannot detect this case reliably. So if you get compilation errors like
  "undefined reference to `__builtin_saddll_overflow`" compile your programs
  with `-d:nimEmulateOverflowChecks`.


## Tool changes

- Nimpretty doesn't accept negative indentation argument anymore, because it was
  breaking files.


## Bugfixes

- Fixed "`nimgrep --nocolor` is ignored on posix; should be instead: `--nimgrep --color=[auto]|true|false`"
  ([#7591](nim-lang/Nim#7591))
- Fixed "Runtime index on const array (of converted obj) causes C-compiler error"
  ([#10514](nim-lang/Nim#10514))
- Fixed "windows x86 with vcc compile error with "asmNoStackFrame""
  ([#12298](nim-lang/Nim#12298))
- Fixed "[TODO] regression: Error: Locks requires --threads:on option"
  ([#12330](nim-lang/Nim#12330))
- Fixed "Add --cc option to --help or --fullhelp output"
  ([#12010](nim-lang/Nim#12010))
- Fixed "questionable `csize` definition in `system.nim`"
  ([#12187](nim-lang/Nim#12187))
- Fixed "os.getAppFilename() returns incorrect results on OpenBSD"
  ([#12389](nim-lang/Nim#12389))
- Fixed "HashSet[uint64] slow insertion depending on values"
  ([#11764](nim-lang/Nim#11764))
- Fixed "Differences between compiling 'classic call syntax' vs 'method call syntax' ."
  ([#12453](nim-lang/Nim#12453))
- Fixed "c -d:nodejs --> SIGSEGV: Illegal storage access"
  ([#12502](nim-lang/Nim#12502))
- Fixed "Closure iterator crashes on --newruntime due to "dangling references""
  ([#12443](nim-lang/Nim#12443))
- Fixed "No `=destroy` for elements of closure environments other than for latest devel --gc:destructors"
  ([#12577](nim-lang/Nim#12577))
- Fixed "strutils:formatBiggestFloat() gives different results in JS mode"
  ([#8242](nim-lang/Nim#8242))
- Fixed "Regression (devel): the new `csize_t` definition isn't consistently used, nor tested thoroughly..."
  ([#12597](nim-lang/Nim#12597))
- Fixed "tables.take() is defined only for `Table` and missed for other table containers"
  ([#12519](nim-lang/Nim#12519))
- Fixed "`pthread_key_t` errors on OpenBSD"
  ([#12135](nim-lang/Nim#12135))
- Fixed "newruntime: simple seq pop at ct results in compile error"
  ([#12644](nim-lang/Nim#12644))
- Fixed "[Windows] finish.exe C:\Users\<USERNAME>\.nimble\bin is not in your PATH environment variable."
  ([#12319](nim-lang/Nim#12319))
- Fixed "Error with strformat + asyncdispatch + const"
  ([#12612](nim-lang/Nim#12612))
- Fixed "MultipartData needs $"
  ([#11863](nim-lang/Nim#11863))
- Fixed "Nim stdlib style issues with --styleCheck:error"
  ([#12687](nim-lang/Nim#12687))
- Fixed "new $nimbleDir path substitution yields unexpected search paths"
  ([#12767](nim-lang/Nim#12767))
- Fixed "Regression: inlined procs now get multiple rounds of destructor injection"
  ([#12766](nim-lang/Nim#12766))
- Fixed "newruntime: compiler generates defective code"
  ([#12669](nim-lang/Nim#12669))
- Fixed "broken windows modules path handling because of 'os.relativePath' breaking changes"
  ([#12734](nim-lang/Nim#12734))
- Fixed "for loop tuple syntax not rendered correctly"
  ([#12740](nim-lang/Nim#12740))
- Fixed "Crash when trying to use `type.name[0]`"
  ([#12804](nim-lang/Nim#12804))
- Fixed "Enums should be considered Trivial types in Atomics"
  ([#12812](nim-lang/Nim#12812))
- Fixed "Produce static/const initializations for variables when possible"
  ([#12216](nim-lang/Nim#12216))
- Fixed "Assigning descriminator field leads to internal assert with --gc:destructors"
  ([#12821](nim-lang/Nim#12821))
- Fixed "nimsuggest `use` command does not return all instances of symbol"
  ([#12832](nim-lang/Nim#12832))
- Fixed "@[] is a problem for --gc:destructors"
  ([#12820](nim-lang/Nim#12820))
- Fixed "Codegen ICE in allPathsAsgnResult"
  ([#12827](nim-lang/Nim#12827))
- Fixed "seq[Object with ref and destructor type] doesn't work in old runtime"
  ([#12882](nim-lang/Nim#12882))
- Fixed "Destructor not invoked because it is instantiated too late, old runtime"
  ([#12883](nim-lang/Nim#12883))
- Fixed "The collect macro does not handle if/case correctly"
  ([#12874](nim-lang/Nim#12874))
- Fixed "allow typed/untyped params in magic procs (even if not in stdlib)"
  ([#12911](nim-lang/Nim#12911))
- Fixed "ARC/newruntime memory corruption"
  ([#12899](nim-lang/Nim#12899))
- Fixed "tasyncclosestall.nim still flaky test: Address already in use"
  ([#12919](nim-lang/Nim#12919))
- Fixed "newruntime and computed goto: variables inside the loop are in generated code uninitialised"
  ([#12785](nim-lang/Nim#12785))
- Fixed "osx: dsymutil needs to be called for debug builds to keep debug info"
  ([#12735](nim-lang/Nim#12735))
- Fixed "codegen ICE with ref objects, gc:destructors"
  ([#12826](nim-lang/Nim#12826))
- Fixed "mutable iterator cannot yield named tuples"
  ([#12945](nim-lang/Nim#12945))
- Fixed "parsecfg stores "\r\n" line breaks just as "\n""
  ([#12970](nim-lang/Nim#12970))
- Fixed "db_postgres.getValue issues warning when no rows found"
  ([#12973](nim-lang/Nim#12973))
- Fixed "ARC: Unpacking tuple with seq causes segfault"
  ([#12989](nim-lang/Nim#12989))
- Fixed "ARC/newruntime: strutils.join on seq with only empty strings causes segfault"
  ([#12965](nim-lang/Nim#12965))
- Fixed "regression (1.0.4): `{.push exportc.}` wrongly affects generic instantiations, causing codegen errors"
  ([#12985](nim-lang/Nim#12985))
- Fixed "cdt, crash with --gc:arc, works fine with default gc"
  ([#12978](nim-lang/Nim#12978))
- Fixed "ARC: No indexError thrown on out-of-bound seq access, SIGSEGV instead"
  ([#12961](nim-lang/Nim#12961))
- Fixed "ARC/async: Returning in a try-block results in wrong codegen"
  ([#12956](nim-lang/Nim#12956))
- Fixed "asm keyword is generating wrong output C code when --cc:tcc"
  ([#12988](nim-lang/Nim#12988))
- Fixed "Destructor not invoked"
  ([#13026](nim-lang/Nim#13026))
- Fixed "ARC/newruntime: Adding inherited var ref object to seq with base type causes segfault"
  ([#12964](nim-lang/Nim#12964))
- Fixed "Style check error with JS compiler target"
  ([#13032](nim-lang/Nim#13032))
- Fixed "regression(1.0.4): undeclared identifier: 'readLines'; plus another regression and bug"
  ([#13013](nim-lang/Nim#13013))
- Fixed "regression(1.04) `invalid pragma: since` with nim js"
  ([#12996](nim-lang/Nim#12996))
- Fixed "Sink to MemMove optimization in injectdestructors"
  ([#13002](nim-lang/Nim#13002))
- Fixed "--gc:arc: `catch` doesn't work with exception subclassing"
  ([#13072](nim-lang/Nim#13072))
- Fixed "nim c --gc:arc --exceptions:{setjmp,goto} incorrectly handles raise; `nim cpp --gc:arc` is ok"
  ([#13070](nim-lang/Nim#13070))
- Fixed "typetraits feature request - get subtype of a generic type"
  ([#6454](nim-lang/Nim#6454))
- Fixed "CountTable inconsistencies between keys() and len() after setting value to 0"
  ([#12813](nim-lang/Nim#12813))
- Fixed "{.align.} pragma is not applied if there is a generic field"
  ([#13122](nim-lang/Nim#13122))
- Fixed "ARC, finalizer, allow rebinding the same function multiple times"
  ([#13112](nim-lang/Nim#13112))
- Fixed "`nim doc` treats `export localSymbol` incorrectly"
  ([#13100](nim-lang/Nim#13100))
- Fixed "--gc:arc SIGSEGV (double free?)"
  ([#13119](nim-lang/Nim#13119))
- Fixed "codegen bug with arc"
  ([#13105](nim-lang/Nim#13105))
- Fixed "symbols not defined in the grammar"
  ([#10665](nim-lang/Nim#10665))
- Fixed "[JS] Move is not defined"
  ([#9674](nim-lang/Nim#9674))
- Fixed "[TODO] pathutils.`/` can return invalid AbsoluteFile"
  ([#13121](nim-lang/Nim#13121))
- Fixed "regression(1.04) `nim doc main.nim` generates broken html (no css)"
  ([#12998](nim-lang/Nim#12998))
- Fixed "Wrong supportsCopyMem on string in type section"
  ([#13095](nim-lang/Nim#13095))
- Fixed "Arc, finalizer, out of memory"
  ([#13157](nim-lang/Nim#13157))
- Fixed "`--genscript` messes up nimcache and future nim invocations"
  ([#13144](nim-lang/Nim#13144))
- Fixed "--gc:arc with --exceptions:goto for "nim c" generate invalid c code"
  ([#13186](nim-lang/Nim#13186))
- Fixed "[regression] duplicate member `_i1` codegen bug"
  ([#13195](nim-lang/Nim#13195))
- Fixed "RTree investigations with valgrind for --gc:arc"
  ([#13110](nim-lang/Nim#13110))
- Fixed "relativePath("foo", ".") returns wrong path"
  ([#13211](nim-lang/Nim#13211))
- Fixed "asyncftpclient - problem with welcome.msg"
  ([#4684](nim-lang/Nim#4684))
- Fixed "Unclear error message, lowest priority"
  ([#13256](nim-lang/Nim#13256))
- Fixed "Channel messages are corrupted"
  ([#13219](nim-lang/Nim#13219))
- Fixed "Codegen bug with exportc and case objects"
  ([#13281](nim-lang/Nim#13281))
- Fixed "[bugfix] fix #11590: c compiler warnings silently ignored, giving undefined behavior"
  ([#11591](nim-lang/Nim#11591))
- Fixed "[CI] tnetdial flaky test"
  ([#13132](nim-lang/Nim#13132))
- Fixed "Cross-Compiling with -d:mingw fails to locate compiler under OSX"
  ([#10717](nim-lang/Nim#10717))
- Fixed "`nim doc --project` broken with imports below main project file or duplicate names"
  ([#13150](nim-lang/Nim#13150))
- Fixed "regression: isNamedTuple(MyGenericTuple[int]) is false, should be true"
  ([#13349](nim-lang/Nim#13349))
- Fixed "--gc:arc codegen bug copying objects bound to C structs with missing C struct fields"
  ([#13269](nim-lang/Nim#13269))
- Fixed "write requires conversion to string"
  ([#13182](nim-lang/Nim#13182))
- Fixed "Some remarks to stdlib documentation"
  ([#13352](nim-lang/Nim#13352))
- Fixed "a `check` in unittest generated by template doesn't show actual value"
  ([#6736](nim-lang/Nim#6736))
- Fixed "Implicit return with case expression fails with 'var' return."
  ([#3339](nim-lang/Nim#3339))
- Fixed "Segfault with closure on arc"
  ([#13314](nim-lang/Nim#13314))
- Fixed "[Macro] Crash on malformed case statement with multiple else"
  ([#13255](nim-lang/Nim#13255))
- Fixed "regression: `echo 'discard' | nim c -r -` generates a file '-' ; `-` should be treated specially"
  ([#13374](nim-lang/Nim#13374))
- Fixed "on OSX, debugging (w gdb or lldb) a nim program crashes at the 1st call to `execCmdEx`"
  ([#9634](nim-lang/Nim#9634))
- Fixed "Internal error in getTypeDescAux"
  ([#13378](nim-lang/Nim#13378))
- Fixed "gc:arc mode breaks tuple let"
  ([#13368](nim-lang/Nim#13368))
- Fixed "Nim compiler hangs for certain C/C++ compiler errors"
  ([#8648](nim-lang/Nim#8648))
- Fixed "htmlgen does not support `data-*` attributes"
  ([#13444](nim-lang/Nim#13444))
- Fixed "[gc:arc] setLen will cause string not to be null-terminated."
  ([#13457](nim-lang/Nim#13457))
- Fixed "joinPath("", "") is "/" ; should be """
  ([#13455](nim-lang/Nim#13455))
- Fixed "[CI] flaky test on windows: tests/osproc/texitcode.nim"
  ([#13449](nim-lang/Nim#13449))
- Fixed "Casting to float32 on NimVM is broken"
  ([#13479](nim-lang/Nim#13479))
- Fixed "`--hints:off` doesn't work (doesn't override ~/.config/nim.cfg)"
  ([#8312](nim-lang/Nim#8312))
- Fixed "joinPath("", "") is "/" ; should be """
  ([#13455](nim-lang/Nim#13455))
- Fixed "tables.values is broken"
  ([#13496](nim-lang/Nim#13496))
- Fixed "global user config can override project specific config"
  ([#9405](nim-lang/Nim#9405))
- Fixed "Non deterministic macros and id consistency problem"
  ([#12627](nim-lang/Nim#12627))
- Fixed "try expression doesn't work with return on expect branch"
  ([#13490](nim-lang/Nim#13490))
- Fixed "CI will break every 4 years on feb 28: times doesn't handle leap years properly"
  ([#13543](nim-lang/Nim#13543))
- Fixed "[minor] `nimgrep --word` doesn't work with operators (eg misses  `1 +% 2`)"
  ([#13528](nim-lang/Nim#13528))
- Fixed "`as` is usable as infix operator but its existence and precedence are not documented"
  ([#13409](nim-lang/Nim#13409))
- Fixed "JSON unmarshalling drops seq's items"
  ([#13531](nim-lang/Nim#13531))
- Fixed "os.joinPath returns wrong path when head ends '\' or '/' and tail starts '..'."
  ([#13579](nim-lang/Nim#13579))
- Fixed "Block-local types with the same name lead to bad codegen (sighashes regression)"
  ([#5170](nim-lang/Nim#5170))
- Fixed "tuple codegen error"
  ([#12704](nim-lang/Nim#12704))
- Fixed "newHttpHeaders does not accept repeated headers"
  ([#13573](nim-lang/Nim#13573))
- Fixed "regression: --incremental:on fails on simplest example"
  ([#13319](nim-lang/Nim#13319))
- Fixed "strscan can't get value of last element in format"
  ([#13605](nim-lang/Nim#13605))
- Fixed "hashes_examples crashes with "Bus Error" (unaligned access) on sparc64"
  ([#12508](nim-lang/Nim#12508))
- Fixed "gc:arc bug with re-used `seq[T]`"
  ([#13596](nim-lang/Nim#13596))
- Fixed "`raise CatchableError` is broken with --gc:arc  when throwing inside a proc"
  ([#13599](nim-lang/Nim#13599))
- Fixed "cpp --gc:arc --exceptions:goto fails to raise with discard"
  ([#13436](nim-lang/Nim#13436))
- Fixed "terminal doesn't compile with -d:useWinAnsi"
  ([#13607](nim-lang/Nim#13607))
- Fixed "Parsing "sink ptr T" - region needs to be an object type"
  ([#12757](nim-lang/Nim#12757))
- Fixed "gc:arc + threads:on + closures compilation error"
  ([#13519](nim-lang/Nim#13519))
- Fixed "[ARC] segmentation fault"
  ([#13240](nim-lang/Nim#13240))
- Fixed "times.toDateTime buggy on 29th, 30th and 31th of each month"
  ([#13558](nim-lang/Nim#13558))
- Fixed "Deque misbehaves on VM"
  ([#13310](nim-lang/Nim#13310))
- Fixed "Nimscript listFiles should throw exception when path is not found"
  ([#12676](nim-lang/Nim#12676))
- Fixed "koch boot fails if even an empty config.nims is present in ~/.config/nims/ [devel regression]"
  ([#13633](nim-lang/Nim#13633))
- Fixed "nim doc generates lots of false positive LockLevel warnings"
  ([#13218](nim-lang/Nim#13218))
- Fixed "Arrays are passed by copy to iterators, causing crashes, unnecessary allocations and slowdowns"
  ([#12747](nim-lang/Nim#12747))
- Fixed "Range types always uses signed integer as a base type"
  ([#13646](nim-lang/Nim#13646))
- Fixed "Generate c code cannot compile with recent devel version"
  ([#13645](nim-lang/Nim#13645))
- Fixed "[regression] VM: Error: cannot convert -1 to uint64"
  ([#13661](nim-lang/Nim#13661))
- Fixed "Spurious raiseException(Exception) detected"
  ([#13654](nim-lang/Nim#13654))
- Fixed "gc:arc memory leak"
  ([#13659](nim-lang/Nim#13659))
- Fixed "Error: cannot convert -1 to uint (inside tuples)"
  ([#13671](nim-lang/Nim#13671))
- Fixed "strformat issue with --gc:arc"
  ([#13622](nim-lang/Nim#13622))
- Fixed "astToStr doesn't work inside generics"
  ([#13524](nim-lang/Nim#13524))
- Fixed "oswalkdir.walkDirRec wont return folders"
  ([#11458](nim-lang/Nim#11458))
- Fixed "`echo 'echo 1' | nim c -r -`  silently gives wrong results (nimBetterRun not updated for stdin)"
  ([#13412](nim-lang/Nim#13412))
- Fixed "gc:arc destroys the global variable accidentally."
  ([#13691](nim-lang/Nim#13691))
- Fixed "[minor] sigmatch errors should be sorted, for reproducible errors"
  ([#13538](nim-lang/Nim#13538))
- Fixed "Exception when converting csize to clong"
  ([#13698](nim-lang/Nim#13698))
- Fixed "ARC: variables are no copied on the thread spawn causing crashes"
  ([#13708](nim-lang/Nim#13708))
- Fixed "Illegal distinct seq causes compiler crash"
  ([#13720](nim-lang/Nim#13720))
- Fixed "cyclic seq definition crashes the compiler"
  ([#13715](nim-lang/Nim#13715))
- Fixed "Iterator with openArray parameter make the argument evaluated many times"
  ([#13417](nim-lang/Nim#13417))
- Fixed "net/asyncnet: Unable to access peer's certificate chain"
  ([#13299](nim-lang/Nim#13299))
- Fixed "Accidentally "SIGSEGV: Illegal storage access" error after arc optimizations (#13325)"
  ([#13709](nim-lang/Nim#13709))
- Fixed "Base64 Regression"
  ([#13722](nim-lang/Nim#13722))
- Fixed "A regression (?) with --gc:arc and repr"
  ([#13731](nim-lang/Nim#13731))
- Fixed "Internal compiler error when using the new variable pragmas"
  ([#13737](nim-lang/Nim#13737))
- Fixed "bool conversion produces vcc 2019 warning at cpp compilation stage"
  ([#13744](nim-lang/Nim#13744))
- Fixed "Compiler "does not detect" a type recursion error in the wrong code, remaining frozen"
  ([#13763](nim-lang/Nim#13763))
- Fixed "[minor] regression: `Foo[0.0] is Foo[-0.0]` is now false"
  ([#13730](nim-lang/Nim#13730))
- Fixed "`nim doc` - only whitespace on first line causes segfault"
  ([#13631](nim-lang/Nim#13631))
- Fixed "hashset regression"
  ([#13794](nim-lang/Nim#13794))
- Fixed "`os.getApplFreebsd` could return incorrect paths in the case of a long path"
  ([#13806](nim-lang/Nim#13806))
- Fixed "Destructors are not inherited"
  ([#13810](nim-lang/Nim#13810))
- Fixed "io.readLines AssertionError on devel"
  ([#13829](nim-lang/Nim#13829))
- Fixed "exceptions:goto accidentally reset the variable during exception handling"
  ([#13782](nim-lang/Nim#13782))
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Apr 6, 2020
Changelog:
# v1.2.0 - 2020-04-02

## Standard library additions and changes

- Added overloaded `strformat.fmt` macro that use specified characters as
  delimiter instead of '{' and '}'.
- Added new procs in `tables.nim`: `OrderedTable.pop`, `CountTable.del`,
  `CountTable.pop`, `Table.pop`.
- Added `strtabs.clear` overload that reuses the existing mode.
- Added `browsers.osOpen` const alias for the operating system specific *"open"* command.
- Added `sugar.dup` for turning in-place algorithms like `sort` and `shuffle`
  into operations that work on a copy of the data and return the mutated copy,
  like the existing `sorted` does.
- Added `sugar.collect` that does comprehension for seq/set/table collections.
- Added `sugar.capture` for capturing some local loop variables when creating a
  closure. This is an enhanced version of `closureScope`.
- Added `typetraits.tupleLen` to get number of elements of a tuple/type tuple,
  and `typetraits.get` to get the ith element of a type tuple.
- Added `typetraits.genericParams` to return a tuple of generic params from a
  generic instantiation.
- `options` now treats `proc` like other pointer types, meaning `nil` proc variables
  are converted to `None`.
- Added `os.normalizePathEnd` for additional path sanitization.
- Added `times.fromUnixFloat,toUnixFloat`, sub-second resolution versions of
  `fromUnix`,`toUnixFloat`.
- Added `wrapnils` module for chains of field-access and indexing where the LHS
  can be nil. This simplifies code by reducing need for if-else branches around
  intermediate maybe nil values. E.g. `echo ?.n.typ.kind`.
- Added `minIndex`, `maxIndex` and `unzip` to the `sequtils` module.
- Added `os.isRelativeTo` to tell whether a path is relative to another.
- Added `resetOutputFormatters` to `unittest`.
- Added `expectIdent` to the `macros` module.
- Added `os.isValidFilename` that returns `true` if `filename` argument is valid
  for cross-platform use.
- Added `times.isLeapDay`
- `base64` adds URL-Safe Base64, implements RFC-4648 Section-7.
- Added a new module, `std / compilesettings` for querying the compiler about
  diverse configuration settings.
- Added `net.getPeerCertificates` and `asyncnet.getPeerCertificates` for
  retrieving the verified certificate chain of the peer we are connected to
  through an SSL-wrapped `Socket`/`AsyncSocket`.
- Added `browsers.openDefaultBrowser` without URL, implements IETF RFC-6694 Section-3.
- Added `jsconsole.trace`, `jsconsole.table`, `jsconsole.exception` for JavaScript target.
- Added `distinctBase` overload for values: `assert 12.MyInt.distinctBase == 12`
- Added new module `std/stackframes`, in particular `setFrameMsg`, which enables
  custom runtime annotation of stackframes, see #13351 for examples.
  Turn on/off via `--stackTraceMsgs:on/off`.
- Added `sequtils.countIt`, allowing for counting items using a predicate.
- Added a `with` macro for easy function chaining that's available everywhere,
  there is no need to concern your APIs with returning the first argument
  to enable "chaining", instead use the dedicated macro `with` that
  was designed for it. For example:

```nim
type
  Foo = object
    col, pos: string

proc setColor(f: var Foo; r, g, b: int) = f.col = $(r, g, b)
proc setPosition(f: var Foo; x, y: float) = f.pos = $(x, y)

var f: Foo
with(f, setColor(2, 3, 4), setPosition(0.0, 1.0))
echo f
```

- `macros.newLit` now works for ref object types.
- `macro pragmas` can now be used in type sections.
- 5 new pragmas were added to Nim in order to make the upcoming tooling more
  convenient to use. Nim compiler checks these pragmas for syntax but otherwise
  ignores them. The pragmas are `requires`, `ensures`, `assume`, `assert`, `invariant`.
- `system.writeFile` has been overloaded to also support `openarray[byte]`.
- `asyncdispatch.drain` now properly takes into account `selector.hasPendingOperations`
  and only returns once all pending async operations are guaranteed to have completed.
- `sequtils.zip` now returns a sequence of anonymous tuples i.e. those tuples
  now do not have fields named "a" and "b".
- `distinctBase` has been moved from `sugar` to `typetraits` and now it is
  implemented as compiler type trait instead of macro. `distinctBase` in sugar
  module is now deprecated.
- `CountTable.mget` has been removed from `tables.nim`. It didn't work, and it
  was an oversight to be included in v1.0.
- `tables.merge(CountTable, CountTable): CountTable` has been removed.
  It didn't work well together with the existing inplace version of the same proc
  (`tables.merge(var CountTable, CountTable)`).
  It was an oversight to be included in v1.0.
- `asyncdispatch.drain` now consistently uses the passed timeout value for all
  iterations of the event loop, and not just the first iteration.
  This is more consistent with the other asyncdispatch APIs, and allows
  `asyncdispatch.drain` to be more efficient.
- `base64.encode` and `base64.decode` were made faster by about 50%.
- `htmlgen` adds [MathML](https://wikipedia.org/wiki/MathML) support
  (ISO 40314).
- `macros.eqIdent` is now invariant to export markers and backtick quotes.
- `htmlgen.html` allows `lang` in the `<html>` tag and common valid attributes.
- `macros.basename` and `basename=` got support for `PragmaExpr`,
  so that an expression like `MyEnum {.pure.}` is handled correctly.
- `httpclient.maxredirects` changed from `int` to `Natural`, because negative values
  serve no purpose whatsoever.
- `httpclient.newHttpClient` and `httpclient.newAsyncHttpClient` added `headers`
  argument to set initial HTTP Headers, instead of a hardcoded empty `newHttpHeader()`.
- `parseutils.parseUntil` has now a different behaviour if the `until` parameter is
  empty. This was required for intuitive behaviour of the strscans module
  (see bug #13605).
- `strutils.formatFloat` with `precision = 0` has the same behavior in all
  backends, and it is compatible with Python's behavior,
  e.g. `formatFloat(3.14159, precision = 0)` is now `3`, not `3.`.
- `times.parse` now only uses input to compute its result, and not `now`:
  `parse("2020", "YYYY", utc())` is now `2020-01-01T00:00:00Z` instead of
  `2020-03-02T00:00:00Z` if run on 03-02; it also doesn't crash anymore when
  used on 29th, 30th, 31st of each month.
- `httpcore.==(string, HttpCode)` is now deprecated due to lack of practical
  usage. The `$` operator can be used to obtain the string form of `HttpCode`
  for comparison if desired.
- `std/oswalkdir` was buggy, it's now deprecated and reuses `std/os` procs.
- `net.newContext` now performs SSL Certificate checking on Linux and OSX.
  Define `nimDisableCertificateValidation` to disable it globally.
- `os.walkDir` and `os.walkDirRec` now have new flag, `checkDir` (default: false).
  If it is set to true, it will throw if input dir is invalid instead of a noop
  (which is the default behaviour, as it was before this change),
  `os.walkDirRec` only throws if top-level dir is invalid, but ignores errors for
  subdirs, otherwise it would be impossible to resume iteration.
- The `FD` variant of `selector.unregister` for `ioselector_epoll` and
  `ioselector_select` now properly handle the `Event.User` select event type.
- `joinPath` path normalization when `/` is the first argument works correctly:
  `assert "/" / "/a" == "/a"`. Fixed the edge case: `assert "" / "" == ""`.
- `xmltree` now adds indentation consistently to child nodes for any number
  of children nodes.
- `os.splitPath()` behavior synchronized with `os.splitFile()` to return "/"
  as the dir component of `/root_sub_dir` instead of the empty string.
- The deprecated `lc` macro has been removed from `sugar`. It is now replaced with the
  more powerful `collect` macro.
- `os.relativePath("foo", "foo")` is now `"."`, not `""`, as `""` means invalid
  path and shouldn't be conflated with `"."`; use `-d:nimOldRelativePathBehavior`
  to restore the old behavior.
- `os.joinPath(a, b)` now honors trailing slashes in `b` (or `a` if `b` = "").
- `base64.encode` no longer supports `lineLen` and `newLine`.
  Use `base64.encodeMime` instead.


## Language changes

- An `align` pragma can now be used for variables and object fields, similar
  to the `alignas` declaration modifier in C/C++.
- `=sink` type bound operator is now optional. Compiler can now use combination
  of `=destroy` and `copyMem` to move objects efficiently.
- Unsigned integer operators have been fixed to allow promotion of the first operand.
- Conversions to unsigned integers are unchecked at runtime, imitating earlier Nim
  versions. The documentation was improved to acknowledge this special case.
  See nim-lang/RFCs#175 for more details.
- New syntax for lvalue references: `var b {.byaddr.} = expr` enabled by
  `import std/decls`.
- `var a {.foo.}: MyType = expr` now lowers to `foo(a, MyType, expr)` for
  non-builtin pragmas, enabling things like lvalue references (see `decls.byaddr`).


## Compiler changes

- Generated JS code uses spaces, instead of mixed spaces and tabs.
- The Nim compiler now supports the ``--asm`` command option for easier
  inspection of the produced assembler code.
- The Nim compiler now supports a new pragma called ``.localPassc`` to
  pass specific compiler options to the C(++) backend for the C(++) file
  that was produced from the current Nim module.
- The compiler now inferes "sink parameters". To disable this for a specific routine,
  annotate it with `.nosinks`. To disable it for a section of code, use
  `{.push sinkInference: off.}`...`{.pop.}`.
- The compiler now supports a new switch `--panics:on` that turns runtime
  errors like `IndexError` or `OverflowError` into fatal errors that **cannot**
  be caught via Nim's `try` statement. `--panics:on` can improve the
  runtime efficiency and code size of your program significantly.
- The compiler now warns about inheriting directly from `system.Exception` as
  this is **very bad** style. You should inherit from `ValueError`, `IOError`,
  `OSError` or from a different specific exception type that inherits from
  `CatchableError` and cannot be confused with a `Defect`.
- The error reporting for Nim's effect system has been improved.
- Implicit conversions for `const` behave correctly now, meaning that code like
  `const SOMECONST = 0.int; procThatTakesInt32(SOMECONST)` will be illegal now.
  Simply write `const SOMECONST = 0` instead.
- The `{.dynlib.}` pragma is now required for exporting symbols when making
  shared objects on POSIX and macOS, which make it consistent with the behavior
  on Windows.
- The compiler is now more strict about type conversions concerning proc
  types: Type conversions cannot be used to hide `.raise` effects or side
  effects, instead a `cast` must be used. With the flag `--useVersion:1.0` the
  old behaviour is emulated.
- The Nim compiler now implements a faster way to detect overflows based
  on GCC's `__builtin_sadd_overflow` family of functions. (Clang also
  supports these). Some versions of GCC lack this feature and unfortunately
  we cannot detect this case reliably. So if you get compilation errors like
  "undefined reference to `__builtin_saddll_overflow`" compile your programs
  with `-d:nimEmulateOverflowChecks`.


## Tool changes

- Nimpretty doesn't accept negative indentation argument anymore, because it was
  breaking files.


## Bugfixes

- Fixed "`nimgrep --nocolor` is ignored on posix; should be instead: `--nimgrep --color=[auto]|true|false`"
  ([#7591](nim-lang/Nim#7591))
- Fixed "Runtime index on const array (of converted obj) causes C-compiler error"
  ([#10514](nim-lang/Nim#10514))
- Fixed "windows x86 with vcc compile error with "asmNoStackFrame""
  ([#12298](nim-lang/Nim#12298))
- Fixed "[TODO] regression: Error: Locks requires --threads:on option"
  ([#12330](nim-lang/Nim#12330))
- Fixed "Add --cc option to --help or --fullhelp output"
  ([#12010](nim-lang/Nim#12010))
- Fixed "questionable `csize` definition in `system.nim`"
  ([#12187](nim-lang/Nim#12187))
- Fixed "os.getAppFilename() returns incorrect results on OpenBSD"
  ([#12389](nim-lang/Nim#12389))
- Fixed "HashSet[uint64] slow insertion depending on values"
  ([#11764](nim-lang/Nim#11764))
- Fixed "Differences between compiling 'classic call syntax' vs 'method call syntax' ."
  ([#12453](nim-lang/Nim#12453))
- Fixed "c -d:nodejs --> SIGSEGV: Illegal storage access"
  ([#12502](nim-lang/Nim#12502))
- Fixed "Closure iterator crashes on --newruntime due to "dangling references""
  ([#12443](nim-lang/Nim#12443))
- Fixed "No `=destroy` for elements of closure environments other than for latest devel --gc:destructors"
  ([#12577](nim-lang/Nim#12577))
- Fixed "strutils:formatBiggestFloat() gives different results in JS mode"
  ([#8242](nim-lang/Nim#8242))
- Fixed "Regression (devel): the new `csize_t` definition isn't consistently used, nor tested thoroughly..."
  ([#12597](nim-lang/Nim#12597))
- Fixed "tables.take() is defined only for `Table` and missed for other table containers"
  ([#12519](nim-lang/Nim#12519))
- Fixed "`pthread_key_t` errors on OpenBSD"
  ([#12135](nim-lang/Nim#12135))
- Fixed "newruntime: simple seq pop at ct results in compile error"
  ([#12644](nim-lang/Nim#12644))
- Fixed "[Windows] finish.exe C:\Users\<USERNAME>\.nimble\bin is not in your PATH environment variable."
  ([#12319](nim-lang/Nim#12319))
- Fixed "Error with strformat + asyncdispatch + const"
  ([#12612](nim-lang/Nim#12612))
- Fixed "MultipartData needs $"
  ([#11863](nim-lang/Nim#11863))
- Fixed "Nim stdlib style issues with --styleCheck:error"
  ([#12687](nim-lang/Nim#12687))
- Fixed "new $nimbleDir path substitution yields unexpected search paths"
  ([#12767](nim-lang/Nim#12767))
- Fixed "Regression: inlined procs now get multiple rounds of destructor injection"
  ([#12766](nim-lang/Nim#12766))
- Fixed "newruntime: compiler generates defective code"
  ([#12669](nim-lang/Nim#12669))
- Fixed "broken windows modules path handling because of 'os.relativePath' breaking changes"
  ([#12734](nim-lang/Nim#12734))
- Fixed "for loop tuple syntax not rendered correctly"
  ([#12740](nim-lang/Nim#12740))
- Fixed "Crash when trying to use `type.name[0]`"
  ([#12804](nim-lang/Nim#12804))
- Fixed "Enums should be considered Trivial types in Atomics"
  ([#12812](nim-lang/Nim#12812))
- Fixed "Produce static/const initializations for variables when possible"
  ([#12216](nim-lang/Nim#12216))
- Fixed "Assigning descriminator field leads to internal assert with --gc:destructors"
  ([#12821](nim-lang/Nim#12821))
- Fixed "nimsuggest `use` command does not return all instances of symbol"
  ([#12832](nim-lang/Nim#12832))
- Fixed "@[] is a problem for --gc:destructors"
  ([#12820](nim-lang/Nim#12820))
- Fixed "Codegen ICE in allPathsAsgnResult"
  ([#12827](nim-lang/Nim#12827))
- Fixed "seq[Object with ref and destructor type] doesn't work in old runtime"
  ([#12882](nim-lang/Nim#12882))
- Fixed "Destructor not invoked because it is instantiated too late, old runtime"
  ([#12883](nim-lang/Nim#12883))
- Fixed "The collect macro does not handle if/case correctly"
  ([#12874](nim-lang/Nim#12874))
- Fixed "allow typed/untyped params in magic procs (even if not in stdlib)"
  ([#12911](nim-lang/Nim#12911))
- Fixed "ARC/newruntime memory corruption"
  ([#12899](nim-lang/Nim#12899))
- Fixed "tasyncclosestall.nim still flaky test: Address already in use"
  ([#12919](nim-lang/Nim#12919))
- Fixed "newruntime and computed goto: variables inside the loop are in generated code uninitialised"
  ([#12785](nim-lang/Nim#12785))
- Fixed "osx: dsymutil needs to be called for debug builds to keep debug info"
  ([#12735](nim-lang/Nim#12735))
- Fixed "codegen ICE with ref objects, gc:destructors"
  ([#12826](nim-lang/Nim#12826))
- Fixed "mutable iterator cannot yield named tuples"
  ([#12945](nim-lang/Nim#12945))
- Fixed "parsecfg stores "\r\n" line breaks just as "\n""
  ([#12970](nim-lang/Nim#12970))
- Fixed "db_postgres.getValue issues warning when no rows found"
  ([#12973](nim-lang/Nim#12973))
- Fixed "ARC: Unpacking tuple with seq causes segfault"
  ([#12989](nim-lang/Nim#12989))
- Fixed "ARC/newruntime: strutils.join on seq with only empty strings causes segfault"
  ([#12965](nim-lang/Nim#12965))
- Fixed "regression (1.0.4): `{.push exportc.}` wrongly affects generic instantiations, causing codegen errors"
  ([#12985](nim-lang/Nim#12985))
- Fixed "cdt, crash with --gc:arc, works fine with default gc"
  ([#12978](nim-lang/Nim#12978))
- Fixed "ARC: No indexError thrown on out-of-bound seq access, SIGSEGV instead"
  ([#12961](nim-lang/Nim#12961))
- Fixed "ARC/async: Returning in a try-block results in wrong codegen"
  ([#12956](nim-lang/Nim#12956))
- Fixed "asm keyword is generating wrong output C code when --cc:tcc"
  ([#12988](nim-lang/Nim#12988))
- Fixed "Destructor not invoked"
  ([#13026](nim-lang/Nim#13026))
- Fixed "ARC/newruntime: Adding inherited var ref object to seq with base type causes segfault"
  ([#12964](nim-lang/Nim#12964))
- Fixed "Style check error with JS compiler target"
  ([#13032](nim-lang/Nim#13032))
- Fixed "regression(1.0.4): undeclared identifier: 'readLines'; plus another regression and bug"
  ([#13013](nim-lang/Nim#13013))
- Fixed "regression(1.04) `invalid pragma: since` with nim js"
  ([#12996](nim-lang/Nim#12996))
- Fixed "Sink to MemMove optimization in injectdestructors"
  ([#13002](nim-lang/Nim#13002))
- Fixed "--gc:arc: `catch` doesn't work with exception subclassing"
  ([#13072](nim-lang/Nim#13072))
- Fixed "nim c --gc:arc --exceptions:{setjmp,goto} incorrectly handles raise; `nim cpp --gc:arc` is ok"
  ([#13070](nim-lang/Nim#13070))
- Fixed "typetraits feature request - get subtype of a generic type"
  ([#6454](nim-lang/Nim#6454))
- Fixed "CountTable inconsistencies between keys() and len() after setting value to 0"
  ([#12813](nim-lang/Nim#12813))
- Fixed "{.align.} pragma is not applied if there is a generic field"
  ([#13122](nim-lang/Nim#13122))
- Fixed "ARC, finalizer, allow rebinding the same function multiple times"
  ([#13112](nim-lang/Nim#13112))
- Fixed "`nim doc` treats `export localSymbol` incorrectly"
  ([#13100](nim-lang/Nim#13100))
- Fixed "--gc:arc SIGSEGV (double free?)"
  ([#13119](nim-lang/Nim#13119))
- Fixed "codegen bug with arc"
  ([#13105](nim-lang/Nim#13105))
- Fixed "symbols not defined in the grammar"
  ([#10665](nim-lang/Nim#10665))
- Fixed "[JS] Move is not defined"
  ([#9674](nim-lang/Nim#9674))
- Fixed "[TODO] pathutils.`/` can return invalid AbsoluteFile"
  ([#13121](nim-lang/Nim#13121))
- Fixed "regression(1.04) `nim doc main.nim` generates broken html (no css)"
  ([#12998](nim-lang/Nim#12998))
- Fixed "Wrong supportsCopyMem on string in type section"
  ([#13095](nim-lang/Nim#13095))
- Fixed "Arc, finalizer, out of memory"
  ([#13157](nim-lang/Nim#13157))
- Fixed "`--genscript` messes up nimcache and future nim invocations"
  ([#13144](nim-lang/Nim#13144))
- Fixed "--gc:arc with --exceptions:goto for "nim c" generate invalid c code"
  ([#13186](nim-lang/Nim#13186))
- Fixed "[regression] duplicate member `_i1` codegen bug"
  ([#13195](nim-lang/Nim#13195))
- Fixed "RTree investigations with valgrind for --gc:arc"
  ([#13110](nim-lang/Nim#13110))
- Fixed "relativePath("foo", ".") returns wrong path"
  ([#13211](nim-lang/Nim#13211))
- Fixed "asyncftpclient - problem with welcome.msg"
  ([#4684](nim-lang/Nim#4684))
- Fixed "Unclear error message, lowest priority"
  ([#13256](nim-lang/Nim#13256))
- Fixed "Channel messages are corrupted"
  ([#13219](nim-lang/Nim#13219))
- Fixed "Codegen bug with exportc and case objects"
  ([#13281](nim-lang/Nim#13281))
- Fixed "[bugfix] fix #11590: c compiler warnings silently ignored, giving undefined behavior"
  ([#11591](nim-lang/Nim#11591))
- Fixed "[CI] tnetdial flaky test"
  ([#13132](nim-lang/Nim#13132))
- Fixed "Cross-Compiling with -d:mingw fails to locate compiler under OSX"
  ([#10717](nim-lang/Nim#10717))
- Fixed "`nim doc --project` broken with imports below main project file or duplicate names"
  ([#13150](nim-lang/Nim#13150))
- Fixed "regression: isNamedTuple(MyGenericTuple[int]) is false, should be true"
  ([#13349](nim-lang/Nim#13349))
- Fixed "--gc:arc codegen bug copying objects bound to C structs with missing C struct fields"
  ([#13269](nim-lang/Nim#13269))
- Fixed "write requires conversion to string"
  ([#13182](nim-lang/Nim#13182))
- Fixed "Some remarks to stdlib documentation"
  ([#13352](nim-lang/Nim#13352))
- Fixed "a `check` in unittest generated by template doesn't show actual value"
  ([#6736](nim-lang/Nim#6736))
- Fixed "Implicit return with case expression fails with 'var' return."
  ([#3339](nim-lang/Nim#3339))
- Fixed "Segfault with closure on arc"
  ([#13314](nim-lang/Nim#13314))
- Fixed "[Macro] Crash on malformed case statement with multiple else"
  ([#13255](nim-lang/Nim#13255))
- Fixed "regression: `echo 'discard' | nim c -r -` generates a file '-' ; `-` should be treated specially"
  ([#13374](nim-lang/Nim#13374))
- Fixed "on OSX, debugging (w gdb or lldb) a nim program crashes at the 1st call to `execCmdEx`"
  ([#9634](nim-lang/Nim#9634))
- Fixed "Internal error in getTypeDescAux"
  ([#13378](nim-lang/Nim#13378))
- Fixed "gc:arc mode breaks tuple let"
  ([#13368](nim-lang/Nim#13368))
- Fixed "Nim compiler hangs for certain C/C++ compiler errors"
  ([#8648](nim-lang/Nim#8648))
- Fixed "htmlgen does not support `data-*` attributes"
  ([#13444](nim-lang/Nim#13444))
- Fixed "[gc:arc] setLen will cause string not to be null-terminated."
  ([#13457](nim-lang/Nim#13457))
- Fixed "joinPath("", "") is "/" ; should be """
  ([#13455](nim-lang/Nim#13455))
- Fixed "[CI] flaky test on windows: tests/osproc/texitcode.nim"
  ([#13449](nim-lang/Nim#13449))
- Fixed "Casting to float32 on NimVM is broken"
  ([#13479](nim-lang/Nim#13479))
- Fixed "`--hints:off` doesn't work (doesn't override ~/.config/nim.cfg)"
  ([#8312](nim-lang/Nim#8312))
- Fixed "joinPath("", "") is "/" ; should be """
  ([#13455](nim-lang/Nim#13455))
- Fixed "tables.values is broken"
  ([#13496](nim-lang/Nim#13496))
- Fixed "global user config can override project specific config"
  ([#9405](nim-lang/Nim#9405))
- Fixed "Non deterministic macros and id consistency problem"
  ([#12627](nim-lang/Nim#12627))
- Fixed "try expression doesn't work with return on expect branch"
  ([#13490](nim-lang/Nim#13490))
- Fixed "CI will break every 4 years on feb 28: times doesn't handle leap years properly"
  ([#13543](nim-lang/Nim#13543))
- Fixed "[minor] `nimgrep --word` doesn't work with operators (eg misses  `1 +% 2`)"
  ([#13528](nim-lang/Nim#13528))
- Fixed "`as` is usable as infix operator but its existence and precedence are not documented"
  ([#13409](nim-lang/Nim#13409))
- Fixed "JSON unmarshalling drops seq's items"
  ([#13531](nim-lang/Nim#13531))
- Fixed "os.joinPath returns wrong path when head ends '\' or '/' and tail starts '..'."
  ([#13579](nim-lang/Nim#13579))
- Fixed "Block-local types with the same name lead to bad codegen (sighashes regression)"
  ([#5170](nim-lang/Nim#5170))
- Fixed "tuple codegen error"
  ([#12704](nim-lang/Nim#12704))
- Fixed "newHttpHeaders does not accept repeated headers"
  ([#13573](nim-lang/Nim#13573))
- Fixed "regression: --incremental:on fails on simplest example"
  ([#13319](nim-lang/Nim#13319))
- Fixed "strscan can't get value of last element in format"
  ([#13605](nim-lang/Nim#13605))
- Fixed "hashes_examples crashes with "Bus Error" (unaligned access) on sparc64"
  ([#12508](nim-lang/Nim#12508))
- Fixed "gc:arc bug with re-used `seq[T]`"
  ([#13596](nim-lang/Nim#13596))
- Fixed "`raise CatchableError` is broken with --gc:arc  when throwing inside a proc"
  ([#13599](nim-lang/Nim#13599))
- Fixed "cpp --gc:arc --exceptions:goto fails to raise with discard"
  ([#13436](nim-lang/Nim#13436))
- Fixed "terminal doesn't compile with -d:useWinAnsi"
  ([#13607](nim-lang/Nim#13607))
- Fixed "Parsing "sink ptr T" - region needs to be an object type"
  ([#12757](nim-lang/Nim#12757))
- Fixed "gc:arc + threads:on + closures compilation error"
  ([#13519](nim-lang/Nim#13519))
- Fixed "[ARC] segmentation fault"
  ([#13240](nim-lang/Nim#13240))
- Fixed "times.toDateTime buggy on 29th, 30th and 31th of each month"
  ([#13558](nim-lang/Nim#13558))
- Fixed "Deque misbehaves on VM"
  ([#13310](nim-lang/Nim#13310))
- Fixed "Nimscript listFiles should throw exception when path is not found"
  ([#12676](nim-lang/Nim#12676))
- Fixed "koch boot fails if even an empty config.nims is present in ~/.config/nims/ [devel regression]"
  ([#13633](nim-lang/Nim#13633))
- Fixed "nim doc generates lots of false positive LockLevel warnings"
  ([#13218](nim-lang/Nim#13218))
- Fixed "Arrays are passed by copy to iterators, causing crashes, unnecessary allocations and slowdowns"
  ([#12747](nim-lang/Nim#12747))
- Fixed "Range types always uses signed integer as a base type"
  ([#13646](nim-lang/Nim#13646))
- Fixed "Generate c code cannot compile with recent devel version"
  ([#13645](nim-lang/Nim#13645))
- Fixed "[regression] VM: Error: cannot convert -1 to uint64"
  ([#13661](nim-lang/Nim#13661))
- Fixed "Spurious raiseException(Exception) detected"
  ([#13654](nim-lang/Nim#13654))
- Fixed "gc:arc memory leak"
  ([#13659](nim-lang/Nim#13659))
- Fixed "Error: cannot convert -1 to uint (inside tuples)"
  ([#13671](nim-lang/Nim#13671))
- Fixed "strformat issue with --gc:arc"
  ([#13622](nim-lang/Nim#13622))
- Fixed "astToStr doesn't work inside generics"
  ([#13524](nim-lang/Nim#13524))
- Fixed "oswalkdir.walkDirRec wont return folders"
  ([#11458](nim-lang/Nim#11458))
- Fixed "`echo 'echo 1' | nim c -r -`  silently gives wrong results (nimBetterRun not updated for stdin)"
  ([#13412](nim-lang/Nim#13412))
- Fixed "gc:arc destroys the global variable accidentally."
  ([#13691](nim-lang/Nim#13691))
- Fixed "[minor] sigmatch errors should be sorted, for reproducible errors"
  ([#13538](nim-lang/Nim#13538))
- Fixed "Exception when converting csize to clong"
  ([#13698](nim-lang/Nim#13698))
- Fixed "ARC: variables are no copied on the thread spawn causing crashes"
  ([#13708](nim-lang/Nim#13708))
- Fixed "Illegal distinct seq causes compiler crash"
  ([#13720](nim-lang/Nim#13720))
- Fixed "cyclic seq definition crashes the compiler"
  ([#13715](nim-lang/Nim#13715))
- Fixed "Iterator with openArray parameter make the argument evaluated many times"
  ([#13417](nim-lang/Nim#13417))
- Fixed "net/asyncnet: Unable to access peer's certificate chain"
  ([#13299](nim-lang/Nim#13299))
- Fixed "Accidentally "SIGSEGV: Illegal storage access" error after arc optimizations (#13325)"
  ([#13709](nim-lang/Nim#13709))
- Fixed "Base64 Regression"
  ([#13722](nim-lang/Nim#13722))
- Fixed "A regression (?) with --gc:arc and repr"
  ([#13731](nim-lang/Nim#13731))
- Fixed "Internal compiler error when using the new variable pragmas"
  ([#13737](nim-lang/Nim#13737))
- Fixed "bool conversion produces vcc 2019 warning at cpp compilation stage"
  ([#13744](nim-lang/Nim#13744))
- Fixed "Compiler "does not detect" a type recursion error in the wrong code, remaining frozen"
  ([#13763](nim-lang/Nim#13763))
- Fixed "[minor] regression: `Foo[0.0] is Foo[-0.0]` is now false"
  ([#13730](nim-lang/Nim#13730))
- Fixed "`nim doc` - only whitespace on first line causes segfault"
  ([#13631](nim-lang/Nim#13631))
- Fixed "hashset regression"
  ([#13794](nim-lang/Nim#13794))
- Fixed "`os.getApplFreebsd` could return incorrect paths in the case of a long path"
  ([#13806](nim-lang/Nim#13806))
- Fixed "Destructors are not inherited"
  ([#13810](nim-lang/Nim#13810))
- Fixed "io.readLines AssertionError on devel"
  ([#13829](nim-lang/Nim#13829))
- Fixed "exceptions:goto accidentally reset the variable during exception handling"
  ([#13782](nim-lang/Nim#13782))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants