| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
| |
While looking at the CI I noticed that there's a couple false positives
for `case` statements that cannot be checked for exhaustiveness since my
changes, this should resolve them.
---------
Co-authored-by: SirOlaf <>
|
|
|
|
|
| |
array field (#22999)
fixes #22926
|
|
|
| |
fixes #22996
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently running `nimsuggest`/`check` on this code causes the compiler
to raise an exception
```nim
type
Test = enum
A = 9.0
```
```
assertions.nim(34) raiseAssert
Error: unhandled exception: int128.nim(69, 11) `arg.sdata(3) == 0` out of range [AssertionDefect]
```
Issue was the compiler still trying to get the ordinal value even if it
wasn't an ordinal
|
|
|
|
|
|
|
| |
Currently when using `use` with nimsuggest on an enum field, it doesn't
return the definition of the field.
Breaks renaming in IDEs since it will replace all the usages, but not
the declaration
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#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>
|
|
|
|
|
|
|
|
|
|
| |
When it is specified, the nimsuggest instance monitors whether this
process is still alive. In case it's found to be dead, nimsuggest shuts
itself down. Currently only implemented on POSIX and Windows platforms.
The switch is silently ignored on other platforms. Note that the Nim
language server should still try to shut down its child nimsuggest
processes. This switch just adds extra protection against crashing Nim
language server and gets rid of the remaining nimsuggest processes,
which consume memory and system resources.
|
| |
|
|
|
| |
fixes #22971
|
|
|
|
|
|
|
|
|
| |
Currently the suggestions create a lot of noise when creating enum
fields. I don't see any way of a macro creating fields (when called
inside an enum) so it should be safe to not show suggestions
---------
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#22944)
…var/let symbols
fixes #22939
fixes #16890
Besides, it was applied to let/const/var with pragmas, now it is
universally applied.
```nim
{.push exportc.}
proc foo =
let bar = 12
echo bar
{.pop.}
```
For example, the `bar` variable will be affected by `exportc`.
|
|
|
|
|
|
|
|
|
|
|
| |
(#22941)
…tes invalid C identifiers
fixes #22913
fixes #12985 differently
`{.push.} now does not apply to generic instantiations`
|
|
|
| |
fixes #22947
|
|
|
|
|
|
|
|
|
| |
version 3 or later. (#22945)
Refactored the way nimsuggest checks for protocol version 3. Instead of
checking for version 3 exactly, it now checks for version 3 or later.
This way, once a version 4 is introduced, it will use version 3 as a
base line, and then extra changes to the protocol can be added on top.
No functional changes are introduced in this commit.
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes the assertion defect that happens when using `jsondoc --stdout`
(There is no outfile since its just stdout)
```
Error: unhandled exception: options.nim(732, 3) `not conf.outFile.isEmpty` [AssertionDefect]
```
Also makes the output easier to parse by ending each module output with
a new line.
|
| |
|
|
|
| |
This adds inlay hint support for the types of consts.
|
|
|
|
|
|
|
|
| |
(#22915)
…er base method returning a lent
fixes #22673
|
| |
|
| |
|
|
|
| |
without it, devels fails to build with `-d:useLinenoise`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds inlay hints support to nimsuggest. It adds a new command to
nimsuggest, called 'inlayHints'.
Currently, it provides type information to 'var' and 'let' variables. In
the future, inlay hints can also be added for 'const' and for function
parameters. The protocol also reserves space for a tooltip field, which
is not used, yet, but support for it can be added in the future, without
further changing the protocol.
The change includes refactoring to allow the 'inlayHints' command to
return a completely different structure, compared to the other
nimsuggest commands. This will allow other future commands to have
custom return types as well. All the previous commands return the same
structure as before, so perfect backwards compatibility is maintained.
To use this feature, an update to the nim language server, as well as
the VS code extension is needed.
Related PRs:
nimlangserver: https://github.com/nim-lang/langserver/pull/53
VS code extension: https://github.com/saem/vscode-nim/pull/134
---------
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
| |
fixes #22902
|
|
|
|
|
|
| |
custom destructors (#22901)
fixes #22866;
fixes #19998
|
| |
|
|
|
|
|
|
|
|
|
|
| |
ref
https://github.com/nim-lang/nightlies/actions/runs/6686795512/job/18166625042#logs
> /home/runner/work/nightlies/nightlies/nim/compiler/nir/nirvm.nim(163,
35) Error: type mismatch: got 'BiggestInt' for
'b.m.lit.numbers[litId(b.m.types.nodes[int(y)])]' but expected 'int'
Or unifies the type in one way or another
|
| |
|
|
|
| |
follow up https://github.com/nim-lang/Nim/pull/22851
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Close #22826
I am not sure why this code skips generic insts, so letting CI tell me.
Update: It has told me nothing. Maybe someone knows during review.
Issue itself seems to be that the generic instance is skipped thus it
ends up being just `float` which makes it use the wrong generic instance
of the proc because it matches the one in cache
---------
Co-authored-by: SirOlaf <>
|
| |
|
|
|
|
|
| |
(#22822)
…s of a patent-pending new VM
|
|
|
|
|
|
|
|
|
|
|
| |
containsManagedMemory(n.typ) (#22823)
fixes #19250
fixes #22259
The strings, seqs, refs types all have this flag, why should closures be
treated differently?
follow up https://github.com/nim-lang/Nim/pull/14336
|
|
|
|
|
|
| |
fixes #22354
It skips `nkHiddenAddr`. No need to hoist `var parameters` without side
effects. Besides, it saves lots of temporary variables in ORC.
|
|
|
|
|
|
| |
Done:
- [x] Implement conversions to openArray/varargs.
- [x] Implement index/range checking.
|
|
|
|
|
| |
Ref https://github.com/nim-lang/Nim/pull/22777#issuecomment-1758090410
Co-authored-by: SirOlaf <>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Theoretical Benefits / Plans:
- Typed assembler-like language.
- Allows for a CPS transformation.
- Can replace the existing C backend by a new C backend.
- Can replace the VM.
- Can do more effective "not nil" checking and static array bounds
checking.
- Can be used instead of the DFA.
- Easily translatable to LLVM.
- Reasonably easy to produce native code from.
- Tiny memory consumption. No pointers, no cry.
**In very early stages of development.**
Todo:
- [x] Map Nim types to IR types.
- [ ] Map Nim AST to IR instructions:
- [x] Map bitsets to bitops.
- [ ] Implement string cases.
- [ ] Implement range and index checks.
- [x] Implement `default(T)` builtin.
- [x] Implement multi string concat.
- [ ] Write some analysis passes.
- [ ] Write a backend.
- [x] Integrate into the compilation pipeline.
|
|
|
|
|
|
|
| |
(#22813)
…t holes
fixes #22790
|
|
|
|
|
|
|
|
|
|
|
|
| |
in `std/nre`
```nim
proc initRegex(pattern: string, flags: int, study = true): Regex =
new(result, destroyRegex)
```
gives incorrect warnings like
```
C:\Users\blue\Documents\Nim\lib\impure\nre.nim(252, 6) Error: A custom '=destroy' hook which takes a 'var T' parameter is deprecated; it should take a 'T' parameter [Deprecated
```
|
|
|
|
|
| |
Since they are integer types, by mean of allowing cast integer to enums
in VM, we can suppress some enum warnings in the stdlib in the unified
form, namely using a cast expression.
|
|
|
| |
Notice the test wouldnt link before
|
|
|
| |
fixes #8893
|
|
|
| |
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
|
|
| |
fixes #22794
Not sure if it's too much.
|
|
|
|
|
|
|
|
|
| |
(#22800)
fixes #22787
---------
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
|
|
|
|
|
| |
fixes #22753
## Future work
We should turn all the error nodes into nodes of a nkError kind, which
could be a industrious task. But perhaps we can add a special treatment
for error nodes to make the transition smooth.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The goal of this PR is to make `typeRel` accurate to it's definition for
generics:
```
# 3) When used with two type classes, it will check whether the types
# matching the first type class (aOrig) are a strict subset of the types matching
# the other (f). This allows us to compare the signatures of generic procs in
# order to give preferrence to the most specific one:
```
I don't want this PR to break any code, and I want to preserve all of
Nims current behaviors. I think that making this more accurate will help
serve as ground work for the future. It may not be possible to not break
anything but this is my attempt.
So that it is understood, this code was part of another PR (#22143) but
that problem statement only needed this change by extension. It's more
organized to split two problems into two PRs and this issue, being
non-breaking, should be a more immediate improvement.
---------
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|