summary refs log tree commit diff stats
path: root/lib/system
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-05-26 23:10:34 +0200
committerAndreas Rumpf <rumpf_a@web.de>2019-05-27 21:29:02 +0200
commit49e686ab4e8103173ecb39cc16896eb979ddf9ce (patch)
tree61c40522d19e63c3bd86251a2a62bb57cf08022a /lib/system
parent247fa431de9587b59978a1c8a7b20da6fe44f95e (diff)
downloadNim-49e686ab4e8103173ecb39cc16896eb979ddf9ce.tar.gz
fixes #1286; object case transitions are now sound
Diffstat (limited to 'lib/system')
-rw-r--r--lib/system/assign.nim8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/system/assign.nim b/lib/system/assign.nim
index d4826fe0c..fd6a0ac56 100644
--- a/lib/system/assign.nim
+++ b/lib/system/assign.nim
@@ -232,5 +232,9 @@ proc FieldDiscriminantCheck(oldDiscVal, newDiscVal: int,
                             L: int) {.compilerProc.} =
   var oldBranch = selectBranch(oldDiscVal, L, a)
   var newBranch = selectBranch(newDiscVal, L, a)
-  if newBranch != oldBranch and oldDiscVal != 0:
-    sysFatal(FieldError, "assignment to discriminant changes object branch")
+  when defined(nimOldCaseObjects):
+    if newBranch != oldBranch and oldDiscVal != 0:
+      sysFatal(FieldError, "assignment to discriminant changes object branch")
+  else:
+    if newBranch != oldBranch:
+      sysFatal(FieldError, "assignment to discriminant changes object branch")