Merge: doc: fixed some typos and other misc. corrections
[nit.git] / tests / base_attr_isset.nit
index f4eee62..c1a1fea 100644 (file)
@@ -19,31 +19,31 @@ import end
 interface Object
 end
 
-universal Int
-       meth output is intern
-       meth +(o: Int): Int is intern
+enum Int
+       fun output is intern
+       fun +(o: Int): Int is intern
 end
 
-universal Bool
-       meth output is intern
+enum Bool
+       fun output is intern
 end
 
 class Integer
-       readable writable attr _val: Int
-       init(val: Int) do _val = val
-       meth output do _val.output
+       var val: Int
+
+       fun output do _val.output
 end
 
 class Foo
-       attr _a1: Integer
-       readable attr _a2: Integer
-       meth run
+       var a1: Integer is noinit
+       var a2: Integer is noinit
+       fun run
        do
                _a1.output
-               a2.output
+               _a2.output
        end
 
-       meth show(i: Int)
+       fun show(i: Int)
        do
                i.output
                (isset _a1).output
@@ -55,26 +55,26 @@ class Foo
                show(1)
                _a1 = new Integer(1)
                show(2)
-               _a2 = new Integer(_a1.val + 1)
+               _a2 = new Integer(_a1._val + 1) #alt3# #alt4#
                show(3)
        end
-
+               #alt3#
        init nop do end
 end
 
 class Bar
-special Foo
-       attr _a3: Integer#!alt1# #!alt2#
-       #alt1#attr _a3: Integer = new Integer(9000)
-       #alt2#attr _a3: nullable Integer
-       redef meth run
+       super Foo
+       var a3: Integer is noinit#alt1# #alt2#
+       #alt1#var a3: Integer = new Integer(9000)
+       #alt2#var a3: nullable Integer is noinit
+       redef fun run
        do
                _a1.output
                _a2.output
                _a3.output
        end
 
-       redef meth show(i)
+       redef fun show(i)
        do
                super
                (isset _a3).output
@@ -82,7 +82,7 @@ special Foo
 
        init
        do
-               nop
+               if false then super # no auto super init call
                show(4)
                _a1 = new Integer(10)
                show(5)
@@ -93,6 +93,11 @@ special Foo
        end
 end
 
+class Baz
+       super Foo
+end
+
+#alt4# var b2 = new Baz
 var f = new Foo
 var b = new Bar
 f.run