Skip to content

Commit

Permalink
remove unused sfProcvar, "procvar" mentions (#20204)
Browse files Browse the repository at this point in the history
refs #12975. doesn't close it because wProcvar isn't removed
  • Loading branch information
metagn committed Aug 24, 2022
1 parent b6bfe38 commit d143924
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
5 changes: 3 additions & 2 deletions compiler/ast.nim
Expand Up @@ -260,7 +260,8 @@ type
# *OR*: a proc is indirectly called (used as first class)
sfCompilerProc, # proc is a compiler proc, that is a C proc that is
# needed for the code generator
sfProcvar, # proc can be passed to a proc var
sfEscapes # param escapes
# currently unimplemented
sfDiscriminant, # field is a discriminant in a record/object
sfRequiresInit, # field must be initialized during construction
sfDeprecated, # symbol is deprecated
Expand Down Expand Up @@ -331,7 +332,7 @@ const
sfExperimental* = sfOverriden # module uses the .experimental switch
sfGoto* = sfOverriden # var is used for 'goto' code generation
sfWrittenTo* = sfBorrow # param is assigned to
sfEscapes* = sfProcvar # param escapes
# currently unimplemented
sfBase* = sfDiscriminant
sfCustomPragma* = sfRegister # symbol is custom pragma template
sfTemplateRedefinition* = sfExportc # symbol is a redefinition of an earlier template
Expand Down
3 changes: 1 addition & 2 deletions compiler/pragmas.nim
Expand Up @@ -993,8 +993,8 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: var int,
of wNonReloadable:
sym.flags.incl sfNonReloadable
of wProcVar:
# old procvar annotation, no longer needed
noVal(c, it)
incl(sym.flags, sfProcvar)
of wExplain:
sym.flags.incl sfExplain
of wDeprecated:
Expand Down Expand Up @@ -1043,7 +1043,6 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: var int,
of wThread:
noVal(c, it)
incl(sym.flags, sfThread)
incl(sym.flags, sfProcvar)
if sym.typ != nil:
incl(sym.typ.flags, tfThread)
if sym.typ.callConv == ccClosure: sym.typ.callConv = ccNimCall
Expand Down
3 changes: 2 additions & 1 deletion compiler/sempass2.nim
Expand Up @@ -562,7 +562,8 @@ proc procVarCheck(n: PNode; conf: ConfigRef) =
if n.kind in nkSymChoices:
for x in n: procVarCheck(x, conf)
elif n.kind == nkSym and n.sym.magic != mNone and n.sym.kind in routineKinds:
localError(conf, n.info, "'$1' cannot be passed to a procvar" % n.sym.name.s)
localError(conf, n.info, ("'$1' is a built-in and cannot be used as " &
"a first-class procedure") % n.sym.name.s)

proc notNilCheck(tracked: PEffects, n: PNode, paramType: PType) =
let n = n.skipConv
Expand Down
3 changes: 1 addition & 2 deletions doc/manual.md
Expand Up @@ -8336,8 +8336,7 @@ violations of the `no heap sharing restriction`:idx:\: This restriction implies
that it is invalid to construct a data structure that consists of memory
allocated from different (thread-local) heaps.

A thread proc is passed to `createThread` or `spawn` and invoked
indirectly; so the `thread` pragma implies `procvar`.
A thread proc can be passed to `createThread` or `spawn`.



Expand Down
2 changes: 1 addition & 1 deletion tests/errmsgs/tcannot_capture_builtin.nim
@@ -1,5 +1,5 @@
discard """
errormsg: "'+' cannot be passed to a procvar"
errormsg: "'+' is a built-in and cannot be used as a first-class procedure"
line: 8
"""

Expand Down

0 comments on commit d143924

Please sign in to comment.