| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
| |
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
| |
|
|
|
|
| |
proc return it (#22684)
|
|
|
|
|
|
|
| |
fixes #22669 constructor pragma doesnt init Nim default fields
---------
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
|
| |
proc return it (#22681)
|
|
|
|
|
|
|
|
|
|
| |
Attempts to move the generic instantiation to the module that uses it.
This should decrease re-compilation times as the source module where the
generic lives doesnt need to be recompiled
---------
Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
| |
fixes #22664
|
|
|
|
|
|
|
|
|
|
| |
fields (#22665)
fixes #22662 Procs with constructor pragma doesn't initialize object's
fields
---------
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Close #21742
Checking if there's any side-effects and if just changing typeRel is
adequate for this issue before trying to look into related ones.
`skipBoth` is also not that great, it can lead to code that works
sometimes but fails when the proc is instantiated with branching
aliases. This is mostly an issue with error clarity though.
---------
Co-authored-by: SirOlaf <unknown>
Co-authored-by: SirOlaf <>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Close #17509
Current knowledge:
- delaying cache fixes the issue
- changing return of `if inst.len < key.len:` in `searchInstTypes` to
`continue` fixes the issue. With return the broken types are also cached
over and over
Related issues are completely unaffected as of now, so there must be
something deeper.
I am also still trying to find the true cause, so feel free to ignore
for now
---------
Co-authored-by: SirOlaf <>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
fixes #22639 for the third time
Nodes generated by `getType` for `tyGenericInst` types, instead of
having the original `tyGenericInst` type, will have the type of the last
child (due to the `mapTypeToAst` calls which set the type to the given
argument). This will cause subsequent `getType` calls to lose
information and think it's OK to use the sym of the instantiated type
rather than fully expand the generic instantiation.
To prevent this, update the type of the node from the `mapTypeToAst`
calls to the full generic instantiation type.
|
|
|
|
|
|
|
| |
reverts #22642, reopens #22639, closes #22646, refs #22650, refs
https://github.com/alaviss/union/issues/51, refs #22652
The fallout is too much from #22642, we can come back to it if we can
account for all the affected code.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
fixes https://github.com/nim-lang/Nim/issues/22619
It causes double free for closure iterators because cursor fields are
destroyed in the lifted destructors of `Env`.
Besides, according to the Nim manual
> In fact, cursor more generally prevents object
construction/destruction pairs and so can also be useful in other
contexts.
At least, destruction of cursor fields might cause troubles.
todo
- [x] tests
- [x] revert a certain old PR
---------
Co-authored-by: zerbina <100542850+zerbina@users.noreply.github.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
fixes #22639
A `tyGenericInst` has its last son as the instantiated body of the
original generic type. However this type keeps its original `sym` field
from the original generic types, which means the sym's type is
uninstantiated. This causes problems in the implementation of `getType`,
where it uses the `sym` fields of types to represent them in AST, the
relevant example for the issue being
[here](https://github.com/nim-lang/Nim/blob/d13aab50cf465a7f2edf9c37a4fa30e128892e72/compiler/vmdeps.nim#L191)
called from
[here](https://github.com/nim-lang/Nim/blob/d13aab50cf465a7f2edf9c37a4fa30e128892e72/compiler/vmdeps.nim#L143).
To fix this, create a new symbol from the original symbol for the
instantiated body during the creation of `tyGenericInst`s with the
appropriate type. Normally `replaceTypeVarsS` would be used for this,
but here it seems to cause some recursion issue (immediately gives an
error like "cannot instantiate HSlice[T, U]"), so we directly set the
symbol's type to the instantiated type.
Avoiding recursion means we also cannot use `replaceTypeVarsN` for the
symbol AST, and the symbol not having any AST crashes the implementation
of `getType` again
[here](https://github.com/nim-lang/Nim/blob/d13aab50cf465a7f2edf9c37a4fa30e128892e72/compiler/vmdeps.nim#L167),
so the symbol AST is set to the original generic type AST for now which
is what it was before anyway.
Not sure about this because not sure why the recursion issue is
happening, putting it at the end of the proc doesn't help either. Also
not sure if the `cl.owner != nil and s.owner != cl.owner` condition from
`replaceTypeVarsS` is relevant here. This might also break some code if
it depended on the original generic type symbol being given.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
```nim
{.experimental: "strictdefs".}
type Test = object
id: int
proc test(): Test =
if true:
return Test()
else:
return
echo test()
```
I will tackle https://github.com/nim-lang/Nim/issues/16735 and #21615 in
the following PR.
The old code just premises that in branches ended with returns, raise
statements etc. , all variables including the result variable are
initialized for that branch. It's true for noreturn statements. But it
is false for the result variable in a branch tailing with a return
statement, in which the result variable is not initialized. The solution
is not perfect for usages below branch statements with the result
variable uninitialized, but it should suffice for now, which gives a
proper warning.
It also fixes
```nim
{.experimental: "strictdefs".}
type Test = object
id: int
proc foo {.noreturn.} = discard
proc test9(x: bool): Test =
if x:
foo()
else:
foo()
```
which gives a warning, but shouldn't
|
|
|
|
|
|
|
|
|
|
| |
This implements Pandoc Markdown-style footnotes,
that are compatible with Pandoc referencing syntax:
Ref. [^ftn].
[^ftn]: Block.
See https://pandoc.org/MANUAL.html#footnotes for more examples.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
fixes #22598, properly fixes #21887 and fixes test case issue number
When an enum field sym choice has to choose a type, check if its name is
ambiguous in the local scope, then check if the first symbol found in
the local scope is the first symbol in the sym choice. If so, choose
that symbol. Otherwise, give an ambiguous identifier error.
The dependence on the local scope implies this will always give
ambiguity errors for unpicked enum symchoices from generics and
templates and macros from other scopes. We can change `not
isAmbiguous(...) and foundSym == first` to `not (isAmbiguous(...) and
foundSym == first)` to make it so they never give ambiguity errors, and
always pick the first symbol in the symchoice. I can do this if this is
preferred, but no code from CI seems affected.
|
|
|
| |
Co-authored-by: SirOlaf <>
|
|
|
| |
fixes #20543
|
|
|
| |
fixes #22216
|
|
|
| |
fixes #9040
|
|
|
|
|
|
|
|
|
|
|
| |
* fixes internal error: no generic body fixes #1500
* adds guard
* adds guard
* removes unnecessary test
* refactor: extracts containsGenericInvocationWithForward
|
|
|
|
|
| |
resolve local symbols in generic type call
fixes #14509
|
|
|
| |
fixes #19849
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* fixes #22613; Default value does not work with object's discriminator
fixes #22613
* merge branches
* add a test case
* fixes status
* remove outdated comments
* move collectBranchFields into the global scope
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Rewrite endsInNoReturn
* Handle `try` stmt again and add tests
* Fix unreachable code warning
* Remove unreachable code in semexprs again
* Check `it.len` before skip
* Move import of assertions
---------
Co-authored-by: SirOlaf <>
|
|
|
|
|
|
|
|
|
| |
* type annotations for variable tuple unpacking, better error messages
closes #17989, closes https://github.com/nim-lang/RFCs/issues/339
* update grammar
* fix test
|
|
|
| |
closes #22600
|
| |
|
|
|
|
|
|
|
|
|
| |
* handle typedesc params in VM
fixes #15760
* add test
* fix getType(typedesc) test
|
|
|
| |
refs #16547
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* fixes newStringUninitialized; implement `newStringUninitialized`
* add a simple test case
* adds a changelog
* Update lib/system.nim
* Apply suggestions from code review
rename to newStringUninit
|
|
|
|
|
|
|
| |
* correct logic for qualified symbol in templates
fixes #19865
* add test
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#22559)
* fix #22548;environment misses for type reference in iterator access nested in closure
* fix #21737
* Update lambdalifting.nim
* remove containsCallKinds
* simplify
|
|
|
|
|
|
|
|
|
|
|
|
| |
* test case haul for old generic/template/macro issues
closes #12582, closes #19552, closes #2465, closes #4596, closes #15246,
closes #12683, closes #7889, closes #4547, closes #12415, closes #2002,
closes #1771, closes #5121
The test for #5648 is also moved into its own test
from `types/tissues_types` due to not being joinable.
* fix template gensym test
|
|
|
|
|
|
|
| |
* fix generic param substitution in templates
fixes #13527, fixes #17240, fixes #6340, fixes #20033, fixes #19576, fixes #19076
* fix bare except in test, test updated packages in CI
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* round out tuple unpacking assignment, support underscores
fixes #18710
* fix test messages
* use discard instead of continue
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
---------
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
| |
fixes #21208
|
|
|
|
|
|
|
|
|
| |
* Don't ignore return in semTemplateDef
* Add test
---------
Co-authored-by: SirOlaf <>
|
|
|
|
|
| |
allow non-pragma special words as macro pragmas
fixes #22525
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#22527)
* fix getNullValue for cstring in VM
fixes #22524
* very ugly fixes, but fix #15730
* nil cstring len works, more test lines
* fix high
|
|
|
|
|
| |
* use old typeinfo generation for hot code reloading
* at least test hello world compilation on orc
|
| |
|
| |
|
| |
|
|
|
| |
fixes #22490, fixes #22491, adapts #22029 to type conversions
|
|
|
| |
closed #22748; cursorinference + -d:nimNoLentIterators results in erroneous recursion
|
|
|
| |
Ping @narimiran please backport to the 2.0 line.
|