Fix nimsuggest not suggesting fields in when theres static parameters (#21189)
Don't check against empty arguments Add test case
This commit is contained in:
parent
9efa56a8bb
commit
3d5dbf8f96
2 changed files with 19 additions and 1 deletions
|
|
@ -2055,7 +2055,7 @@ proc paramTypesMatchAux(m: var TCandidate, f, a: PType,
|
||||||
a.n == nil and
|
a.n == nil and
|
||||||
tfGenericTypeParam notin a.flags:
|
tfGenericTypeParam notin a.flags:
|
||||||
return newNodeIT(nkType, argOrig.info, makeTypeFromExpr(c, arg))
|
return newNodeIT(nkType, argOrig.info, makeTypeFromExpr(c, arg))
|
||||||
else:
|
elif arg.kind != nkEmpty:
|
||||||
var evaluated = c.semTryConstExpr(c, arg)
|
var evaluated = c.semTryConstExpr(c, arg)
|
||||||
if evaluated != nil:
|
if evaluated != nil:
|
||||||
# Don't build the type in-place because `evaluated` and `arg` may point
|
# Don't build the type in-place because `evaluated` and `arg` may point
|
||||||
|
|
|
||||||
18
nimsuggest/tests/t21185.nim
Normal file
18
nimsuggest/tests/t21185.nim
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
|
||||||
|
# Reduced case of 21185. Issue was first parameter being static
|
||||||
|
proc foo(x: static[int]) = discard
|
||||||
|
|
||||||
|
type
|
||||||
|
Person = object
|
||||||
|
name: string
|
||||||
|
age: int
|
||||||
|
|
||||||
|
let p = Person()
|
||||||
|
p.#[!]#
|
||||||
|
|
||||||
|
discard """
|
||||||
|
$nimsuggest --tester --v3 --maxresults:2 $file
|
||||||
|
>sug $1
|
||||||
|
sug;;skField;;age;;int;;$file;;8;;4;;"";;100;;None
|
||||||
|
sug;;skField;;name;;string;;$file;;7;;4;;"";;100;;None
|
||||||
|
"""
|
||||||
Loading…
Add table
Add a link
Reference in a new issue