mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-01 19:02:18 +00:00
* fix #18977 disallow change branch of an object variant in ORC * check errors for goto exception * fixes conditions * fixes tests * add a test case for #18977
27 lines
350 B
Nim
27 lines
350 B
Nim
discard """
|
|
matrix: "--mm:arc"
|
|
"""
|
|
|
|
type
|
|
E = enum
|
|
a, b, c, d
|
|
X = object
|
|
v: int
|
|
O = object
|
|
case kind: E
|
|
of a:
|
|
a: int
|
|
of {b, c}:
|
|
b: float
|
|
else:
|
|
d: X
|
|
|
|
proc `=destroy`(x: var X) =
|
|
echo "x destroyed"
|
|
|
|
var o = O(kind: d, d: X(v: 12345))
|
|
doAssert o.d.v == 12345
|
|
|
|
doAssertRaises(FieldDefect):
|
|
o.kind = a
|