| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
fixes #16376
The way the compiler handled generic proc instantiations in calls (like
`foo[int](...)`) up to this point was to instantiate `foo[int]`, create
a symbol for the instantiated proc (or a symchoice for multiple procs
excluding ones with mismatching generic param counts), then perform
overload resolution on this symbol/symchoice. The exception to this was
when the called symbol was already a symchoice node, in which case it
wasn't instantiated and overloading was called directly ([these
lines](https://github.com/nim-lang/Nim/blob/b7b1313d21deb687adab2b4a162e716ba561a26b/compiler/semexprs.nim#L3366-L3371)).
This has several problems:
* Templates and macros can't create instantiated symbols, so they
couldn't participate in overloaded explicit generic instantiations,
causing the issue #16376.
* Every single proc that can be instantiated with the given generic
params is fully instantiated including the body. #9997 is about this but
isn't fixed here since the instantiation isn't in a call.
The way overload resolution handles explicit instantiations by itself is
also buggy:
* It doesn't check constraints.
* It allows only partially providing the generic parameters, which makes
sense for implicit generics, but can cause ambiguity in overloading.
Here is how this PR deals with these problems:
* Overload resolution now always handles explicit generic instantiations
in calls, in `initCandidate`, as long as the symbol resolves to a
routine symbol.
* Overload resolution now checks the generic params for constraints and
correct parameter count (ignoring implicit params). If these don't
match, the entire overload is considered as not matching and not
instantiated.
* Special error messages are added for mismatching/missing/extra generic
params. This is almost all of the diff in `semcall`.
* Procs with matching generic parameters now instantiate only the type
of the signature in overload resolution, not the proc itself, which also
works for templates and macros.
Unfortunately we can't entirely remove instantiations because overload
resolution can't handle some cases with uninstantiated types even though
it's resolved in the binding (see the last 2 blocks in
`texplicitgenerics`). There are also some instantiation issues with
default params that #24005 didn't fix but I didn't want this to become
the 3rd huge generics PR in a row so I didn't dive too deep into trying
to fix them. There is still a minor instantiation fix in `semtypinst`
though for subscripts in calls.
Additional changes:
* Overloading of `[]` wasn't documented properly, it somewhat is now
because we need to mention the limitation that it can't be done for
generic procs/types.
* Tests can now enable the new type mismatch errors with just
`-d:testsConciseTypeMismatch` in the command.
Package PRs:
- using fork for now:
[combparser](https://github.com/PMunch/combparser/pull/7) (partial
generic instantiation)
- merged: [cligen](https://github.com/c-blake/cligen/pull/233) (partial
generic instantiation but non-overloaded + template)
- merged: [neo](https://github.com/andreaferretti/neo/pull/56) (trying
to instantiate template with no generic param)
|
|
|
|
|
|
|
|
|
|
| |
fixes #14522
fixes #22085
fixes #12700
fixes #23132
closes https://github.com/nim-lang/Nim/pull/22343 (succeeded by this PR)
completes https://github.com/nim-lang/RFCs/issues/175
follow up https://github.com/nim-lang/Nim/pull/12688
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
fixes #23813, partially reverts #23392
Before #23392, if a `gensym` symbol was defined before a proc with the
same name in a template even with an `inject` annotation, the proc would
be `gensym`. After #23392 the proc was instead changed to be `inject` as
long as no `gensym` annotation was given. Now, to keep compatibility
with the old behavior, the behavior is changed back to infer the proc as
`gensym` when no `inject` annotation is given, however an explicit
`inject` annotation will still inject the proc. This is also documented
in the manual as the old behavior was undocumented and the new behavior
is slightly different.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
fixes #4695
ref https://github.com/nim-lang/Nim/pull/15818
Since `nkState` is only for the main loop state labels and `nkGotoState`
is used only for dispatching the `:state` (since
https://github.com/nim-lang/Nim/pull/7770), it's feasible to rewrite the
loop body into a single case-based dispatcher, which enables support for
JS, VM backend. `nkState` Node is replaced by a label and Node pair and
`nkGotoState` is only used for intermediary processing. Backends only
need to implement `nkBreakState` and `closureIterSetupExc` to support
closure iterators.
pending https://github.com/nim-lang/Nim/pull/23484
<del> I also observed some performance boost for C backend in the
release mode (not in the danger mode though, I suppose the old
implementation is optimized into computed goto in the danger mode)
</del>
allPathsAsgnResult???
|
|
|
| |
adding link to generic == for tuples in Open and Closed symbols example
|
|
|
|
|
| |
https://nim-lang.github.io/Nim/testament.html#writing-unit-tests
https://nim-lang.github.io/Nim/testament.html#writing-unit-tests-output-message-variable-interpolation
|
|
|
| |
As requested. Let me know where adjustments are wanted.
|
|
|
|
|
| |
refs #23123
Not sure if detailed enough.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Nim manual says:
> When using the Cpp backend, params marked as byref will translate to
cpp references `&`
But how `byref` pragma translate to depends on whether it is used with
`importc` or `importcpp`.
When `byref` pragma used with `importc` types and compiled with the Cpp
backend, it is not traslated to cpp reference `&`.
---------
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is in reference to a [feature
request](https://github.com/nim-lang/Nim/issues/22142) that I posted.
I'm making this PR to demonstrate the suggested change and expect that
this should be scrutinized
---------
Co-authored-by: Bung <crc32@qq.com>
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
|
| |
follow up https://github.com/nim-lang/Nim/pull/22851
follow up https://github.com/nim-lang/Nim/pull/22873
|
|
|
| |
fixes #22867
|
|
|
|
|
|
|
|
| |
I came across this sentence in the Nim Manual and couldn't make sense of
it. I believe this is the correct fix for the sentence.
---------
Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
|
|
|
| |
ref https://github.com/nim-lang/Nim/commit/0d3bde95f578576d2e84d422d5694ee0e0055cbc#commitcomment-122093273
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* Adjustments
* Moving example
* typo
* adding code example back and fix terms
* Condensing
|
| |
|
|
|
|
|
| |
* Documented exception and defect hierarchy (#19086)
* Fixed style
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* isolation spec update; WIP
* wip
* docs update, WIP
* progress
* Update doc/manual.md
|
|
|
|
|
|
|
|
|
|
|
| |
* adds documentation for `=wasMoved` and `=dup` hooks and small fixes
* Update doc/destructors.md
* Update doc/destructors.md
---------
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
|
|
|
|
| |
* LineTooLong refactor to make it actually useful
* Improve error message
* changelog wording
* Fix typo
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Document about size pragma
* Fix typos
* Fix manual.md
* Update doc/manual.md
---------
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
|
|
| |
* Update the nim manual compile pragma with the second tuple form of
* Incorrectly put 'two' forms
|
|
|
|
|
|
|
|
|
| |
* documents #21628
* Update doc/manual.md
---------
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
| |
Document compiler path substitution (nim-lang#19928)
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
document typeclass AST (#21629)
* test fix #16546 #16548 + another issue
* please don't tell me other packages do this
* fix CI + test typeclass callconv pragma
* better logic in parser
* docs and changelog
|
|
|
| |
closes https://github.com/nim-lang/RFCs/issues/480
|
|
|
|
|
|
|
|
|
|
|
|
| |
* document general use of `_`, error message, fixes
fixes #20687, fixes #21435
Documentation and changelog updated to clarify new universal behavior
of `_`. Also new error message for attempting to use `_`, new tests,
and fixes with overloadable symbols and
implicit generics.
* add test for #21435
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tuple unpacking for vars as just sugar, allowing nesting
* set temp symbol AST
* hopeful fix some issues, add test for #19364
* always use temp for consts
* document, fix small issue
* fix manual indentation
* actually fix manual
* use helper proc
* don't resem temp tuple assignment
|
|
|
| |
fixes manual
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* fixes #19291; implements `wasMoved` hook
* basics
* checkpoint
* finish `wasMoved`
* add a test for #19291
* add documentation and changelog
* work `attachedWasMoved` with generics
* fixes optimizer
* register `=wasMoved`
* handle wasMoved magcis
* check another round
* some patches
* try `op == nil`
* nicer
* generate `wasMoved` before `destroy`
* try again
* fixes tests
* default wasMoved
* Update tests/destructor/tv2_cast.nim
* Update tests/destructor/tv2_cast.nim
* Update tests/arc/topt_refcursors.nim
|
|
|
| |
In this section of the manual, "if" should be enclosed in backticks and "elif" should be lower case.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
| |
* clean up the documentation of threads
* cleanup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* better procvar ambiguity errors, clean up after #20457
fixes #6359, fixes #13849
* only trigger on closedsymchoice again
* new approach
* add manual entry for ambiguous enums too
* add indent [skip ci]
* move to proc
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* enable stricteffects
* add gcsafe
* fix tests
* use func
* fixes pegs tests
* explicitly mark repr related procs with noSideEffect
* add nimLegacyEffects
* change URL
* fixes docopt
* add `raises: []` to repr
* fixes weave
* fixes nimyaml
* fixes glob
* fixes parsetoml
* Apply suggestions from code review
* Update testament/important_packages.nim
* add legacy:laxEffects
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Implement Markdown indented code blocks
Additional indentation of 4 spaces makes a block an "indented code block"
(monospaced text without syntax highlighting).
Also `::` RST syntax for code blocks is disabled.
So instead of
```rst
see::
Some code
```
the code block should be written as
```markdown
see:
Some code
```
* Migrate RST literal blocks :: to Markdown's ones
|
|
|
|
|
|
|
|
|
| |
* Unicode Operators are no longer experimental
* fixes tests
* Update doc/manual.md
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* system refactor, move out 600 lines
* compilation, slice, backwardsindex, misc_num moved out of system
* some procs/types moved into arithmetics, basic_types
* system no longer depends on syncio
* some procs moved around to fit with their surroundings
* make exceptions an import, old ops to misc_num
* move instantiationInfo back
* move back nim version, fix windows echo
* include compilation
* better docs for imported modules, fix unsigned ops
also remove ze, ze64, toU8, toU16, toU32 with nimPreviewSlimSystem
* fix terminal
* workaround IC test & weird csize bug, changelog
* move NimMajor etc back to compilation, rebase for CI
* try ic fix
* form single `indices`, slim out TaintedString, try fix IC
* fix CI, update changelog, addQuitProc
* fix CI
* try fix CI
* actually fix CI finally hopefully
* Update lib/system/compilation.nim
Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
* update kochdocs
* hopefully fix csize uses for slimsystem
* fix tquit
Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Update manual.md
update outdated information on `ObservableStores`.
* Update manual.md
add `base` pragma to fix the warning.
* Update doc/manual.md
accept.
Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
* Update manual.md
update example code.
* Update manual.md
1. more updates to help keeping readers on track.
1. fix typos.
Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
|