-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
re.split unexpected results with zero-width characters #14468
Comments
Just use |
No thank you I'm sticking with re, it's nicer. |
@capocasa sometimes it takes a bit more convincing and data points, can you please show output for other programming languages and libraries? here's a start: D, python, re, nre, nim-regex D/+
D20200528T005513
+/
import std.stdio;
import std.regex;
void main(string[]args){
writeln(splitter("foo", regex("^")));
writeln(splitter("foo", regex("$")));
writeln(splitter("foo bar", regex("\\b")));
writeln(splitter("foobar", regex("(?<=o)b")));
writeln(splitter("foobar", regex("o(?=b)")));
}
python3# D20200528T005513
import re
print(re.split("^", "foo"))
print(re.split("$", "foo"))
print(re.split("\\b", "foo bar"))
print(re.split("(?<=o)b", "foobar"))
print(re.split("o(?=b)", "foobar"))
nim-regeximport regex
echo split("foo", re"^")
echo split("foo", re"$")
echo split("foo bar", re"\b")
echo split("foobar", re"(?<=o)b")
echo split("foobar", re"o(?=b)") /cc @nitely => see unhandled exception:
nrewhen true:
import nre
echo split("foo", re"^")
echo split("foo", re"$")
echo split("foo bar", re"\b")
echo split("foobar", re"(?<=o)b")
echo split("foobar", re"o(?=b)")
re@["f", "oo"]
@["foo"]
@["f", "oo ", "b", "ar"]
@["foo", "ar"]
@["fo", "bar"] As shown above, although there is some difference in behavior across languages/libraries, |
Well PRs are welcome but I won't do it. Been there, done that, regex is a most expensive time sink. Without much benefits, in the end regexes are most unsuitable for robust parsers. |
It would be more productive to deprecate both re and nre and point people to nim-regex. |
well I'm pretty sure no one ever implied here that you should do it; a bug is a bug, anyone including reporter can fix it; but ppl (esp reporter) is unlikely to fix it if it's classified as "wontfix"
yes, unsuitable for parsers but there are many practical use cases you can't discount; consistency matters when possible (cf above discrepencies)
nim-regex has the better API (+ pure nim = works with other backends + vm), but there's still a performance gap, so until gap is bridged, re,nre stay relevant (see nitely/nim-regex#58 (comment)) |
I do not believe that line of thinking is applicable to the 1.x branch. Andreas, you are stretched very, very thin, so I totallly get it might be borderline offensive to be bothered with a dumb little maybe-a-bug in a module that's mainly there to accomodate people's mindless habits. On the other hand, Nim is post 1.0- That branch is no longer about good, that branch is about mature. So both re and nre are going to have to be dragged into complete inoffensiveness one ragged detail at a time through uninspiring leg work, or people are going to reach for awk. If that doesn't sound like you, I think it's because you aren't. I would like to go out on a limb here and wonder if you should really be on github triaging bugs for 1.x. Might it be possible to make something kind of radical happen- to turn over responsibility for maintenance of 1.x to someone who excels at polish, so you can focus on what you want to focus on? And until then, can you re-open this please, so someone can fix it?
Great idea, see below. Looks like regex split behavior is less standardized than I thought- PHP, D and Python behave as I anticipated, while JavaScript, Ruby and- look at that- Perl omit the empty strings. None behave like re, so I'd say that's a bug by expectation. Since it probably doesn't really matter and we just have to pick one, it would probably make sense to emulate python/re/nim-regex behavior here. Python users are future Nim users, aren't they? 😉 PHP
Javascript / Node
Ruby
Perl
|
well he already said @capocasa thanks for the data, it helps; now would you like to contribute a PR to fix at least the clearly wrong cases, and leave out the other cases for further debate/work? too many bugs, not enough PRs :-)
|
@timotheecour Cool! OK I'll see what I can do, long list of various intended contributions and pesky life-related activities. |
I had a look but I ran into a bit of a snag- are there any more unit tests for re except those in tests/stdlib/tregex.nim? If they're not and i fix this I might be introducing any number of regressions. Edit: Couldn't find any so far. Without them, this is more than a fix- best way forward I found is to copy/paste the nre tests and then drop or adapt the ones that don't match, figure out why the remaining ones fail, and then fix this. |
# tests/stdlib/tre.nim # re specific
# tests/stdlib/tnre.nim # nre specific
# tests/stdlib/mre_or_nre.nim # common to nre + re
import unittest
template testAll(xre) = # call with re and nre
import xre
check split(re"(?<=o)b", "foobar") == @["foo", "ar"]
check ...
when defined(testRe): testAll(re)
elif defined(testNre): testAll(nre)
else: static: doAssert false
# then call with -d:testRe and -d:testNRe (multiple options for that, one of them is from trunner; another is via the usual testament spec) (would be much easier to do that with import at block scope though, as it would avoid the separate compilation)
|
@timotheecour Cool, thanks for the move and your input! |
I think it would be good to duplicate the tests but structure them to be reasonably easy to keep in sync manually. That keeps some additional moving parts out of the debugging process. |
if so, a single file instead of 1 file per function is preferable (much easier to manage); and as mentioned, that's other most other modules use |
I'm messing with this from time to time. It's hard. |
do you have a PR draft ? |
Nope! Very limited time but will return from time to time. Still understanding code, figuring out how to get a different code path for "foo".split(re"") and "foo".split(re"^"). If someone else were to look into this please post so we don't duplicate effort. Thanks! |
created PR #19248 |
Concerns these changes: nim-lang/Nim@727c637...340b5a1 Excluded changes are: nim-lang#18963 nim-lang#19003 nim-lang#19043 nim-lang#19055 nim-lang#19053 nim-lang#19064 nim-lang#18642 nim-lang#19062 nim-lang#19082 nim-lang#19090 nim-lang#19077 nim-lang#19021 nim-lang#19100 nim-lang#19102 nim-lang#19111 nim-lang#19115 nim-lang#19133 nim-lang#19142 nim-lang#19158 nim-lang#19129 nim-lang#19137 nim-lang#19168 nim-lang#19156 nim-lang#19147 nim-lang#19180 nim-lang#19183 nim-lang#19182 nim-lang#19187 nim-lang#19179 nim-lang#19209 nim-lang#19210 nim-lang#19207 nim-lang#19219 nim-lang#19195 nim-lang#19212 nim-lang#19134 nim-lang#19235 nim-lang#19252 nim-lang#19196 nim-lang#19295 nim-lang#19301 nim-lang#19181 nim-lang#17223 nim-lang#19370 nim-lang#19385 nim-lang#19307 nim-lang#19394 nim-lang#19399 nim-lang#19390 nim-lang#19407 nim-lang#19419 nim-lang#19421 nim-lang#19363 nim-lang#19406 nim-lang#19431 nim-lang#19455 nim-lang#19461 nim-lang@cb894c7 nim-lang#19462 nim-lang#19442 nim-lang#19437 nim-lang#19433 nim-lang#19512 nim-lang#19487 nim-lang#19543 Excluded changes include major changes which require more consideration and changes which don't apply to the current code anymore but could be worth porting over still. Excluded changes which only change the identifier casing in tests or only concern code removed in nimskull aren't listed. Begin commit listing: use two underscores for easy demangling [backport:1.6] (nim-lang#19028) Add Elbrus 2000 architecture (nim-lang#19024) * Add Elbrus 2000 architecture * Add e2k to niminst * Update compiler/installer.ini Co-authored-by: Andreas Rumpf <[email protected]> remove exception (nim-lang#18906) allow converting static vars to `openArray` (nim-lang#19035) When assigning constant output to a seq, and then passing that static seq to other functions that take `openArray`, the compiler may end up producing errors, as it does not know how to convert `static[seq[T]]` to `openArray[T]`. By ignoring the `static` wrapper on the type for the purpose of determining data memory location and length, this gets resolved cleanly. Unfortunately, it is relatively tricky to come up with a minimal example, as there are followup problems from the failing conversion, e.g., this may lead to `internal error: inconsistent environment type`, instead of the relevant `openArrayLoc` error message. use the correct header for TIOCGWINSZ on Solaris (nim-lang#19037) Minor update to terminal docs (nim-lang#19056) * Update terminal.nim - Added some extra docs to cursorUp/Down/Forward/Backward - I was able to use hideCursor and showCursor without adding stdout, removed the parameter - Added docs to terminalHeight()* and terminalWidth()* * Update lib/pure/terminal.nim Co-authored-by: konsumlamm <[email protected]> * Update lib/pure/terminal.nim Co-authored-by: konsumlamm <[email protected]> * Added back f: file to cursor movement * Removed unnecessary comments Co-authored-by: konsumlamm <[email protected]> fix a tiny formating issue in doc/destructors.rst (nim-lang#19058) fix a tiny code snippet formatting issue in `doc/constructors.rst`, again (nim-lang#19065) Fix nimIdentNormalize, fixes nim-lang#19067 (nim-lang#19068) * Make nimIdentNormalize return "" when passed ""; fixes nim-lang#19067 Fixes nim-lang#19067 * Add tests for nimIdentNormalize fix nim-lang#18971 (nim-lang#19070) [backport:1.6] since the example code return value from global variable, instead of first argument, the `n.len` is 1 which causes compiler crashes. fixes nim-lang#19000 (nim-lang#19032) * fixes nim-lang#19000 * progress fix nim-lang#18410 (Errors initializing an object of RootObj with the C++ backend) [backport] (nim-lang#18836) * fix nim-lang#18410 * one line comment * typo * typo * cover cpp update numbers of lifetime-tracking hooks in doc/destructors.rst (nim-lang#19088) bootstrapping Nim compiler with `cpp --gc:orc` (nim-lang#19087) libs/impore/re: Add note about the requirement of `matches` to be pre-allocated (nim-lang#19081) Add few runnableExamples for `findBounds` for clarity. Fixes nim-lang#18775 Add test for issue 15435 (nim-lang#19079) * Add test for issue 15435 Closes nim-lang#15435. * Specify bug # in comment Addresses nim-lang#19079 (comment) manual: Document the use of `static` as a proc call (nim-lang#19084) * manual: Document the use of `static` as a proc call Also adds tests. Fixes nim-lang#16987 . * Update doc/manual.rst Co-authored-by: konsumlamm <[email protected]> * Use the "bug #NNNN" comment syntax for consistency Ref: https://nim-lang.github.io/Nim/contributing.html#writing-tests-stdlib > Always refer to a GitHub issue using the following exact syntax: bug for tooling. * manual: Undocument usage of foo.static foo.static and foo.static() are not expected to work. Ref: https://github.com/nim-lang/Nim/pull/19084/files#r741203578 Co-authored-by: konsumlamm <[email protected]> manual: Document that comma propagates the default values of parameters (nim-lang#19080) * manual: Document that comma propagates the default values of parameters Fixes nim-lang#15949. * Use the "bug #NNNN" comment syntax for consistency Ref: https://nim-lang.github.io/Nim/contributing.html#writing-tests-stdlib > Always refer to a GitHub issue using the following exact syntax: bug for tooling. fixes nim-lang#19011 [backport:1.6] (nim-lang#19114) Add deprecation pragmas in lib/deprecated/pure (nim-lang#19113) Deprecate `std/sharedlist` and `std/sharedtables` (nim-lang#19112) fix nimindexterm in rst2tex/doc2tex [backport] (nim-lang#19106) * fix nimindexterm (rst2tex/doc2tex) [backport] * Add support for indexing in rst Call {.cursor.} a pragma. (nim-lang#19116) * Call {.cursor.} a pragma. Its hard to find .curser annotation while googling because all other things like it are called pragmas. See https://nim-lang.org/docs/manual.html#pragmas Also the . in front of the name makes it hard to find and search for. Can we just call it cursor pragma? * Small fix for comment. Remove tlsEmulation enabled from Windows + GCC config (nim-lang#19119) [backport:1.6] This flag has a very significant performance impact on programs compiled with --threads:on. It is also apparently not needed anymore for standard circumstances. Can we remove the config? See nim-lang#18146 (comment) for discussion and perf impact. [backport:1.6] Add security tip for setCookie (nim-lang#19117) * Add security tip for setCookie * Update lib/pure/cookies.nim Co-authored-by: Dominik Picheta <[email protected]> * Update lib/pure/cookies.nim Co-authored-by: konsumlamm <[email protected]> Co-authored-by: Andreas Rumpf <[email protected]> Co-authored-by: Dominik Picheta <[email protected]> Co-authored-by: konsumlamm <[email protected]> correct cookie docs (nim-lang#19122) refactoring: orc can use getThreadId() (nim-lang#19123) * refactoring: orc can use getThreadId() * progress fixed colorNames sorting mistake (nim-lang#19125) [backport] update manual (nim-lang#19130) [backport] Merge file size fields correctly on Windows (nim-lang#19141) * Merge file size fields correctly on Windows Merge file size fields correctly on Windows - Merge the two 32-bit file size fields from `BY_HANDLE_FILE_INFORMATION` correctly in `rawToFormalFileInfo`. - Fixes nim-lang#19135 * Update os.nim Fix punycode.decode function (nim-lang#19136) * Refactor: rename proc to func * Fix punycode.decode function This function could only properly decode punycodes containing a single encoded unicode character. As soon as there was more than one punycode character group to decode it produced invalid output - the number of characters was correct, but their position was not. * Update tpunycode.nim Co-authored-by: Clay Sweetser <[email protected]> Fix undeclared 'SYS_getrandom' on emscripten (nim-lang#19144) wrong spaces (3 => 2) (nim-lang#19145) `caseStmtMacros` no longer experimental, experimental manual refactor (nim-lang#19173) * `caseStmtMacros` no longer experimental, experimental manual refactor * Update doc/manual.rst * apply review suggestions * apply review Co-authored-by: Andreas Rumpf <[email protected]> fix inline syntax highlighting in system.nim (nim-lang#19184) swap port to correct port order (nim-lang#19177) Co-authored-by: Jaremy Creechley <[email protected]> feat: TLS-ALPN wrappers for OpenSSL (nim-lang#19202) Co-authored-by: Iced Quinn <[email protected]> misc bugfixes [backport:1.2] (nim-lang#19203) treat do with pragmas but no parens as proc (nim-lang#19191) fixes nim-lang#19188 [format minor] remove unnecessary spaces (nim-lang#19216) Making TCC work again on Windows --cpu:amd64 - fix nim-lang#16326 (nim-lang#19221) * fix nim-lang#16326 * removing comments fixes a converter handling regression that caused private converters to leak into client modules; fixes nim-lang#19213; [backport:1.6] (nim-lang#19229) Add support for LoongArch (nim-lang#19223) * Add support for LoongArch * Update compiler/installer.ini Co-authored-by: Andreas Rumpf <[email protected]> remove `std/sharedstrings` (nim-lang#19228) * remove std/sharedstrings it has been broken since 0.18.0 * rephrase the changelog entry add comments to spawn and pinnedSpawn (nim-lang#19230) `spawn` uses `nimSpawn3` internally and `pinnedSpawn` uses `nimSpawn4` internally. I comment it in order to help contributors get the gist of its functionality. fixes an old ARC bug: the produced copy/sink operations don't copy the hidden type field for objects with enabled inheritance; fixes nim-lang#19205 [backport:1.6] (nim-lang#19232) nimRawSetjmp: support Windows (nim-lang#19197) * nimRawSetjmp: support Windows Using `_setjmp()` directly is required to avoid some rare (but very annoying) exception-related stack corruption leading to segfaults on Windows, with Mingw-w64 and SEH. More details: status-im/nimbus-eth2#3121 Also add "nimBuiltinSetjmp" - mostly for benchmarking. * fix for Apple's Clang++ Revert "swap port to correct port order (nim-lang#19177)" (nim-lang#19234) This reverts commit 0d0c249. move toDeque to after addLast (nim-lang#19233) [backport:1.0] Changes the order of procs definitions in order to avoid calling an undefined proc. let Nim support Nimble 0.14 with lock-file support [backport:1.6] (nim-lang#19236) nimc.rst: fix table markup (nim-lang#19239) Various std net improvements (nim-lang#19132) * Variant of that works with raw IpAddresses. - Add doc tests for new net proc's. - Aadd recvFrom impl - Add recvFrom impl -- tweak handling data var - Update lib/pure/net.nim Co-authored-by: Dominik Picheta <[email protected]> - cleaning up sendTo args - remove extra connect test - cleaning up sendTo args - fix inet_ntop test - fix test failing - byte len * fix test failing - byte len * debugging odd windows build failure * debugging odd windows build failure * more experiments to figure out the windows failure * try manual assigment on InAddr Co-authored-by: Jaremy Creechley <[email protected]> fix bug nim-lang#14468 zero-width split (nim-lang#19248) basicopt.txt: Unify the format (nim-lang#19251) fix: fixes bug in CVerifyPeerUseEnvVars (nim-lang#19247) Previously CVerifyPeerUseEnvVars was not being passed into scanSslCertificates, which meant that we weren't scanning additional certificate locations given via the SSL_CERT_FILE and SSL_CERT_DIR environment variables suggestion to respect typedarray type (nim-lang#19257) * suggestion to respect typedarray * Update jssys.nim Co-authored-by: Sven Keller <[email protected]> fix nim-lang#19244 - solves the problem of the InAddr object constructor in Windows. (nim-lang#19259) * Update winlean.nim * Update tnet_ll.nim Fixed typo in manual.rst unsafeAssign->uncheckedAssign. Fixes part 1 of nim-lang#19266 (nim-lang#19267) use uppercase "type" for Proxy-Authorization header (nim-lang#19273) Some servers will reject authorization requests with a lowercase "basic" type. Changing to "Basic" seems to solve these issues. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Proxy-Authorization Update colors.nim (nim-lang#19274) * Update colors.nim Added `lightgray` alias to `lightgrey` and `...grey`aliases for the rest of the gray colors. Added color `rebeccapurple`. Fixed the incorrect values for the `PaleVioletRed` and `MediumPurple` colors. This module should now be matching the CSS colors. I used the seq[tuple] syntax for defining the names. * Document colors changes. Extract runnables that specify `doccmd` (nim-lang#19275) [backport:1.6] Fix build on FreeBSD/powerpc (nim-lang#19282) It's currently misdetected as powerpc64. Fix nim-lang#19107 (nim-lang#19286) [backport] fixes grammar typos [backport] (nim-lang#19289) fix 19292 (nim-lang#19293) Fix nim-lang#19297 - fixing broken list after adding empty list (nim-lang#19299) * Update lists.nim * Update tlists.nim * removed check `if b.tail != nil` The tail of the list being null it is still possible to retrieve its end by going through all nodes from the head. So checking for null from `b.tail` is unnecessary. However, setting `a.tail = b.tail` only if `a.head != nil`, so you don't break a good list with an already broken one. fixes nim-lang#16617 [backport] (nim-lang#19300) Update JS and nimscript import tests (nim-lang#19306) * add new modules, except experimental ones * remove deprecated modules mersenne and sharedlist * better describe why some modules fail and some modules don't add compile time option for POSIX sigwait on Illumos/Solaris (nim-lang#19296) * add compile time option for POSIX sigwait on Illumos/Solaris * fix link to documentation of `sigwait` on Illumos/Solaris [docs] clarify the raised exception (nim-lang#19308) * [docs] clarify the raised exception Lest developers wanna know what the exception is. * Apply suggestions from @konsumlamm Co-authored-by: konsumlamm <[email protected]> Co-authored-by: konsumlamm <[email protected]> docs: Fix typo in tut1.rst (nim-lang#19309) Fix nim-lang#19314 - fixing broken `DoublyLinkedList` after adding empty `DoublyLinkedList` (nim-lang#19315) [backport] * Update lists.nim * Update tlists.nim fixed typos (nim-lang#19316) devel: style fix (nim-lang#19318) this allows "--styleCheck:usages --styleCheck:error" docs: Fix typo in tut1.rst (nim-lang#19324) correct the comments (nim-lang#19322) --expandArc ``` var a b a = matrix(5, 5, 1.0) b = matrix(5, 5, 2.0) `=sink`(b, - let blitTmp = b wasMoved(b) blitTmp + a) `=destroy`(b) `=destroy`(a) ``` add std/private/win_getsysteminfo; refactor the usage of `GetSystemInfo` (nim-lang#19310) * add std/private/win_getsysteminfo * import at the top level * wrappers follow nep1 too * follow review comment Update net.nim (nim-lang#19327) [backport] Fix nim-lang#19038 - making the Nim compiler work again on Windows XP (nim-lang#19331) * Update osenv.nim * Update win_setenv.nim * Update lib/pure/includes/osenv.nim * Update lib/pure/includes/osenv.nim * fixing cstring Co-authored-by: Andreas Rumpf <[email protected]> fix nim-lang#19343 (nim-lang#19344) [backport] Ensure HttpClient onProgress is called once per second Ensure that reported speed is accurate stylecheck usages part two: stdlib cleanup (nim-lang#19338) * stylecheck usages part two: stdlib cleanup typeinfo.nim: importCompilerProc => importcompilerproc nre.nim: newLineFlags => newlineFlags system.nim: JSRoot => JsRoot ref nim-lang#19319 * prefer importCompilerProc added filemode docs (nim-lang#19346) Fix `remove` on last node of singly-linked list [backport:1.6] (nim-lang#19353) fix stylecheck error with asyncdispatch (nim-lang#19350) * stylecheck usages part two: stdlib cleanup typeinfo.nim: importCompilerProc => importcompilerproc nre.nim: newLineFlags => newlineFlags system.nim: JSRoot => JsRoot ref nim-lang#19319 * prefer importCompilerProc * fix stylecheck error with asyncdispatch it is a partial regression since nim-lang#12842 * add tests * don't use echo in tests remove spaces between an identifier and a star (nim-lang#19355) It makes search easier by searching `+`* instead of `+` which filter lots of unexported versions. Follow nim-lang#18681 bitsets.nim: cleanup (nim-lang#19361) make rst thread safe (nim-lang#19369) split for the convenience of review docs: Mention `import foo {.all.}` syntax (nim-lang#19377) Mention the `import foo {.all.}` syntax in the manual, with a caveat about private imports. Also link to the experimental importutils module. Co-authored-by: adigitoleo <[email protected]> update copyright year (nim-lang#19381) docs: Fix broken cross references to `rfind` in strutils (nim-lang#19382) [backport] Fixes three broken cross references to `rfind` in strutils. Breakage due to signature changes of the `rfind` methods. Co-authored-by: adigitoleo <[email protected]> move type operation section and remove deepcopy document (nim-lang#19389) ref nim-lang#19173; because deepcopy is not fit for ORC/ARC which was used for spawn and spawn will be removed from compiler deprecate unsafeAddr; extend addr (nim-lang#19373) * deprecate unsafeAddr; extend addr addr is now available for all addressable locations, unsafeAddr is deprecated and become an alias for addr * follow @Vindaar's advice * change the signature of addr * unsafeAddr => addr (stdlib) * Update changelog.md * unsafeAddr => addr (tests) * Revert "unsafeAddr => addr (stdlib)" This reverts commit ab83c99. * doc changes; thanks to @konsumlamm Co-authored-by: konsumlamm <[email protected]> Co-authored-by: konsumlamm <[email protected]> improve changelog a bit (nim-lang#19400) mangle names in nimbase.h using cppDefine (nim-lang#19395) [backport] mangle names in nimbase.h fix comments Optimize lent in JS [backport:1.6] (nim-lang#19393) * Optimize lent in JS [backport:1.6] * addr on lent doesn't work anymore, don't use it * use unsafeAddr in test again for older versions update deprecated example (nim-lang#19415) `toNimIdent` proc is deprecated, so I replaced it with `ident` proc Improve Zshell completion (nim-lang#19354) fix stricteffects (nimsuggest/sexp) (nim-lang#19405) * fix stricteffects (nimsuggest/sexp) * Update tstrict_effects3.nim * Update tests/effects/tstrict_effects3.nim suppress deprecated warnings (nim-lang#19408) * suppress deprecated warnings once bump version to 1.7.3 enable deprecated messages * deprecate later add an example to setControlCHook (nim-lang#19416) * add an example to setControlCHook * [skip CI] format example for setControlCHook Co-authored-by: Nathan Blaxall <[email protected]> fix term rewriting with sideeffect (nim-lang#19410) * fix term rewriting with sideeffect fix nim-lang#6217 * add tests * Update tests/template/template_various.nim Resolve cross file resolution errors in atomics (nim-lang#19422) [backport:1.6] * Resolve call undeclared routine testAndSet * Fix undeclared field atomicType Fix nim-lang#11923 (nim-lang#19427) * Apply commit nim-lang@5da931f that was never merged (was part of a bigger PR). Should fix issue nim-lang#11932 * add a generic object for custom pragma os: faster getFileSize (nim-lang#19438) Use "stat" rather than "open", "seek", and "close" system calls. The Windows implementation remains the same. bugfix: varargs count as open arrays (nim-lang#19447) update outdated link (nim-lang#19465) Ref nim-lang#19463 Update jsfetch with latest API and fix missing bindings (nim-lang#19473) * Update with latest API and fix missing bindings remove deprecated `Body` remove implicit `cstring` convs add `Headers` to `FetchOptions` add `Request` init proc which takes `FetchOptions` * Update lib/std/jsfetch.nim Co-authored-by: Juan Carlos <[email protected]> * Update lib/std/jsfetch.nim Co-authored-by: Juan Carlos <[email protected]> * remove experimental flag Co-authored-by: Juan Carlos <[email protected]> No longer segfault when using a typeclass with a self referencing type (nim-lang#19467) Clonkk fix2 11923 (nim-lang#19451) * fix nnkBracketExpr not compiling for getImpl on customPragmaNode * fix test import * fix alias not working with hasCustomPragmas fix parseEnum cannot parse enum with const fields (nim-lang#19466) fix nim-lang#19463 Add compilers and hints to default nim.cfg (nim-lang#18424) don't use a temp for addr [backport: 1.6] (nim-lang#19503) * don't use a temp for addr fix nim-lang#19497 * Update compiler/ccgcalls.nim Co-authored-by: konsumlamm <[email protected]> * add a test Co-authored-by: konsumlamm <[email protected]> fixes nim-lang#19404 by protecting the memory we borrow from. this replaces crashes with minor memory leaks which seems to be acceptable. In the longer run we need a better VM that didn't grow hacks over a decade. (nim-lang#19515) Co-authored-by: flywind <[email protected]> Remove backslash in glob pattern (nim-lang#19524) use OrderedTable instead of OrderedTableRef for mimedb (nim-lang#19522) * use OrderedTable instead of OrderedTableRef for mimedb Signed-off-by: David Krause <[email protected]> * added changelog entry for mimedb change Signed-off-by: David Krause <[email protected]> Remove Deprecated oids.oidsToString (nim-lang#19519) * Remove deprecated oids.oidToString * Remove deprecated oids.oidToString Remove deprecated math.c_frexp (nim-lang#19518) * Remove Deprecated math proc * Remove Deprecated math proc * Remove Deprecated math proc [testcase] genSym fails to make unique identifier for ref object types (nim-lang#19506) close nim-lang#15118 Documentation: Fix word usage (nim-lang#19529) Update chcks.nim (nim-lang#19540) keep casing of noinit and noreturn pragmas consistently documented (nim-lang#19535) compile pragma: cache the result sooner (nim-lang#19554) extccomp.addExternalFileToCompile() relies on hashes to decide whether an external C file needs recompilation or not. Due to short-circuit evaluation of boolean expressions, the procedure that generates a corresponding hash file is not called the first time an external file is compiled, so an avoidable recompilation is triggered the next build. This patch fixes that by moving the proc call with a desired side effect from its boolean expression, so it's executed unconditionally.
Concerns these changes: nim-lang/Nim@727c637...340b5a1 Excluded changes are: nim-lang#18963 nim-lang#19003 nim-lang#19043 nim-lang#19055 nim-lang#19053 nim-lang#19064 nim-lang#18642 nim-lang#19062 nim-lang#19082 nim-lang#19090 nim-lang#19077 nim-lang#19021 nim-lang#19100 nim-lang#19102 nim-lang#19111 nim-lang#19115 nim-lang#19133 nim-lang#19142 nim-lang#19158 nim-lang#19129 nim-lang#19137 nim-lang#19168 nim-lang#19156 nim-lang#19147 nim-lang#19180 nim-lang#19183 nim-lang#19182 nim-lang#19187 nim-lang#19179 nim-lang#19209 nim-lang#19210 nim-lang#19207 nim-lang#19219 nim-lang#19195 nim-lang#19212 nim-lang#19134 nim-lang#19235 nim-lang#19252 nim-lang#19196 nim-lang#19295 nim-lang#19301 nim-lang#19181 nim-lang#17223 nim-lang#19370 nim-lang#19385 nim-lang#19307 nim-lang#19394 nim-lang#19399 nim-lang#19390 nim-lang#19407 nim-lang#19419 nim-lang#19421 nim-lang#19363 nim-lang#19406 nim-lang#19431 nim-lang#19455 nim-lang#19461 nim-lang@cb894c7 nim-lang#19462 nim-lang#19442 nim-lang#19437 nim-lang#19433 nim-lang#19512 nim-lang#19487 nim-lang#19543 Excluded changes include major changes which require more consideration and changes which don't apply to the current code anymore but could be worth porting over still. Excluded changes which only change the identifier casing in tests or only concern code removed in nimskull aren't listed. Begin commit listing: use two underscores for easy demangling [backport:1.6] (nim-lang#19028) Add Elbrus 2000 architecture (nim-lang#19024) * Add Elbrus 2000 architecture * Add e2k to niminst * Update compiler/installer.ini Co-authored-by: Andreas Rumpf <[email protected]> remove exception (nim-lang#18906) allow converting static vars to `openArray` (nim-lang#19035) When assigning constant output to a seq, and then passing that static seq to other functions that take `openArray`, the compiler may end up producing errors, as it does not know how to convert `static[seq[T]]` to `openArray[T]`. By ignoring the `static` wrapper on the type for the purpose of determining data memory location and length, this gets resolved cleanly. Unfortunately, it is relatively tricky to come up with a minimal example, as there are followup problems from the failing conversion, e.g., this may lead to `internal error: inconsistent environment type`, instead of the relevant `openArrayLoc` error message. use the correct header for TIOCGWINSZ on Solaris (nim-lang#19037) Minor update to terminal docs (nim-lang#19056) * Update terminal.nim - Added some extra docs to cursorUp/Down/Forward/Backward - I was able to use hideCursor and showCursor without adding stdout, removed the parameter - Added docs to terminalHeight()* and terminalWidth()* * Update lib/pure/terminal.nim Co-authored-by: konsumlamm <[email protected]> * Update lib/pure/terminal.nim Co-authored-by: konsumlamm <[email protected]> * Added back f: file to cursor movement * Removed unnecessary comments Co-authored-by: konsumlamm <[email protected]> fix a tiny formating issue in doc/destructors.rst (nim-lang#19058) fix a tiny code snippet formatting issue in `doc/constructors.rst`, again (nim-lang#19065) Fix nimIdentNormalize, fixes nim-lang#19067 (nim-lang#19068) * Make nimIdentNormalize return "" when passed ""; fixes nim-lang#19067 Fixes nim-lang#19067 * Add tests for nimIdentNormalize fix nim-lang#18971 (nim-lang#19070) [backport:1.6] since the example code return value from global variable, instead of first argument, the `n.len` is 1 which causes compiler crashes. fixes nim-lang#19000 (nim-lang#19032) * fixes nim-lang#19000 * progress fix nim-lang#18410 (Errors initializing an object of RootObj with the C++ backend) [backport] (nim-lang#18836) * fix nim-lang#18410 * one line comment * typo * typo * cover cpp update numbers of lifetime-tracking hooks in doc/destructors.rst (nim-lang#19088) bootstrapping Nim compiler with `cpp --gc:orc` (nim-lang#19087) libs/impore/re: Add note about the requirement of `matches` to be pre-allocated (nim-lang#19081) Add few runnableExamples for `findBounds` for clarity. Fixes nim-lang#18775 Add test for issue 15435 (nim-lang#19079) * Add test for issue 15435 Closes nim-lang#15435. * Specify bug # in comment Addresses nim-lang#19079 (comment) manual: Document the use of `static` as a proc call (nim-lang#19084) * manual: Document the use of `static` as a proc call Also adds tests. Fixes nim-lang#16987 . * Update doc/manual.rst Co-authored-by: konsumlamm <[email protected]> * Use the "bug #NNNN" comment syntax for consistency Ref: https://nim-lang.github.io/Nim/contributing.html#writing-tests-stdlib > Always refer to a GitHub issue using the following exact syntax: bug for tooling. * manual: Undocument usage of foo.static foo.static and foo.static() are not expected to work. Ref: https://github.com/nim-lang/Nim/pull/19084/files#r741203578 Co-authored-by: konsumlamm <[email protected]> manual: Document that comma propagates the default values of parameters (nim-lang#19080) * manual: Document that comma propagates the default values of parameters Fixes nim-lang#15949. * Use the "bug #NNNN" comment syntax for consistency Ref: https://nim-lang.github.io/Nim/contributing.html#writing-tests-stdlib > Always refer to a GitHub issue using the following exact syntax: bug for tooling. fixes nim-lang#19011 [backport:1.6] (nim-lang#19114) Add deprecation pragmas in lib/deprecated/pure (nim-lang#19113) Deprecate `std/sharedlist` and `std/sharedtables` (nim-lang#19112) fix nimindexterm in rst2tex/doc2tex [backport] (nim-lang#19106) * fix nimindexterm (rst2tex/doc2tex) [backport] * Add support for indexing in rst Call {.cursor.} a pragma. (nim-lang#19116) * Call {.cursor.} a pragma. Its hard to find .curser annotation while googling because all other things like it are called pragmas. See https://nim-lang.org/docs/manual.html#pragmas Also the . in front of the name makes it hard to find and search for. Can we just call it cursor pragma? * Small fix for comment. Remove tlsEmulation enabled from Windows + GCC config (nim-lang#19119) [backport:1.6] This flag has a very significant performance impact on programs compiled with --threads:on. It is also apparently not needed anymore for standard circumstances. Can we remove the config? See nim-lang#18146 (comment) for discussion and perf impact. [backport:1.6] Add security tip for setCookie (nim-lang#19117) * Add security tip for setCookie * Update lib/pure/cookies.nim Co-authored-by: Dominik Picheta <[email protected]> * Update lib/pure/cookies.nim Co-authored-by: konsumlamm <[email protected]> Co-authored-by: Andreas Rumpf <[email protected]> Co-authored-by: Dominik Picheta <[email protected]> Co-authored-by: konsumlamm <[email protected]> correct cookie docs (nim-lang#19122) refactoring: orc can use getThreadId() (nim-lang#19123) * refactoring: orc can use getThreadId() * progress fixed colorNames sorting mistake (nim-lang#19125) [backport] update manual (nim-lang#19130) [backport] Merge file size fields correctly on Windows (nim-lang#19141) * Merge file size fields correctly on Windows Merge file size fields correctly on Windows - Merge the two 32-bit file size fields from `BY_HANDLE_FILE_INFORMATION` correctly in `rawToFormalFileInfo`. - Fixes nim-lang#19135 * Update os.nim Fix punycode.decode function (nim-lang#19136) * Refactor: rename proc to func * Fix punycode.decode function This function could only properly decode punycodes containing a single encoded unicode character. As soon as there was more than one punycode character group to decode it produced invalid output - the number of characters was correct, but their position was not. * Update tpunycode.nim Co-authored-by: Clay Sweetser <[email protected]> Fix undeclared 'SYS_getrandom' on emscripten (nim-lang#19144) wrong spaces (3 => 2) (nim-lang#19145) `caseStmtMacros` no longer experimental, experimental manual refactor (nim-lang#19173) * `caseStmtMacros` no longer experimental, experimental manual refactor * Update doc/manual.rst * apply review suggestions * apply review Co-authored-by: Andreas Rumpf <[email protected]> fix inline syntax highlighting in system.nim (nim-lang#19184) swap port to correct port order (nim-lang#19177) Co-authored-by: Jaremy Creechley <[email protected]> feat: TLS-ALPN wrappers for OpenSSL (nim-lang#19202) Co-authored-by: Iced Quinn <[email protected]> misc bugfixes [backport:1.2] (nim-lang#19203) treat do with pragmas but no parens as proc (nim-lang#19191) fixes nim-lang#19188 [format minor] remove unnecessary spaces (nim-lang#19216) Making TCC work again on Windows --cpu:amd64 - fix nim-lang#16326 (nim-lang#19221) * fix nim-lang#16326 * removing comments fixes a converter handling regression that caused private converters to leak into client modules; fixes nim-lang#19213; [backport:1.6] (nim-lang#19229) Add support for LoongArch (nim-lang#19223) * Add support for LoongArch * Update compiler/installer.ini Co-authored-by: Andreas Rumpf <[email protected]> remove `std/sharedstrings` (nim-lang#19228) * remove std/sharedstrings it has been broken since 0.18.0 * rephrase the changelog entry add comments to spawn and pinnedSpawn (nim-lang#19230) `spawn` uses `nimSpawn3` internally and `pinnedSpawn` uses `nimSpawn4` internally. I comment it in order to help contributors get the gist of its functionality. fixes an old ARC bug: the produced copy/sink operations don't copy the hidden type field for objects with enabled inheritance; fixes nim-lang#19205 [backport:1.6] (nim-lang#19232) nimRawSetjmp: support Windows (nim-lang#19197) * nimRawSetjmp: support Windows Using `_setjmp()` directly is required to avoid some rare (but very annoying) exception-related stack corruption leading to segfaults on Windows, with Mingw-w64 and SEH. More details: status-im/nimbus-eth2#3121 Also add "nimBuiltinSetjmp" - mostly for benchmarking. * fix for Apple's Clang++ Revert "swap port to correct port order (nim-lang#19177)" (nim-lang#19234) This reverts commit 0d0c249. move toDeque to after addLast (nim-lang#19233) [backport:1.0] Changes the order of procs definitions in order to avoid calling an undefined proc. let Nim support Nimble 0.14 with lock-file support [backport:1.6] (nim-lang#19236) nimc.rst: fix table markup (nim-lang#19239) Various std net improvements (nim-lang#19132) * Variant of that works with raw IpAddresses. - Add doc tests for new net proc's. - Aadd recvFrom impl - Add recvFrom impl -- tweak handling data var - Update lib/pure/net.nim Co-authored-by: Dominik Picheta <[email protected]> - cleaning up sendTo args - remove extra connect test - cleaning up sendTo args - fix inet_ntop test - fix test failing - byte len * fix test failing - byte len * debugging odd windows build failure * debugging odd windows build failure * more experiments to figure out the windows failure * try manual assigment on InAddr Co-authored-by: Jaremy Creechley <[email protected]> fix bug nim-lang#14468 zero-width split (nim-lang#19248) basicopt.txt: Unify the format (nim-lang#19251) fix: fixes bug in CVerifyPeerUseEnvVars (nim-lang#19247) Previously CVerifyPeerUseEnvVars was not being passed into scanSslCertificates, which meant that we weren't scanning additional certificate locations given via the SSL_CERT_FILE and SSL_CERT_DIR environment variables suggestion to respect typedarray type (nim-lang#19257) * suggestion to respect typedarray * Update jssys.nim Co-authored-by: Sven Keller <[email protected]> fix nim-lang#19244 - solves the problem of the InAddr object constructor in Windows. (nim-lang#19259) * Update winlean.nim * Update tnet_ll.nim Fixed typo in manual.rst unsafeAssign->uncheckedAssign. Fixes part 1 of nim-lang#19266 (nim-lang#19267) use uppercase "type" for Proxy-Authorization header (nim-lang#19273) Some servers will reject authorization requests with a lowercase "basic" type. Changing to "Basic" seems to solve these issues. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Proxy-Authorization Update colors.nim (nim-lang#19274) * Update colors.nim Added `lightgray` alias to `lightgrey` and `...grey`aliases for the rest of the gray colors. Added color `rebeccapurple`. Fixed the incorrect values for the `PaleVioletRed` and `MediumPurple` colors. This module should now be matching the CSS colors. I used the seq[tuple] syntax for defining the names. * Document colors changes. Extract runnables that specify `doccmd` (nim-lang#19275) [backport:1.6] Fix build on FreeBSD/powerpc (nim-lang#19282) It's currently misdetected as powerpc64. Fix nim-lang#19107 (nim-lang#19286) [backport] fixes grammar typos [backport] (nim-lang#19289) fix 19292 (nim-lang#19293) Fix nim-lang#19297 - fixing broken list after adding empty list (nim-lang#19299) * Update lists.nim * Update tlists.nim * removed check `if b.tail != nil` The tail of the list being null it is still possible to retrieve its end by going through all nodes from the head. So checking for null from `b.tail` is unnecessary. However, setting `a.tail = b.tail` only if `a.head != nil`, so you don't break a good list with an already broken one. fixes nim-lang#16617 [backport] (nim-lang#19300) Update JS and nimscript import tests (nim-lang#19306) * add new modules, except experimental ones * remove deprecated modules mersenne and sharedlist * better describe why some modules fail and some modules don't add compile time option for POSIX sigwait on Illumos/Solaris (nim-lang#19296) * add compile time option for POSIX sigwait on Illumos/Solaris * fix link to documentation of `sigwait` on Illumos/Solaris [docs] clarify the raised exception (nim-lang#19308) * [docs] clarify the raised exception Lest developers wanna know what the exception is. * Apply suggestions from @konsumlamm Co-authored-by: konsumlamm <[email protected]> Co-authored-by: konsumlamm <[email protected]> docs: Fix typo in tut1.rst (nim-lang#19309) Fix nim-lang#19314 - fixing broken `DoublyLinkedList` after adding empty `DoublyLinkedList` (nim-lang#19315) [backport] * Update lists.nim * Update tlists.nim fixed typos (nim-lang#19316) devel: style fix (nim-lang#19318) this allows "--styleCheck:usages --styleCheck:error" docs: Fix typo in tut1.rst (nim-lang#19324) correct the comments (nim-lang#19322) --expandArc ``` var a b a = matrix(5, 5, 1.0) b = matrix(5, 5, 2.0) `=sink`(b, - let blitTmp = b wasMoved(b) blitTmp + a) `=destroy`(b) `=destroy`(a) ``` add std/private/win_getsysteminfo; refactor the usage of `GetSystemInfo` (nim-lang#19310) * add std/private/win_getsysteminfo * import at the top level * wrappers follow nep1 too * follow review comment Update net.nim (nim-lang#19327) [backport] Fix nim-lang#19038 - making the Nim compiler work again on Windows XP (nim-lang#19331) * Update osenv.nim * Update win_setenv.nim * Update lib/pure/includes/osenv.nim * Update lib/pure/includes/osenv.nim * fixing cstring Co-authored-by: Andreas Rumpf <[email protected]> fix nim-lang#19343 (nim-lang#19344) [backport] Ensure HttpClient onProgress is called once per second Ensure that reported speed is accurate stylecheck usages part two: stdlib cleanup (nim-lang#19338) * stylecheck usages part two: stdlib cleanup typeinfo.nim: importCompilerProc => importcompilerproc nre.nim: newLineFlags => newlineFlags system.nim: JSRoot => JsRoot ref nim-lang#19319 * prefer importCompilerProc added filemode docs (nim-lang#19346) Fix `remove` on last node of singly-linked list [backport:1.6] (nim-lang#19353) fix stylecheck error with asyncdispatch (nim-lang#19350) * stylecheck usages part two: stdlib cleanup typeinfo.nim: importCompilerProc => importcompilerproc nre.nim: newLineFlags => newlineFlags system.nim: JSRoot => JsRoot ref nim-lang#19319 * prefer importCompilerProc * fix stylecheck error with asyncdispatch it is a partial regression since nim-lang#12842 * add tests * don't use echo in tests remove spaces between an identifier and a star (nim-lang#19355) It makes search easier by searching `+`* instead of `+` which filter lots of unexported versions. Follow nim-lang#18681 bitsets.nim: cleanup (nim-lang#19361) make rst thread safe (nim-lang#19369) split for the convenience of review docs: Mention `import foo {.all.}` syntax (nim-lang#19377) Mention the `import foo {.all.}` syntax in the manual, with a caveat about private imports. Also link to the experimental importutils module. Co-authored-by: adigitoleo <[email protected]> update copyright year (nim-lang#19381) docs: Fix broken cross references to `rfind` in strutils (nim-lang#19382) [backport] Fixes three broken cross references to `rfind` in strutils. Breakage due to signature changes of the `rfind` methods. Co-authored-by: adigitoleo <[email protected]> move type operation section and remove deepcopy document (nim-lang#19389) ref nim-lang#19173; because deepcopy is not fit for ORC/ARC which was used for spawn and spawn will be removed from compiler deprecate unsafeAddr; extend addr (nim-lang#19373) * deprecate unsafeAddr; extend addr addr is now available for all addressable locations, unsafeAddr is deprecated and become an alias for addr * follow @Vindaar's advice * change the signature of addr * unsafeAddr => addr (stdlib) * Update changelog.md * unsafeAddr => addr (tests) * Revert "unsafeAddr => addr (stdlib)" This reverts commit ab83c99. * doc changes; thanks to @konsumlamm Co-authored-by: konsumlamm <[email protected]> Co-authored-by: konsumlamm <[email protected]> improve changelog a bit (nim-lang#19400) mangle names in nimbase.h using cppDefine (nim-lang#19395) [backport] mangle names in nimbase.h fix comments Optimize lent in JS [backport:1.6] (nim-lang#19393) * Optimize lent in JS [backport:1.6] * addr on lent doesn't work anymore, don't use it * use unsafeAddr in test again for older versions update deprecated example (nim-lang#19415) `toNimIdent` proc is deprecated, so I replaced it with `ident` proc Improve Zshell completion (nim-lang#19354) fix stricteffects (nimsuggest/sexp) (nim-lang#19405) * fix stricteffects (nimsuggest/sexp) * Update tstrict_effects3.nim * Update tests/effects/tstrict_effects3.nim suppress deprecated warnings (nim-lang#19408) * suppress deprecated warnings once bump version to 1.7.3 enable deprecated messages * deprecate later add an example to setControlCHook (nim-lang#19416) * add an example to setControlCHook * [skip CI] format example for setControlCHook Co-authored-by: Nathan Blaxall <[email protected]> fix term rewriting with sideeffect (nim-lang#19410) * fix term rewriting with sideeffect fix nim-lang#6217 * add tests * Update tests/template/template_various.nim Resolve cross file resolution errors in atomics (nim-lang#19422) [backport:1.6] * Resolve call undeclared routine testAndSet * Fix undeclared field atomicType Fix nim-lang#11923 (nim-lang#19427) * Apply commit nim-lang@5da931f that was never merged (was part of a bigger PR). Should fix issue nim-lang#11932 * add a generic object for custom pragma os: faster getFileSize (nim-lang#19438) Use "stat" rather than "open", "seek", and "close" system calls. The Windows implementation remains the same. bugfix: varargs count as open arrays (nim-lang#19447) update outdated link (nim-lang#19465) Ref nim-lang#19463 Update jsfetch with latest API and fix missing bindings (nim-lang#19473) * Update with latest API and fix missing bindings remove deprecated `Body` remove implicit `cstring` convs add `Headers` to `FetchOptions` add `Request` init proc which takes `FetchOptions` * Update lib/std/jsfetch.nim Co-authored-by: Juan Carlos <[email protected]> * Update lib/std/jsfetch.nim Co-authored-by: Juan Carlos <[email protected]> * remove experimental flag Co-authored-by: Juan Carlos <[email protected]> No longer segfault when using a typeclass with a self referencing type (nim-lang#19467) Clonkk fix2 11923 (nim-lang#19451) * fix nnkBracketExpr not compiling for getImpl on customPragmaNode * fix test import * fix alias not working with hasCustomPragmas fix parseEnum cannot parse enum with const fields (nim-lang#19466) fix nim-lang#19463 Add compilers and hints to default nim.cfg (nim-lang#18424) don't use a temp for addr [backport: 1.6] (nim-lang#19503) * don't use a temp for addr fix nim-lang#19497 * Update compiler/ccgcalls.nim Co-authored-by: konsumlamm <[email protected]> * add a test Co-authored-by: konsumlamm <[email protected]> fixes nim-lang#19404 by protecting the memory we borrow from. this replaces crashes with minor memory leaks which seems to be acceptable. In the longer run we need a better VM that didn't grow hacks over a decade. (nim-lang#19515) Co-authored-by: flywind <[email protected]> Remove backslash in glob pattern (nim-lang#19524) use OrderedTable instead of OrderedTableRef for mimedb (nim-lang#19522) * use OrderedTable instead of OrderedTableRef for mimedb Signed-off-by: David Krause <[email protected]> * added changelog entry for mimedb change Signed-off-by: David Krause <[email protected]> Remove Deprecated oids.oidsToString (nim-lang#19519) * Remove deprecated oids.oidToString * Remove deprecated oids.oidToString Remove deprecated math.c_frexp (nim-lang#19518) * Remove Deprecated math proc * Remove Deprecated math proc * Remove Deprecated math proc [testcase] genSym fails to make unique identifier for ref object types (nim-lang#19506) close nim-lang#15118 Documentation: Fix word usage (nim-lang#19529) Update chcks.nim (nim-lang#19540) keep casing of noinit and noreturn pragmas consistently documented (nim-lang#19535) compile pragma: cache the result sooner (nim-lang#19554) extccomp.addExternalFileToCompile() relies on hashes to decide whether an external C file needs recompilation or not. Due to short-circuit evaluation of boolean expressions, the procedure that generates a corresponding hash file is not called the first time an external file is compiled, so an avoidable recompilation is triggered the next build. This patch fixes that by moving the proc call with a desired side effect from its boolean expression, so it's executed unconditionally.
Concerns these changes: nim-lang/Nim@727c637...340b5a1 Excluded changes are: nim-lang#18963 nim-lang#19003 nim-lang#19043 nim-lang#19055 nim-lang#19053 nim-lang#19064 nim-lang#18642 nim-lang#19062 nim-lang#19082 nim-lang#19090 nim-lang#19077 nim-lang#19021 nim-lang#19100 nim-lang#19102 nim-lang#19111 nim-lang#19115 nim-lang#19133 nim-lang#19142 nim-lang#19158 nim-lang#19129 nim-lang#19137 nim-lang#19168 nim-lang#19156 nim-lang#19147 nim-lang#19180 nim-lang#19183 nim-lang#19182 nim-lang#19187 nim-lang#19179 nim-lang#19209 nim-lang#19210 nim-lang#19207 nim-lang#19219 nim-lang#19195 nim-lang#19212 nim-lang#19134 nim-lang#19235 nim-lang#19252 nim-lang#19196 nim-lang#19295 nim-lang#19301 nim-lang#19181 nim-lang#17223 nim-lang#19370 nim-lang#19385 nim-lang#19307 nim-lang#19394 nim-lang#19399 nim-lang#19390 nim-lang#19407 nim-lang#19419 nim-lang#19421 nim-lang#19363 nim-lang#19406 nim-lang#19431 nim-lang#19455 nim-lang#19461 nim-lang@cb894c7 nim-lang#19462 nim-lang#19442 nim-lang#19437 nim-lang#19433 nim-lang#19512 nim-lang#19487 nim-lang#19543 Excluded changes include major changes which require more consideration and changes which don't apply to the current code anymore but could be worth porting over still. Excluded changes which only change the identifier casing in tests or only concern code removed in nimskull aren't listed. Begin commit listing: use two underscores for easy demangling [backport:1.6] (nim-lang#19028) Add Elbrus 2000 architecture (nim-lang#19024) * Add Elbrus 2000 architecture * Add e2k to niminst * Update compiler/installer.ini Co-authored-by: Andreas Rumpf <[email protected]> remove exception (nim-lang#18906) allow converting static vars to `openArray` (nim-lang#19035) When assigning constant output to a seq, and then passing that static seq to other functions that take `openArray`, the compiler may end up producing errors, as it does not know how to convert `static[seq[T]]` to `openArray[T]`. By ignoring the `static` wrapper on the type for the purpose of determining data memory location and length, this gets resolved cleanly. Unfortunately, it is relatively tricky to come up with a minimal example, as there are followup problems from the failing conversion, e.g., this may lead to `internal error: inconsistent environment type`, instead of the relevant `openArrayLoc` error message. use the correct header for TIOCGWINSZ on Solaris (nim-lang#19037) Minor update to terminal docs (nim-lang#19056) * Update terminal.nim - Added some extra docs to cursorUp/Down/Forward/Backward - I was able to use hideCursor and showCursor without adding stdout, removed the parameter - Added docs to terminalHeight()* and terminalWidth()* * Update lib/pure/terminal.nim Co-authored-by: konsumlamm <[email protected]> * Update lib/pure/terminal.nim Co-authored-by: konsumlamm <[email protected]> * Added back f: file to cursor movement * Removed unnecessary comments Co-authored-by: konsumlamm <[email protected]> fix a tiny formating issue in doc/destructors.rst (nim-lang#19058) fix a tiny code snippet formatting issue in `doc/constructors.rst`, again (nim-lang#19065) Fix nimIdentNormalize, fixes nim-lang#19067 (nim-lang#19068) * Make nimIdentNormalize return "" when passed ""; fixes nim-lang#19067 Fixes nim-lang#19067 * Add tests for nimIdentNormalize fix nim-lang#18971 (nim-lang#19070) [backport:1.6] since the example code return value from global variable, instead of first argument, the `n.len` is 1 which causes compiler crashes. fixes nim-lang#19000 (nim-lang#19032) * fixes nim-lang#19000 * progress fix nim-lang#18410 (Errors initializing an object of RootObj with the C++ backend) [backport] (nim-lang#18836) * fix nim-lang#18410 * one line comment * typo * typo * cover cpp update numbers of lifetime-tracking hooks in doc/destructors.rst (nim-lang#19088) bootstrapping Nim compiler with `cpp --gc:orc` (nim-lang#19087) libs/impore/re: Add note about the requirement of `matches` to be pre-allocated (nim-lang#19081) Add few runnableExamples for `findBounds` for clarity. Fixes nim-lang#18775 Add test for issue 15435 (nim-lang#19079) * Add test for issue 15435 Closes nim-lang#15435. * Specify bug # in comment Addresses nim-lang#19079 (comment) manual: Document the use of `static` as a proc call (nim-lang#19084) * manual: Document the use of `static` as a proc call Also adds tests. Fixes nim-lang#16987 . * Update doc/manual.rst Co-authored-by: konsumlamm <[email protected]> * Use the "bug #NNNN" comment syntax for consistency Ref: https://nim-lang.github.io/Nim/contributing.html#writing-tests-stdlib > Always refer to a GitHub issue using the following exact syntax: bug for tooling. * manual: Undocument usage of foo.static foo.static and foo.static() are not expected to work. Ref: https://github.com/nim-lang/Nim/pull/19084/files#r741203578 Co-authored-by: konsumlamm <[email protected]> manual: Document that comma propagates the default values of parameters (nim-lang#19080) * manual: Document that comma propagates the default values of parameters Fixes nim-lang#15949. * Use the "bug #NNNN" comment syntax for consistency Ref: https://nim-lang.github.io/Nim/contributing.html#writing-tests-stdlib > Always refer to a GitHub issue using the following exact syntax: bug for tooling. fixes nim-lang#19011 [backport:1.6] (nim-lang#19114) Add deprecation pragmas in lib/deprecated/pure (nim-lang#19113) Deprecate `std/sharedlist` and `std/sharedtables` (nim-lang#19112) fix nimindexterm in rst2tex/doc2tex [backport] (nim-lang#19106) * fix nimindexterm (rst2tex/doc2tex) [backport] * Add support for indexing in rst Call {.cursor.} a pragma. (nim-lang#19116) * Call {.cursor.} a pragma. Its hard to find .curser annotation while googling because all other things like it are called pragmas. See https://nim-lang.org/docs/manual.html#pragmas Also the . in front of the name makes it hard to find and search for. Can we just call it cursor pragma? * Small fix for comment. Remove tlsEmulation enabled from Windows + GCC config (nim-lang#19119) [backport:1.6] This flag has a very significant performance impact on programs compiled with --threads:on. It is also apparently not needed anymore for standard circumstances. Can we remove the config? See nim-lang#18146 (comment) for discussion and perf impact. [backport:1.6] Add security tip for setCookie (nim-lang#19117) * Add security tip for setCookie * Update lib/pure/cookies.nim Co-authored-by: Dominik Picheta <[email protected]> * Update lib/pure/cookies.nim Co-authored-by: konsumlamm <[email protected]> Co-authored-by: Andreas Rumpf <[email protected]> Co-authored-by: Dominik Picheta <[email protected]> Co-authored-by: konsumlamm <[email protected]> correct cookie docs (nim-lang#19122) refactoring: orc can use getThreadId() (nim-lang#19123) * refactoring: orc can use getThreadId() * progress fixed colorNames sorting mistake (nim-lang#19125) [backport] update manual (nim-lang#19130) [backport] Merge file size fields correctly on Windows (nim-lang#19141) * Merge file size fields correctly on Windows Merge file size fields correctly on Windows - Merge the two 32-bit file size fields from `BY_HANDLE_FILE_INFORMATION` correctly in `rawToFormalFileInfo`. - Fixes nim-lang#19135 * Update os.nim Fix punycode.decode function (nim-lang#19136) * Refactor: rename proc to func * Fix punycode.decode function This function could only properly decode punycodes containing a single encoded unicode character. As soon as there was more than one punycode character group to decode it produced invalid output - the number of characters was correct, but their position was not. * Update tpunycode.nim Co-authored-by: Clay Sweetser <[email protected]> Fix undeclared 'SYS_getrandom' on emscripten (nim-lang#19144) wrong spaces (3 => 2) (nim-lang#19145) `caseStmtMacros` no longer experimental, experimental manual refactor (nim-lang#19173) * `caseStmtMacros` no longer experimental, experimental manual refactor * Update doc/manual.rst * apply review suggestions * apply review Co-authored-by: Andreas Rumpf <[email protected]> fix inline syntax highlighting in system.nim (nim-lang#19184) swap port to correct port order (nim-lang#19177) Co-authored-by: Jaremy Creechley <[email protected]> feat: TLS-ALPN wrappers for OpenSSL (nim-lang#19202) Co-authored-by: Iced Quinn <[email protected]> misc bugfixes [backport:1.2] (nim-lang#19203) treat do with pragmas but no parens as proc (nim-lang#19191) fixes nim-lang#19188 [format minor] remove unnecessary spaces (nim-lang#19216) Making TCC work again on Windows --cpu:amd64 - fix nim-lang#16326 (nim-lang#19221) * fix nim-lang#16326 * removing comments fixes a converter handling regression that caused private converters to leak into client modules; fixes nim-lang#19213; [backport:1.6] (nim-lang#19229) Add support for LoongArch (nim-lang#19223) * Add support for LoongArch * Update compiler/installer.ini Co-authored-by: Andreas Rumpf <[email protected]> remove `std/sharedstrings` (nim-lang#19228) * remove std/sharedstrings it has been broken since 0.18.0 * rephrase the changelog entry add comments to spawn and pinnedSpawn (nim-lang#19230) `spawn` uses `nimSpawn3` internally and `pinnedSpawn` uses `nimSpawn4` internally. I comment it in order to help contributors get the gist of its functionality. fixes an old ARC bug: the produced copy/sink operations don't copy the hidden type field for objects with enabled inheritance; fixes nim-lang#19205 [backport:1.6] (nim-lang#19232) nimRawSetjmp: support Windows (nim-lang#19197) * nimRawSetjmp: support Windows Using `_setjmp()` directly is required to avoid some rare (but very annoying) exception-related stack corruption leading to segfaults on Windows, with Mingw-w64 and SEH. More details: status-im/nimbus-eth2#3121 Also add "nimBuiltinSetjmp" - mostly for benchmarking. * fix for Apple's Clang++ Revert "swap port to correct port order (nim-lang#19177)" (nim-lang#19234) This reverts commit 0d0c249. move toDeque to after addLast (nim-lang#19233) [backport:1.0] Changes the order of procs definitions in order to avoid calling an undefined proc. let Nim support Nimble 0.14 with lock-file support [backport:1.6] (nim-lang#19236) nimc.rst: fix table markup (nim-lang#19239) Various std net improvements (nim-lang#19132) * Variant of that works with raw IpAddresses. - Add doc tests for new net proc's. - Aadd recvFrom impl - Add recvFrom impl -- tweak handling data var - Update lib/pure/net.nim Co-authored-by: Dominik Picheta <[email protected]> - cleaning up sendTo args - remove extra connect test - cleaning up sendTo args - fix inet_ntop test - fix test failing - byte len * fix test failing - byte len * debugging odd windows build failure * debugging odd windows build failure * more experiments to figure out the windows failure * try manual assigment on InAddr Co-authored-by: Jaremy Creechley <[email protected]> fix bug nim-lang#14468 zero-width split (nim-lang#19248) basicopt.txt: Unify the format (nim-lang#19251) fix: fixes bug in CVerifyPeerUseEnvVars (nim-lang#19247) Previously CVerifyPeerUseEnvVars was not being passed into scanSslCertificates, which meant that we weren't scanning additional certificate locations given via the SSL_CERT_FILE and SSL_CERT_DIR environment variables suggestion to respect typedarray type (nim-lang#19257) * suggestion to respect typedarray * Update jssys.nim Co-authored-by: Sven Keller <[email protected]> fix nim-lang#19244 - solves the problem of the InAddr object constructor in Windows. (nim-lang#19259) * Update winlean.nim * Update tnet_ll.nim Fixed typo in manual.rst unsafeAssign->uncheckedAssign. Fixes part 1 of nim-lang#19266 (nim-lang#19267) use uppercase "type" for Proxy-Authorization header (nim-lang#19273) Some servers will reject authorization requests with a lowercase "basic" type. Changing to "Basic" seems to solve these issues. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Proxy-Authorization Update colors.nim (nim-lang#19274) * Update colors.nim Added `lightgray` alias to `lightgrey` and `...grey`aliases for the rest of the gray colors. Added color `rebeccapurple`. Fixed the incorrect values for the `PaleVioletRed` and `MediumPurple` colors. This module should now be matching the CSS colors. I used the seq[tuple] syntax for defining the names. * Document colors changes. Extract runnables that specify `doccmd` (nim-lang#19275) [backport:1.6] Fix build on FreeBSD/powerpc (nim-lang#19282) It's currently misdetected as powerpc64. Fix nim-lang#19107 (nim-lang#19286) [backport] fixes grammar typos [backport] (nim-lang#19289) fix 19292 (nim-lang#19293) Fix nim-lang#19297 - fixing broken list after adding empty list (nim-lang#19299) * Update lists.nim * Update tlists.nim * removed check `if b.tail != nil` The tail of the list being null it is still possible to retrieve its end by going through all nodes from the head. So checking for null from `b.tail` is unnecessary. However, setting `a.tail = b.tail` only if `a.head != nil`, so you don't break a good list with an already broken one. fixes nim-lang#16617 [backport] (nim-lang#19300) Update JS and nimscript import tests (nim-lang#19306) * add new modules, except experimental ones * remove deprecated modules mersenne and sharedlist * better describe why some modules fail and some modules don't add compile time option for POSIX sigwait on Illumos/Solaris (nim-lang#19296) * add compile time option for POSIX sigwait on Illumos/Solaris * fix link to documentation of `sigwait` on Illumos/Solaris [docs] clarify the raised exception (nim-lang#19308) * [docs] clarify the raised exception Lest developers wanna know what the exception is. * Apply suggestions from @konsumlamm Co-authored-by: konsumlamm <[email protected]> Co-authored-by: konsumlamm <[email protected]> docs: Fix typo in tut1.rst (nim-lang#19309) Fix nim-lang#19314 - fixing broken `DoublyLinkedList` after adding empty `DoublyLinkedList` (nim-lang#19315) [backport] * Update lists.nim * Update tlists.nim fixed typos (nim-lang#19316) devel: style fix (nim-lang#19318) this allows "--styleCheck:usages --styleCheck:error" docs: Fix typo in tut1.rst (nim-lang#19324) correct the comments (nim-lang#19322) --expandArc ``` var a b a = matrix(5, 5, 1.0) b = matrix(5, 5, 2.0) `=sink`(b, - let blitTmp = b wasMoved(b) blitTmp + a) `=destroy`(b) `=destroy`(a) ``` add std/private/win_getsysteminfo; refactor the usage of `GetSystemInfo` (nim-lang#19310) * add std/private/win_getsysteminfo * import at the top level * wrappers follow nep1 too * follow review comment Update net.nim (nim-lang#19327) [backport] Fix nim-lang#19038 - making the Nim compiler work again on Windows XP (nim-lang#19331) * Update osenv.nim * Update win_setenv.nim * Update lib/pure/includes/osenv.nim * Update lib/pure/includes/osenv.nim * fixing cstring Co-authored-by: Andreas Rumpf <[email protected]> fix nim-lang#19343 (nim-lang#19344) [backport] Ensure HttpClient onProgress is called once per second Ensure that reported speed is accurate stylecheck usages part two: stdlib cleanup (nim-lang#19338) * stylecheck usages part two: stdlib cleanup typeinfo.nim: importCompilerProc => importcompilerproc nre.nim: newLineFlags => newlineFlags system.nim: JSRoot => JsRoot ref nim-lang#19319 * prefer importCompilerProc added filemode docs (nim-lang#19346) Fix `remove` on last node of singly-linked list [backport:1.6] (nim-lang#19353) fix stylecheck error with asyncdispatch (nim-lang#19350) * stylecheck usages part two: stdlib cleanup typeinfo.nim: importCompilerProc => importcompilerproc nre.nim: newLineFlags => newlineFlags system.nim: JSRoot => JsRoot ref nim-lang#19319 * prefer importCompilerProc * fix stylecheck error with asyncdispatch it is a partial regression since nim-lang#12842 * add tests * don't use echo in tests remove spaces between an identifier and a star (nim-lang#19355) It makes search easier by searching `+`* instead of `+` which filter lots of unexported versions. Follow nim-lang#18681 bitsets.nim: cleanup (nim-lang#19361) make rst thread safe (nim-lang#19369) split for the convenience of review docs: Mention `import foo {.all.}` syntax (nim-lang#19377) Mention the `import foo {.all.}` syntax in the manual, with a caveat about private imports. Also link to the experimental importutils module. Co-authored-by: adigitoleo <[email protected]> update copyright year (nim-lang#19381) docs: Fix broken cross references to `rfind` in strutils (nim-lang#19382) [backport] Fixes three broken cross references to `rfind` in strutils. Breakage due to signature changes of the `rfind` methods. Co-authored-by: adigitoleo <[email protected]> move type operation section and remove deepcopy document (nim-lang#19389) ref nim-lang#19173; because deepcopy is not fit for ORC/ARC which was used for spawn and spawn will be removed from compiler deprecate unsafeAddr; extend addr (nim-lang#19373) * deprecate unsafeAddr; extend addr addr is now available for all addressable locations, unsafeAddr is deprecated and become an alias for addr * follow @Vindaar's advice * change the signature of addr * unsafeAddr => addr (stdlib) * Update changelog.md * unsafeAddr => addr (tests) * Revert "unsafeAddr => addr (stdlib)" This reverts commit ab83c99. * doc changes; thanks to @konsumlamm Co-authored-by: konsumlamm <[email protected]> Co-authored-by: konsumlamm <[email protected]> improve changelog a bit (nim-lang#19400) mangle names in nimbase.h using cppDefine (nim-lang#19395) [backport] mangle names in nimbase.h fix comments Optimize lent in JS [backport:1.6] (nim-lang#19393) * Optimize lent in JS [backport:1.6] * addr on lent doesn't work anymore, don't use it * use unsafeAddr in test again for older versions update deprecated example (nim-lang#19415) `toNimIdent` proc is deprecated, so I replaced it with `ident` proc Improve Zshell completion (nim-lang#19354) fix stricteffects (nimsuggest/sexp) (nim-lang#19405) * fix stricteffects (nimsuggest/sexp) * Update tstrict_effects3.nim * Update tests/effects/tstrict_effects3.nim suppress deprecated warnings (nim-lang#19408) * suppress deprecated warnings once bump version to 1.7.3 enable deprecated messages * deprecate later add an example to setControlCHook (nim-lang#19416) * add an example to setControlCHook * [skip CI] format example for setControlCHook Co-authored-by: Nathan Blaxall <[email protected]> fix term rewriting with sideeffect (nim-lang#19410) * fix term rewriting with sideeffect fix nim-lang#6217 * add tests * Update tests/template/template_various.nim Resolve cross file resolution errors in atomics (nim-lang#19422) [backport:1.6] * Resolve call undeclared routine testAndSet * Fix undeclared field atomicType Fix nim-lang#11923 (nim-lang#19427) * Apply commit nim-lang@5da931f that was never merged (was part of a bigger PR). Should fix issue nim-lang#11932 * add a generic object for custom pragma os: faster getFileSize (nim-lang#19438) Use "stat" rather than "open", "seek", and "close" system calls. The Windows implementation remains the same. bugfix: varargs count as open arrays (nim-lang#19447) update outdated link (nim-lang#19465) Ref nim-lang#19463 Update jsfetch with latest API and fix missing bindings (nim-lang#19473) * Update with latest API and fix missing bindings remove deprecated `Body` remove implicit `cstring` convs add `Headers` to `FetchOptions` add `Request` init proc which takes `FetchOptions` * Update lib/std/jsfetch.nim Co-authored-by: Juan Carlos <[email protected]> * Update lib/std/jsfetch.nim Co-authored-by: Juan Carlos <[email protected]> * remove experimental flag Co-authored-by: Juan Carlos <[email protected]> No longer segfault when using a typeclass with a self referencing type (nim-lang#19467) Clonkk fix2 11923 (nim-lang#19451) * fix nnkBracketExpr not compiling for getImpl on customPragmaNode * fix test import * fix alias not working with hasCustomPragmas fix parseEnum cannot parse enum with const fields (nim-lang#19466) fix nim-lang#19463 Add compilers and hints to default nim.cfg (nim-lang#18424) don't use a temp for addr [backport: 1.6] (nim-lang#19503) * don't use a temp for addr fix nim-lang#19497 * Update compiler/ccgcalls.nim Co-authored-by: konsumlamm <[email protected]> * add a test Co-authored-by: konsumlamm <[email protected]> fixes nim-lang#19404 by protecting the memory we borrow from. this replaces crashes with minor memory leaks which seems to be acceptable. In the longer run we need a better VM that didn't grow hacks over a decade. (nim-lang#19515) Co-authored-by: flywind <[email protected]> Remove backslash in glob pattern (nim-lang#19524) use OrderedTable instead of OrderedTableRef for mimedb (nim-lang#19522) * use OrderedTable instead of OrderedTableRef for mimedb Signed-off-by: David Krause <[email protected]> * added changelog entry for mimedb change Signed-off-by: David Krause <[email protected]> Remove Deprecated oids.oidsToString (nim-lang#19519) * Remove deprecated oids.oidToString * Remove deprecated oids.oidToString Remove deprecated math.c_frexp (nim-lang#19518) * Remove Deprecated math proc * Remove Deprecated math proc * Remove Deprecated math proc [testcase] genSym fails to make unique identifier for ref object types (nim-lang#19506) close nim-lang#15118 Documentation: Fix word usage (nim-lang#19529) Update chcks.nim (nim-lang#19540) keep casing of noinit and noreturn pragmas consistently documented (nim-lang#19535) compile pragma: cache the result sooner (nim-lang#19554) extccomp.addExternalFileToCompile() relies on hashes to decide whether an external C file needs recompilation or not. Due to short-circuit evaluation of boolean expressions, the procedure that generates a corresponding hash file is not called the first time an external file is compiled, so an avoidable recompilation is triggered the next build. This patch fixes that by moving the proc call with a desired side effect from its boolean expression, so it's executed unconditionally.
re.split delivers unexpected results when using zero-width characters. It seems to calculate the split as if the zero-width characters had a width.
This applies only to zero-width characters, zero-width lookaround constructs work as expected.
Example
Current Output
Expected Output
Possible Solution
The split code needs to be changed so that zero-width characters are not treated as having a width in their position calculation.
The text was updated successfully, but these errors were encountered: