about summary refs log tree commit diff stats
path: root/055shape_shifting_container.cc
diff options
context:
space:
mode:
Diffstat (limited to '055shape_shifting_container.cc')
-rw-r--r--055shape_shifting_container.cc44
1 files changed, 23 insertions, 21 deletions
diff --git a/055shape_shifting_container.cc b/055shape_shifting_container.cc
index 02e5214b..c3d0246f 100644
--- a/055shape_shifting_container.cc
+++ b/055shape_shifting_container.cc
@@ -67,7 +67,7 @@ container foo:_a:_b [
 def main [
   1:text <- new [abc]
   # compound types for type ingredients
-  {2: (foo number (address array character))} <- merge 34/x, 1:text/y
+  {3: (foo number (address array character))} <- merge 34/x, 1:text/y
 ]
 $error: 0
 
@@ -82,7 +82,7 @@ container bar:_a:_b [
 ]
 def main [
   1:text <- new [abc]
-  2:bar:num:@:char <- merge 34/x, 1:text/y
+  3:bar:num:@:char <- merge 34/x, 1:text/y
 ]
 $error: 0
 
@@ -247,9 +247,9 @@ container foo:_t [
 ]
 def main [
   1:foo:point <- merge 14, 15, 16
-  2:num <- get 1:foo:point, y:offset
+  4:num <- get 1:foo:point, y:offset
 ]
-+mem: storing 16 in location 2
++mem: storing 16 in location 4
 
 :(scenario get_on_shape_shifting_container_2)
 container foo:_t [
@@ -258,10 +258,10 @@ container foo:_t [
 ]
 def main [
   1:foo:point <- merge 14, 15, 16
-  2:point <- get 1:foo:point, x:offset
+  4:point <- get 1:foo:point, x:offset
 ]
-+mem: storing 14 in location 2
-+mem: storing 15 in location 3
++mem: storing 14 in location 4
++mem: storing 15 in location 5
 
 :(scenario get_on_shape_shifting_container_3)
 container foo:_t [
@@ -269,10 +269,12 @@ container foo:_t [
   y:num
 ]
 def main [
-  1:foo:&:point <- merge 34/unsafe, 48
-  3:&:point <- get 1:foo:&:point, x:offset
+  1:num/alloc-id, 2:num <- copy 0, 34
+  3:foo:&:point <- merge 1:&:point, 48
+  6:&:point <- get 1:foo:&:point, x:offset
 ]
-+mem: storing 34 in location 3
++mem: storing 0 in location 6
++mem: storing 34 in location 7
 
 :(scenario get_on_shape_shifting_container_inside_container)
 container foo:_t [
@@ -285,9 +287,9 @@ container bar [
 ]
 def main [
   1:bar <- merge 14, 15, 16, 17
-  2:num <- get 1:bar, 1:offset
+  5:num <- get 1:bar, 1:offset
 ]
-+mem: storing 17 in location 2
++mem: storing 17 in location 5
 
 :(scenario get_on_complex_shape_shifting_container)
 container foo:_a:_b [
@@ -296,11 +298,11 @@ container foo:_a:_b [
 ]
 def main [
   1:text <- new [abc]
-  {2: (foo number (address array character))} <- merge 34/x, 1:text/y
-  3:text <- get {2: (foo number (address array character))}, y:offset
-  4:bool <- equal 1:text, 3:text
+  {3: (foo number (address array character))} <- merge 34/x, 1:text/y
+  6:text <- get {3: (foo number (address array character))}, y:offset
+  8:bool <- equal 1:text, 6:text
 ]
-+mem: storing 1 in location 4
++mem: storing 1 in location 8
 
 :(before "End element_type Special-cases")
 replace_type_ingredients(element, type, info, " while computing element type of container");
@@ -346,8 +348,8 @@ exclusive-container foo:_a [
 ]
 def main [
   1:text <- new [abc]
-  2:foo:point <- merge 0/variant, 34/xx, 35/xy
-  10:point, 20:bool <- maybe-convert 2:foo:point, 0/variant
+  3:foo:point <- merge 0/variant, 34/xx, 35/xy
+  10:point, 20:bool <- maybe-convert 3:foo:point, 0/variant
 ]
 +mem: storing 1 in location 20
 +mem: storing 35 in location 11
@@ -565,8 +567,8 @@ container foo:_t [
   y:num
 ]
 def main [
-  10:foo:point <- merge 14, 15, 16
-  1:num <- get 10:foo, 1:offset
+  1:foo:point <- merge 14, 15, 16
+  10:num <- get 1:foo, 1:offset
 ]
 # todo: improve error message
 +error: illegal type "foo" seems to be missing a type ingredient or three while computing element type of container
@@ -586,7 +588,7 @@ def main [
 % Hide_errors = true;
 def foo [
   local-scope
-  x:adress:array:number <- copy 0  # typo
+  x:adress:array:number <- copy null  # typo
 ]
 # shouldn't crash
 
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394