| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
refs #22605
Sym choice nodes are now only allowed to pass through semchecking if
contexts ask for them to (with `efAllowSymChoice`). Otherwise they are
resolved or treated as ambiguous. The contexts that can receive
symchoices in this PR are:
* Call operands and addresses and emulations of such, which will subject
them to overload resolution which will resolve them or fail.
* Type conversion operands only for routine symchoices for type
disambiguation syntax (like `(proc (x: int): int)(foo)`), which will
resolve them or fail.
* Proc parameter default values both at the declaration and during
generic instantiation, which undergo type narrowing and so will resolve
them or fail.
This means unless these contexts mess up sym choice nodes should never
leave the semchecking stage. This serves as a blueprint for future
improvements to intermediate symbol resolution.
Some tangential changes are also in this PR:
1. The `AmbiguousEnum` hint is removed, it was always disabled by
default and since #22606 it only started getting emitted after the
symchoice was soundly resolved.
2. Proc setter syntax (`a.b = c` becoming `` `b=`(a, c) ``) used to
fully type check the RHS before passing the transformed call node to
proc overloading. Now it just passes the original node directly so proc
overloading can deal with its typechecking.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
(#21908)
* fixes #21887; Type conversion on overloaded enum field does not always call
* remove comments
* add a test case
* restrict it to enums
|
|
|
| |
fixes 21863; Incorrect enum field access can cause internal error
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* fixes #21280; Enum with int64.high() value crashes compiler
* Update tests/enum/tenum.nim
* Update tests/enum/tenum.nim
* fixes tests
* Update tests/enum/tenum.nim
---------
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
|
|
| |
* megatest now checks refc too
* fixes refc
|
|
|
|
|
| |
* fixes #21207; reports redefinition in the enums
* add a test
|
|
|
|
|
|
|
| |
* fixes #12589; add testcase
* fixes i386
* i386
|
|
|
|
|
|
|
|
|
| |
* closed ambiguous enum defaults to first overload
* add warning
* turn to hint
* work around config
|
|
|
| |
depends on #20126
|
|
|
| |
mirror behavior without overloadableEnums
|
| |
|
|
|
|
| |
(#18970)
|
| |
|
|
|
|
|
| |
* add testcase for overloadable_enums
* link
|
|
|
|
|
| |
* implements overloadable enum values
* simpler code
|
|
|
|
| |
(#18291)
|
|
|
|
| |
* type with same name in different scope now works
* fix tests/enum/tenum.nim which was wrong because it was affected by this bug
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
* {.deprecated.} pragma is now supported for enum fields
* Add tests
* Simplify code
|
| |
|
|
|
|
| |
call undeclared routine' error (#8786)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* merge controlflow tests
* merge distinct tests
* merge enum tests
* merge fields tests
* merge implicit tests
* merge iter issues tests
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
via OSX: find . -name '*.nim' -exec sed -i '' -E 's/[[:space:]]+$//' {} +
|
| |
|
|
|
|
|
| |
Better compiler errors for accessing undeclared fields, calling undeclared
procedures and procedure fields.
|
| |
|
| |
|
|
|