summary refs log tree commit diff stats
path: root/tests/lookups/tambsym3.nim
Commit message (Collapse)AuthorAgeFilesLines
* ambiguous identifier resolution (#23123)metagn2024-01-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fixes #23002, fixes #22841, refs comments in #23097 When an identifier is ambiguous in scope (i.e. multiple imports contain symbols with the same name), attempt resolving it through type inference (by creating a symchoice). To do this efficiently, `qualifiedLookUp` had to be broken up so that `semExpr` can access the ambiguous candidates directly (now obtained directly via `lookUpCandidates`). This fixes the linked issues, but an example like: ```nim let on = 123 {.warning[ProveInit]: on.} ``` will still fail, since `on` is unambiguously the local `let` symbol here (this is also true for `proc on` but `proc` symbols generate symchoices anyway). Type symbols are not considered to not confuse the type inference. This includes the change in sigmatch, up to this point symchoices with nonoverloadable symbols could be created, they just wouldn't be considered during disambiguation. Now every proper symbol except types are considered in disambiguation, so the correct symbols must be picked during the creation of the symchoice node. I remember there being a violating case of this in the compiler, but this was very likely fixed by excluding type symbols as CI seems to have found no issues. The pure enum ambiguity test was disabled because ambiguous pure enums now behave like overloadable enums with this behavior, so we get a longer error message for `echo amb` like `type mismatch: got <MyEnum | OtherEnum> but expected T`
* resolve unambiguous enum symchoices from local scope, error on rest (#22606)metagn2023-09-031-5/+2
| | | | | | | | | | | | | | | | 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.
* some test cleanups & category reorganization (#22010)metagn2023-06-061-0/+16
* clean up some test categories * mention exact slice issue * magics into system * move trangechecks into overflow * move tmemory to system * try fix CI * try fix CI * final CI fix