fixes #20883; Unspecified generic on default value segfaults the compiler (#20917)

test CI
This commit is contained in:
ringabout 2022-12-02 05:04:11 +08:00 • committed by GitHub
commit 10b6e4f5b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -807,7 +807,8 @@ proc tryResolvingStaticExpr(c: var TCandidate, n: PNode,
# N is bound to a concrete value during the matching of the first param.
# This proc is used to evaluate such static expressions.
let instantiated = replaceTypesInBody(c.c, c.bindings, n, nil,
allowMetaTypes = allowUnresolved)
allowMetaTypes = allowUnresolved,
fromStaticExpr = true)
result = c.c.semExpr(c.c, instantiated)
proc inferStaticParam*(c: var TCandidate, lhs: PNode, rhs: BiggestInt): bool =