* add inUncheckedAssignSection * add one more test
This commit is contained in:
parent
ef3f343ec2
commit
9c17a32e0e
4 changed files with 39 additions and 2 deletions
|
|
@ -34,3 +34,25 @@ proc passToVar(x: var Token) = discard
|
|||
t.curr = TokenObject(kind: t.curr.kind, foo: "abc")
|
||||
|
||||
t.curr.kind = Token.foo
|
||||
|
||||
|
||||
block:
|
||||
type
|
||||
TokenKind = enum
|
||||
strLit, intLit
|
||||
Token = object
|
||||
case kind*: TokenKind
|
||||
of strLit:
|
||||
s*: string
|
||||
of intLit:
|
||||
i*: int64
|
||||
|
||||
var t = Token(kind: strLit, s: "abc")
|
||||
|
||||
{.cast(uncheckedAssign).}:
|
||||
|
||||
# inside the 'cast' section it is allowed to assign to the 't.kind' field directly:
|
||||
t.kind = intLit
|
||||
|
||||
{.cast(uncheckedAssign).}:
|
||||
t.kind = strLit
|
||||
Loading…
Add table
Add a link
Reference in a new issue