]> ocean-lang.org Git - ocean/blobdiff - csrc/oceani-tests.mdc
oceani: allow field references on references.
[ocean] / csrc / oceani-tests.mdc
index d672cffc8a97d92b0edb8cc590feb052d5101e8d..655a2c95057a3cc686ddac87003acc10bbb88e91 100644 (file)
@@ -730,17 +730,17 @@ A simple linked list example
        func insert(list:@node; new:string):@node
                p:=list
                prev := @nil
-               while ?p and then p@.this < new:
+               while ?p and then p.this < new:
                        prev = p
-                       p = p@.next
+                       p = p.next
                if ?prev:
-                       prev@.next = @new()
-                       prev@.next@.next = p
-                       prev@.next@.this = new
+                       prev.next = @new()
+                       prev.next.next = p
+                       prev.next.this = new
                else
                        list = @new()
-                       list@.next = p
-                       list@.this = new
+                       list.next = p
+                       list.this = new
                use list
 
        func printlist(list:@node)
@@ -750,7 +750,7 @@ A simple linked list example
 
        func freelist(list:@node)
                if list != @nil:
-                       freelist(list@.next)
+                       freelist(list.next)
                        @free = list
 
        func main(argv:[ac::]string)
@@ -1195,7 +1195,7 @@ Test for errors with references
                ref2:@string
                num:number = @new()
                print num@
-               if num == @nil or ref == ref2 or ref == 2:
+               if num == @nil or ref == ref2 or ref == 2 or ref.foo:
                        @free = num
 
 ###### output: ref_err2
@@ -1206,6 +1206,8 @@ Test for errors with references
        .tmp.code:7:33: error: expected @number but variable 'ref2' is @string
        .tmp.code:4:8: info: this is where 'ref2' was set to @string
        .tmp.code:7:48: error: expected @number found number
+       .tmp.code:7:53: error: field reference on number is not supported
+       .tmp.code:7:56: error: have none but need Boolean
        .tmp.code:8:17: error: @free can only be assigned a reference, not number
        .tmp.code:8:17: error: @free can only be assigned a reference, not number
        oceani: type error in program - not running.