| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
files (#24190)
fixes #24174
|
|
|
| |
Co-authored-by: metagn <metagngn@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#24111)
alternative to #24101
#23892 changed the opensym experimental switch so that it has to be
enabled in the context of the generic/template declarations capturing
the symbols, not the context of the instantiation of the
generics/templates. This was to be in line with where the compiler gives
the warnings and changes behavior in a potentially breaking way.
However `results` [depends on the old
behavior](https://github.com/arnetheduck/nim-results/blob/71d404b314479a6205bfd050f4fe5fe49cdafc69/results.nim#L1428),
so that the callers of the macros provided by results always take
advantage of the opensym behavior. To accomodate this, we change the
behavior of the old experimental option that `results` uses,
`genericsOpenSym`, so that ignores the information of whether or not
symbols are intentionally opened and always gives the opensym behavior
as long as it's enabled at instantiation time. This should keep
`results` working as is. However this differs from the normal opensym
switch in that it doesn't generate `nnkOpenSym`.
Before it was just a generics-only version of `openSym` along with
`templateOpenSym` which was only for templates. So `templateOpenSym` is
removed along with this change, but no one appears to have used it.
|
|
|
|
|
|
|
| |
refs #24078, refs #24076
Since these changes are potentially breaking, add them to changelog,
also add Nlink as mentioned in
https://github.com/nim-lang/Nim/issues/24076#issuecomment-2337666555.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
fixes #5395
Previously values of `const` statements used the same scope as the
`const` statement itself, meaning variables could be declared inside
them and referred to in other statements in the same block. Now each
`const` value opens its own scope, so any variable declared in the value
of a constant can only be accessed for that constant.
We could change this to open a new scope for the `const` *section*
rather than each constant, so the variables can be used in other
constants, but I'm not sure if this is sound.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
refs #21682, refs #24038
The `rangeBase` typetrait added in #21682 which gives the base type of a
range type is now added publicly to `typetraits`. Previously it was only
privately used in `repr_v2` and in `enumutils` since #24052
(coincidentally I didn't see this until now). This is part of an effort
to make range types easier to work with in generics, as mentioned in
#24038. Its use combined with #24037 is also tested.
The condition for the "enum to enum conversion" warning is now also
restricted to conversions between different enum base types, i.e.
conversion between an enum type and a range type of itself doesn't give
a warning. I put this in this PR since the test gave the warning and so
works as a regression test.
|
|
|
| |
refs #24010, split from #24051
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
fixes #15314, fixes #24002
The OpenSym behavior first added to generics in #23091 now also applies
to templates, since templates can also capture symbols that are meant to
be replaced by local symbols if the context imports symbols with the
same name, as in the issue #24002. The experimental switch
`templateOpenSym` is added to enable this behavior for templates only,
and the experimental switch `openSym` is added to enable it for both
templates and generics, and the documentation now mainly mentions this
switch.
Additionally the logic for `nkOpenSymChoice` nodes that were previously
wrapped in `nkOpenSym` now apply to all `nkOpenSymChoice` nodes, and so
these nodes aren't wrapped in `nkOpenSym` anymore. This means
`nkOpenSym` can only have children of kind `nkSym` again, so it is more
in line with the structure of symchoice nodes. As for why they aren't
merged with `nkOpenSymChoice` nodes yet, we need some way to signal that
the node shouldn't become ambiguous if other options exist at
instantiation time, we already captured a symbol at the beginning and
another symbol can only replace it if it's closer in scope and
unambiguous.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
types in symchoices (#23997)
fixes #23898, supersedes #23966 and #23990
Since #20631 ambiguous type symbols in templates are rejected outright,
now we generate a symchoice for type nodes if they're ambiguous, a
generalization of what was done in #22375. This is done for generics as
well. Symchoices also handle type symbols better now, ensuring their
type is a `typedesc` type; this probably isn't necessary for everything
to work but it makes the logic more robust.
Similar to #23989, we have to prepare for the fact that ambiguous type
symbols behave differently than normal type symbols and either error
normally or relegate to other routine symbols if the symbol is being
called. Generating a symchoice emulates this behavior, `semExpr` will
find the type symbol first, but since the symchoice has other symbols,
it will count as an ambiguous type symbol.
I know it seems spammy to carry around an ambiguity flag everywhere, but
in the future when we have something like #23104 we could just always
generate a symchoice, and the symchoice itself would carry the info of
whether the first symbol was ambiguous. But this could harm compiler
performance/memory use, it might be better to generate it only when we
have to, which in the case of type symbols is only when they're
ambiguous.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
refs https://github.com/nim-lang/Nim/pull/23873#discussion_r1687995060,
fixes #23386, fixes #23385, supersedes #23572
Turns the `nfOpenSym` node flag implemented in #23091 and extended in
#23102 and #23873, into a node kind `nkOpenSym` that forms a unary node
containing either `nkSym` or `nkOpenSymChoice`. Since this affects
macros working on generic proc AST, the node kind is now only generated
when the experimental switch `genericsOpenSym` is enabled, and a new
node flag `nfDisabledOpenSym` is set to the `nkSym` or `nkOpenSymChoice`
when the switch is not enabled so that we can give a warning.
Now that the experimental switch has more reasonable semantics, we
define `nimHasGenericsOpenSym2`.
|
| |
|
|
|
|
|
|
|
| |
makes new hash the default, with an opt-out (& js-no-big-int) define.
Also update changelog (& fix one typo).
Only really expect the chronos hash-order sensitive test to fail until
they merge that PR and tag a new release.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Unlike present Nim this actually fills `Hash` for `string` & related.
For the curious, note that `hashData` remains the aboriginal Nim string
hasher & `import hashes {.all.}` allows simultaneous test/time of {orig,
murmur, farm} on your favorite CPU & back end compiler.
Update tests also conditioned upon `nimPreviewHashFarm` so they should
pass either with or without that `define` on.
In `--jsbigint=on` mode, only the lower 32-bits of `Hash` match nimvm &
run-time values because `type Hash = int` and on JS int=int32, not int64
as for 64-bit Nim platforms. Due to the matching, `const` Table should
match run-time `Table` on all platforms.
To operate in `--jsbigint=off` mode is feasible but needs much "double
precision mul/xor/ror/shr-arithmetic"-style work. That is distracting &
also of questionable value since JS added BigInt in 2018, ringabout
added Nim support for it in 2021 & `nimPreviewHashFarm` is unlikely to
swap from an opt-in to an opt-out default before 2025..2026 which will
have given a backward looking time window of 7..8 years for deployment
platforms - reasonably generous.
Add a changelog entry for 2.2.
|
| |
|
|
|
| |
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
|
|
|
|
|
| |
fixes #4299
fixes #12492
fixes #10849
It binds `function` with `env`: `function.bind(:env)` to ease codegen
for now
|
| |
|
| |
|
|
|
|
| |
Allow for conversion from `openArray`s, similar to `toSinglyLinkedList`
and `toDoublyLinkedList`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#23102)
refs #23091, especially post merge comments
Unsure if `experimental` and `bind` are the perfect constructs to use
but they seem to get the job done here. Symbol nodes do not get marked
`nfOpenSym` if the `bind` statement is used for their symbol, and
`nfOpenSym` nodes do not get replaced by new local symbols if the
experimental switch is not enabled in the local context (meaning it also
works with `push experimental`). However this incurs a warning as the
fact that the node is marked `nfOpenSym` means we did not `bind` it, so
we might want to do that or turn on the experimental switch if we didn't
intend to bind it.
The experimental switch name is arbitrary and could be changed.
---------
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
|
|
|
| |
closes #23042
Adds changes from #22537 and #22611 to changelog (I believe both are set
for 2.2).
|
|
|
|
|
|
|
|
|
|
|
| |
(#23004)
follow up https://github.com/nim-lang/Nim/pull/22991
- [x] turning it into an experimental feature
---------
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
new strictions on methods (#22991)
**TODO**
- [x] fixes changelog
With the new option `nimPreviewVtables`, `methods` are confined in the
same module where the type of the first parameter is defined
- [x] make it opt in after CI checks its feasibility
## In the following-up PRs
- [ ] in the following PRs, refactor code into a more efficient one
- [ ] cpp needs special treatments since it cannot embed array in light
of the preceding limits: ref
https://github.com/nim-lang/Nim/pull/20977#discussion_r1035528927; we
can support cpp backends with vtable implementations later on the
comprise that uses indirect vtable access
---------
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#22975)
fixes #22286
ref https://forum.nim-lang.org/t/10642
For backwards compatibilities, we might need to keep the changes under a
preview compiler flag. Let's see how many packags it break.
**TODO** in the following PRs
- [ ] Turn the `var T` destructors warning into an error with
`nimPreviewNonVarDestructor`
---------
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
|
| |
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Co-authored-by: Juan Carlos <juancarlospaco@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Per https://datatracker.ietf.org/doc/html/rfc9110#name-user-agent a
User-Agent is defined as follows:
```
User-Agent = product *( RWS ( product / comment ) )
```
Where
```
product = token ["/" product-version]
product-version = token
```
In this case, `token` is defined in RFC 7230 -
https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.6:
```
token = 1*tchar
tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
/ "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
/ DIGIT / ALPHA
; any VCHAR, except delimiters
```
or, in the original RFC 2616 -
https://datatracker.ietf.org/doc/html/rfc2616#section-2.2 (next page):
```
token = 1*<any CHAR except CTLs or separators>
separators = "(" | ")" | "<" | ">" | "@"
| "," | ";" | ":" | "\" | <">
| "/" | "[" | "]" | "?" | "="
| "{" | "}" | SP | HT
```
which means that a `token` cannot have whitespace. Not sure if this
should be in the breaking changelog section - theoretically, some
clients might've relied on the old Nim user-agent?
For some extra info, some other languages seem to have adopted the same
hyphen user agent to specify the language + module, e.g.:
-
https://github.com/python/cpython/blob/main/Lib/urllib/request.py#L1679
(`Python-urllib/<version>`)
Fixes #22862.
|
|
|
|
|
|
|
|
|
| |
ref https://github.com/nim-lang/Nim/pull/22848
see also https://github.com/nim-lang/htmlparser
will build the documentation later when everything else is settled
---------
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
|
|
|
|
|
| |
fixes #22856
`-d:nimStrictDelete` is introduced in 1.6.0, which promised to be
enabled in the coming versions. To keep backwards incompatibilities, it
also extends the feature of `-d:nimAuditDelete`, which now mimics the
old behaviors.
|
|
|
| |
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
|
|
|
|
|
|
|
|
| |
- Continuation of https://github.com/nim-lang/Nim/pull/22769
- See
https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_fadvise.html
- The code was already there in `std/posix` since years ago. 3 line
diff.
---------
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- `copyFile` allows to specify `bufferSize` instead of hardcoded wrong
value. Tiny diff.
# Performance
- 1200% Performance improvement.
# Check it yourself
Execute:
```bash
for i in $(seq 0 10); do
bs=$((1024*2**$i))
printf "%7s Kb\t" $bs
timeout --foreground -sINT 2 dd bs=$bs if=/dev/zero of=/dev/null 2>&1 | sed -n 's/.* \([0-9.,]* [GM]B\/s\)/\1/p'
done
```
(This script can be ported to PowerShell for Windows I guess, it works
in Windows MinGW Bash anyways).
# Stats
- Hardcoded `8192` or `8000` Kb bufferSize gives `5` GB/s.
- Setting `262144` Kb bufferSize gives `65` GB/s (script suggestion).
---------
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
|
|
|
|
| |
ref #19727
closes #22586
https://github.com/nim-lang/Nim/issues/22554 needs it to move on.
`newSeqUnsafe` can be introduced later.
|
|
|
|
|
| |
(#22764)
fixes #22763
|
|
|
| |
ref #19727
|
|
|
|
|
|
|
| |
- Fix #21407
---------
Co-authored-by: Amjad Ben Hedhili <amjadhedhili@outlook.com>
|
|
|
| |
Needed for #21842.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* fixes newStringUninitialized; implement `newStringUninitialized`
* add a simple test case
* adds a changelog
* Update lib/system.nim
* Apply suggestions from code review
rename to newStringUninit
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* This adds `parseutils.parseSize`, an inverse to `strutils.formatSize`
which has existed since 2017.
It is useful for parsing the compiler's own output logs (like SuccessX)
or many other scenarios where "human readable" units have been chosen.
The doc comment and tests explain accepted syntax in detail.
Big units lead to small numbers, often with a fractional part, but we
parse into an `int64` since that is what `formatSize` stringifies and
this is an inverse over partial function slots. Although metric
prefixes z & y for zettabyte & yottabyte are accepted, these will
saturate the result at `int64.high` unless the qualified number is a
small fraction. This should not be much of a problem until such sizes
are common (at which point another overload with the parse result
either `float64` or `int128` could be added).
Tests avoids `test()` because of a weakly related static: test() failure
as mentioned in https://github.com/nim-lang/Nim/pull/21325. This is a
more elemental VM failure. As such, it needs its own failure exhibition
issue that is a smaller test case. (I am working on that, but unless
there is a burning need to `parseSize` at compile-time before run-time
it need not hold up this PR.)
* This worked with `int` but fails with `int64`. Try for green tests.
* Lift 2-result matching into a `checkParseSize` template and format as a
table of input & 2 expected outputs which seems nicer and to address
https://github.com/nim-lang/Nim/pull/21349#pullrequestreview-1294407679
* Fix (probably) the i386 trouble by using `int64` consistently.
* Improve documentation by mentioning saturation.
* Improve documentation with `runnableExamples` and a little more detail in
the main doc comment based on excellent code review by @juancarlospaco:
https://github.com/nim-lang/Nim/pull/21349#pullrequestreview-1294564155
* Address some more @juancarlospaco code review concerns.
* Remove a stray space.
* Mention milli-bytes in docs to maybe help clarify why wild conventions
are so prone to going case-insensitive-metric.
* Add some parens.
|
|
|
| |
[backport: 2.0] add v2.0 changelog
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* fix #19580; add warning for bare except: clause
* fixes some easy ones
* Update doc/manual.md
* fixes docs
* Update changelog.md
* addition
* Apply suggestions from code review
Co-authored-by: Jacek Sieka <arnetheduck@gmail.com>
* Update doc/tut2.md
Co-authored-by: Jacek Sieka <arnetheduck@gmail.com>
|
|
|
|
|
|
|
|
|
| |
* generic `define` pragma + string alias
* clean
* add tests and document
* remove char/float, minimize changelog
|
| |
|
|
|
|
|
| |
* Remove deprecated rightSize nop
* Remove deprecated rightSize nop
|
|
|
| |
for a changelog for `std/cmdline`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* remove db stuffs
* remove punycode
* remove
* fixes script
* add cloner
* patches
* disable
* patch
* fixes external packages
* disable two packages
* preview documentation build
* try again
* fixes URL
* fixes a bug
* simplify
* fixes documentaion
* fixes
* Apply suggestions from code review
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Breaking parser changes, implement https://github.com/nim-lang/RFCs/issues/442
Types are separated from expressions and better reflected in the grammar.
* add test
* more accurate grammar
* fix keyword typedescs
* accept expressions in proc argument lists
* CI "fixes"
* fixes
* allow full ref expressions again, adapt old tests
* cleanup, fix some tests
* improve grammar, try and revert semtypes change
* restrict sigil binding to identOrLiteral
* fix, should have caught this immediately
* add changelog entry, fix double not nil bug
* correct grammar
* change section
* fix
* real fix hopefully
* fix test
* support LL(1) for tuples
* make grammar.txt too
|