74118464ab51 — Leonard Ritter 15 days ago
* `Rc`: fixed assignment error when assigning strong references directly
2 files changed, 20 insertions(+), 3 deletions(-)

M lib/scopes/Rc.sc
M testing/test_rc.sc
M lib/scopes/Rc.sc +6 -3
@@ 152,9 152,12 @@ typedef+ Rc
     inline __countof (self)
         countof (view self)
 
-    spice __= (selfT otherT)
-        inline (lhs rhs)
-            (view lhs) = rhs
+    inline __= (selfT otherT)
+        static-if (selfT == otherT)
+            super-type.__= selfT otherT
+        else
+            inline (lhs rhs)
+                (view lhs) = rhs
 
     inline __@ (self keys...)
         @ (view self) keys...

          
M testing/test_rc.sc +14 -0
@@ 196,4 196,18 @@ do
     local example : RcT = k
     # error: value of type %1000:<Rc T> must be unique
 
+do
+    using import struct
+
+    struct T
+        a = 0
+
+    RcT := (Rc T)
+
+    let k = (Rc.clone (RcT 17))
+
+    local container : RcT
+    dump (typeof container) (typeof k)
+    container = k
+
 ;
  No newline at end of file