You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A ProveField warning is emitted when accessing a field of a case object that is passed as var.
{.pushwarning[ProveField]:on.}
typeFoo=objectcase a: bool offalse:
x: int oftrue:
y: float# Warning: cannot prove that field 'f.x' is accessible# Warning: cannot prove that field 'f.y' is accessibleprocfoo(f: varFoo) =case f.a
offalse:
echo$f.x
oftrue:
echo$f.y
var f =Foo(a: false, x: 42)
f.foo
# No warning emittedprocbar(f: Foo) =case f.a
offalse:
echo$f.x
oftrue:
echo$f.y
var g =Foo(a: false, x: 42)
g.bar
Nim Version
% nim -v
Nim Compiler Version 1.6.12 [MacOSX: amd64]
Compiled at 2023-06-09
Copyright (c) 2006-2023 by Andreas Rumpf
git hash: 1aa9273640c0c51486cf3a7b67282fe58f360e91
active boot switches: -d:release
Current Output
./test.nim(10, 1) template/generic instantiation from here
./test.nim(13, 12) Warning: cannot prove that field 'f.x' is accessible [ProveField]
echo $f.x
^
./test.nim(10, 1) template/generic instantiation from here
./test.nim(15, 12) Warning: cannot prove that field 'f.y' is accessible [ProveField]
echo $f.y
^
Expected Output
No `ProveField` warning
Possible Solution
The warning is suppressable by surrounding the function:
Description
A
ProveField
warning is emitted when accessing a field of a case object that is passed asvar
.Nim Version
Current Output
Expected Output
Possible Solution
The warning is suppressable by surrounding the function:
Note that warnings are not suppressable inside the
proc
:Additional Information
No response
The text was updated successfully, but these errors were encountered: