summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2021-06-10 16:49:17 +0200
committerGitHub <noreply@github.com>2021-06-10 16:49:17 +0200
commit2ea7287217ffe3ad6c3790ff1233845de2aedcf4 (patch)
tree272e77e540c687a7abb9957bb1624118fcc87f9e /compiler
parent3481ff6172a2e11c990cc67a7fd74a2f0a2445d2 (diff)
downloadNim-2ea7287217ffe3ad6c3790ff1233845de2aedcf4.tar.gz
view types: spec changes (#18226)
* view types: spec changes

* Update doc/manual_experimental.rst

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

* Update doc/manual_experimental.rst

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
Diffstat (limited to 'compiler')
-rw-r--r--compiler/varpartitions.nim5
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/varpartitions.nim b/compiler/varpartitions.nim
index 9cf1e38ad..04c7c629d 100644
--- a/compiler/varpartitions.nim
+++ b/compiler/varpartitions.nim
@@ -572,7 +572,7 @@ proc borrowingAsgn(c: var Partitions; dest, src: PNode) =
       borrowFrom(c, dest.sym, src)
   elif dest.kind in {nkHiddenDeref, nkDerefExpr, nkBracketExpr}:
     case directViewType(dest[0].typ)
-    of mutableView:
+    of mutableView, immutableView:
       # we do not borrow, but we use the view to mutate the borrowed
       # location:
       let viewOrigin = pathExpr(dest, c.owner)
@@ -580,12 +580,13 @@ proc borrowingAsgn(c: var Partitions; dest, src: PNode) =
         let vid = variableId(c, viewOrigin.sym)
         if vid >= 0:
           c.s[vid].flags.incl viewDoesMutate
-    of immutableView:
+    #[of immutableView:
       if dest.kind == nkBracketExpr and dest[0].kind == nkHiddenDeref and
           mutableParameter(dest[0][0]):
         discard "remains a mutable location anyhow"
       else:
         localError(c.g.config, dest.info, "attempt to mutate a borrowed location from an immutable view")
+        ]#
     of noView: discard "nothing to do"
 
 proc containsPointer(t: PType): bool =