Skip to content

Commit

Permalink
refactor(sem): clean up hasUnresolvedParams (#957)
Browse files Browse the repository at this point in the history
## Summary

Remove disabled code from the `hasUnresolvedParams` procedure. The
code has been disabled for 7 years and is unlikely to become used
again.

## Details

* remove the disabled code block
* remove the unused `flags: TExprFlags` parameter
  • Loading branch information
bung87 authored Oct 17, 2023
1 parent 487b462 commit 3d72145
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
2 changes: 1 addition & 1 deletion compiler/sem/semexprs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ proc semOperand(c: PContext, n: PNode, flags: TExprFlags = {}): PNode =

if result.typ != nil:
# XXX tyGenericInst here?
if result.typ.kind == tyProc and hasUnresolvedParams(result, {efOperand}):
if result.typ.kind == tyProc and hasUnresolvedParams(result):
result = c.config.newError(n, PAstDiag(kind: adSemProcHasNoConcreteType))
elif result.typ.kind in {tyVar, tyLent}:
result = newDeref(result)
Expand Down
16 changes: 1 addition & 15 deletions compiler/sem/semstmts.nim
Original file line number Diff line number Diff line change
Expand Up @@ -444,22 +444,8 @@ proc hasEmpty(typ: PType): bool =
for s in typ.sons:
result = result or hasEmpty(s)

proc hasUnresolvedParams(n: PNode; flags: TExprFlags): bool =
proc hasUnresolvedParams(n: PNode): bool =
result = tfUnresolved in n.typ.flags
when false:
case n.kind
of nkSym:
result = isGenericRoutineStrict(n.sym)
of nkSymChoices:
for ch in n:
if hasUnresolvedParams(ch, flags):
return true
result = false
else:
result = false
if efOperand in flags:
if tfUnresolved notin n.typ.flags:
result = false

proc makeDeref(n: PNode): PNode =
var t = n.typ
Expand Down

0 comments on commit 3d72145

Please sign in to comment.