Revert "fixes #20883; Unspecified generic on default value segfaults the compiler" (#21028)

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

This reverts commit 10b6e4f5b4.
This commit is contained in:
ringabout 2022-12-06 12:50:16 +08:00 • committed by GitHub
commit feb0481ba3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 7 deletions

View file

@ -81,7 +81,6 @@ type
info*: TLineInfo
allowMetaTypes*: bool # allow types such as seq[Number]
# i.e. the result contains unresolved generics
fromStaticExpr*: bool
skipTypedesc*: bool # whether we should skip typeDescs
isReturnType*: bool
owner*: PSym # where this instantiation comes from
@ -239,8 +238,6 @@ proc replaceTypeVarsN(cl: var TReplTypeVars, n: PNode; start=0): PNode =
assert result.kind notin nkCallKinds
else:
if n.len > 0:
if n.kind in nkCallKinds and n[0].kind == nkIdent and cl.fromStaticExpr:
localError(cl.c.config, n.info, "An unresolved call in staticExpr: '" & renderTree(n) & "'")
newSons(result, n.len)
if start > 0:
result[0] = n[0]
@ -663,11 +660,10 @@ proc initTypeVars*(p: PContext, typeMap: LayeredIdTable, info: TLineInfo;
result.owner = owner
proc replaceTypesInBody*(p: PContext, pt: TIdTable, n: PNode;
owner: PSym, allowMetaTypes = false, fromStaticExpr = false): PNode =
owner: PSym, allowMetaTypes = false): PNode =
var typeMap = initLayeredTypeMap(pt)
var cl = initTypeVars(p, typeMap, n.info, owner)
cl.allowMetaTypes = allowMetaTypes
cl.fromStaticExpr = fromStaticExpr
pushInfoContext(p.config, n.info)
result = replaceTypeVarsN(cl, n)
popInfoContext(p.config)