| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
|
|
| |
closes #23107
Could also change to `macos-latest` but nothing else in CI uses `latest`
OS versions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This code will crash `check`/`nimsuggest` since the `ra` register is
uninitialised
```nim
import macros
static:
discard parseExpr("'")
```
Now it assigns an empty node so that it has something
Testament changes were so I could properly write a test. It would pass
even with a segfault since it could find the error
|
| |
|
|
|
|
|
|
|
|
| |
(#23084)
…symbols
fixes #18073
fixes #14730
|
|
|
| |
alternative to https://github.com/nim-lang/Nim/pull/23092
|
|
|
| |
Reverts nim-lang/Nim#23096
|
|
|
| |
fixes #22933
|
|
|
|
|
|
| |
closes #23042
Adds changes from #22537 and #22611 to changelog (I believe both are set
for 2.2).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
fixes #22605, separated from #22744
This marks symbol captures in macro calls in generic contexts as
`nfOpenSym`, which means if there is a new symbol in the local
instantiatied body during instantiation time, this symbol replaces the
captured symbol. We have to be careful not to consider symbols outside
of the instantiation body during instantiation, because this will leak
symbols from the instantiation context scope rather than the original
declaration scope. This is done by checking if the local context owner
(maybe should be the symbol of the proc currently getting instantiated
instead? not sure how to get this) is the same as or a parent owner of
the owner of the replacement candidate symbol.
This solution is distinct from the symchoice mechanisms which we
originally assumed had to be related, if this assumption was wrong it
would explain why this solution took so long to arrive at.
|
| |
|
| |
|
|
|
|
|
| |
(#23087)
Show name of error that wasn't expected in an `expect` block
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Closes #14329
Marks `macros.error` as `.noreturn` so that it can be used in
expressions. This also fixes the issue that occurred in #19659 where a
stmt that could be an expression (Due to having `discardable` procs at
the end of other branches) would believe a `noreturn` proc is returning
the same type e.g.
```nim
proc bar(): int {.discardable.} = discard
if true: bar()
else: quit(0) # Says that quit is of type `int` and needs to be used/discarded except it actually has no return type
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes the second issue listed in #9918.
Fixed by replacing the logic used in `parseAll` with just a continious
loop to `complexOrSimpleStmt` like what the [normal parser
does](https://github.com/nim-lang/Nim/blob/devel/compiler/passes.nim#L143-L146).
`complexOrSimpleStmt` [guarantees
progress](https://github.com/nim-lang/Nim/blob/devel/compiler/parser.nim#L2541)
so we don't need to check progress ourselves.
Also allows `nimpretty` to parse more valid Nim code such as
```nim
proc foo(); # Would complain about indention here
# ...
proc foo() =
# ...
```
|
|
|
| |
fixes #22637
|
| |
|
|
|
| |
less verbose - used in nph
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
fixes #22227
rationale:
- `3u - 4u` is supported why not`3u.toRational - 4u.toRational`
- all of rationals' api is on SomeInteger, looks like unsigned is
declared as supported
- math on unsigned rationals is meaningful and useful.
|
|
|
|
|
|
|
|
|
|
|
| |
#23032
---------
Co-authored-by: Nikolay Nikolov <nickysn@gmail.com>
Co-authored-by: Pylgos <43234674+Pylgos@users.noreply.github.com>
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
Co-authored-by: Jason Beetham <beefers331@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
fixes #23051
Before

After

|
|
|
|
|
| |
(#23063)
… type mirroring proc params
|
|
|
| |
fixes #23065
|
| |
|
|
|
| |
fixes https://github.com/nim-lang/Nim/issues/9381
|
| |
|
| |
|
|
|
| |
fixes #23060
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Just makes the case statements easier to look at when folded
```nim
case foo
of a:
of b:
of c:
else:
case bar:
of a:
of b:
of c:
of d:
else:
```
to
```nim
case foo
of a:
of b:
of c:
else:
case bar:
of a:
of b:
of c:
of d:
else:
```
|
| |
|
|
|
|
|
|
|
|
|
| |
(#23054)
…g static procs
---------
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
|
|
|
|
| |
see https://github.com/nim-lang/Nim/issues/23052
---------
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
|
|
|
| |
Currently pragmas just fall through to `suggestSentinel` and show
everything which isn't very useful. Now it filters for symbols that
could be pragmas (templates with `{.pragma.}`, macros, user pragmas) and
only shows them
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When running `check`/`suggest` in a file with an invalid user pragma
like
```nim
{.pragma foo: test.}
```
It will continue to try and process it which leads to the compiler
running into a `FieldDefect`
```
fatal.nim(53) sysFatal
Error: unhandled exception: field 'sons' is not accessible for type 'TNode' using 'kind = nkIdent' [FieldDefect]
```
This makes it instead bail out trying to process the user pragma if its
invalid
|
|
|
|
| |
* remove some dead code and leftovers from past features
* fix yaml printing of uint64 literals
|
|
|
| |
Closes #13341
|
|
|
|
|
|
|
|
|
|
| |
(#23034)
…eption: Exception
fixes #23019
I suppose `implicitPragmas` is called somewhere which converts
`otherPragmas`.
|
|
|
| |
I image `add` for `PType` to be used everythere
|
|
|
|
| |
This affects also nimsuggest hints (e.g. on mouse hover), as well as
compiler messages.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently the documentation isn't shown when running `def` on the
definition of a proc (Which works for things like variables).
`gcsafe`/`noSideEffects` status also isn't showing up when running `def`
on the definition
Images of current behavior. After PR both look like "Usage"
**Definition**

**Usage**

Issue was the symbol getting passed too early to nimsuggest so it didn't
have all that info, now gets passed once proc is fully semmed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the docs for strutils.multiReplace:
Making it more explicit that left to right comes before the order in the
replacements arg (but that the latter matters too).
E.g.
```
echo "ab".multiReplace(@[("a", "1"), ("ax", "2")])
echo "ab".multiReplace(@[("ab", "2"), ("a", "1")])
```
gives
```
1b
2
```
resolves #23016
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
doesn't exist (#23017)
For example with the command `nim r foo/bar.nim`, if `foo/` doesn't
exist then it shows this message
```
oserrors.nim(92) raiseOSError
Error: unhandled exception: No such file or directory
Additional info: foo [OSError]
```
After PR it shows
```
Error: cannot open 'foo/bar.nim'
```
Which makes it line up with the error message if `foo/` did exist but
`bar.nim` didn't. Does this by using the same logic for [handling if the
file doesn't
exist](https://github.com/ire4ever1190/Nim/blob/0dc12ec24b7902ef0023a9e694faa11bcf99e257/compiler/options.nim#L785-L788)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
routine declaration (#23015)
I'm not sure if this is a complete fix, as it does not match the
expected output given in the issue. The expected output given in the
issue highlights the identifier after the `'` the same color as numeric
literals (blue), and this change does not address that. I think that
would involve simplifying `nimNumberPostfix`.
However, this fixes the issue where the routine declaration was rendered
as a string.
New rendering:

|
| |
|
|
|
| |
fixes #23001
|