Merge: Attribute and autoinit annotations
authorJean Privat <jean@pryen.org>
Wed, 10 Jun 2015 01:46:42 +0000 (21:46 -0400)
committerJean Privat <jean@pryen.org>
Wed, 10 Jun 2015 01:46:42 +0000 (21:46 -0400)
A big set of loosely coupled but related changed on the annotations on attributes and methods.
Here is a summary of the changes on the user-side:

* No more special case for the kind of classes, so you can use `autoinit` in interfaces.
* Explicit annotation `autoinit` is understood on attributes and is the default on value-less concrete attribute.
* Abstract attributes are `noautoinit` by default, if `autoinit` is given, it is applied on the setter. This way abstract attributes are basically just a couple of getter-setter. close #1311

This way there is less special cases and behaviors. Still more work is required to finish #1322.

Pull-Request: #1433
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

42 files changed:
src/compiler/abstract_compiler.nit
src/interpreter/naive_interpreter.nit
src/modelize/modelize_property.nit
src/rapid_type_analysis.nit
src/semantize/typing.nit
tests/base_attr4.nit
tests/base_attr_abstract.nit
tests/base_attr_abstract2.nit
tests/base_attr_abstract3.nit [new file with mode: 0644]
tests/base_attr_abstract4.nit [new file with mode: 0644]
tests/base_attr_annot.nit [new file with mode: 0644]
tests/base_init_setter.nit [new file with mode: 0644]
tests/sav/base_attr4.res
tests/sav/base_attr4_alt1.res
tests/sav/base_attr4_alt2.res
tests/sav/base_attr_abstract.res
tests/sav/base_attr_abstract3.res [new file with mode: 0644]
tests/sav/base_attr_abstract4.res [new file with mode: 0644]
tests/sav/base_attr_abstract_alt1.res
tests/sav/base_attr_abstract_alt2.res
tests/sav/base_attr_abstract_alt3.res
tests/sav/base_attr_abstract_alt4.res
tests/sav/base_attr_abstract_alt5.res [new file with mode: 0644]
tests/sav/base_attr_annot.res [new file with mode: 0644]
tests/sav/base_attr_annot_1alt1.res [new file with mode: 0644]
tests/sav/base_attr_annot_1alt1_alt1.res [new file with mode: 0644]
tests/sav/base_attr_annot_1alt1_alt2.res [new file with mode: 0644]
tests/sav/base_attr_annot_1alt1_alt3.res [new file with mode: 0644]
tests/sav/base_attr_annot_1alt1_alt4.res [new file with mode: 0644]
tests/sav/base_attr_annot_1alt1_alt5.res [new file with mode: 0644]
tests/sav/base_attr_annot_1alt1_alt6.res [new file with mode: 0644]
tests/sav/base_attr_annot_1alt1_alt7.res [new file with mode: 0644]
tests/sav/base_attr_annot_alt1.res [new file with mode: 0644]
tests/sav/base_attr_annot_alt2.res [new file with mode: 0644]
tests/sav/base_attr_annot_alt3.res [new file with mode: 0644]
tests/sav/base_attr_annot_alt4.res [new file with mode: 0644]
tests/sav/base_attr_annot_alt5.res [new file with mode: 0644]
tests/sav/base_attr_annot_alt6.res [new file with mode: 0644]
tests/sav/base_attr_annot_alt7.res [new file with mode: 0644]
tests/sav/base_init_setter.res [new file with mode: 0644]
tests/sav/error_class_glob.res
tests/sav/niti/base_attr_annot_alt2.res [new file with mode: 0644]

index 9d3b0f3..c48aab9 100644 (file)
@@ -2457,7 +2457,7 @@ redef class AAttrPropdef
                        var res
                        if is_lazy then
                                var set
-                               var ret = self.mpropdef.static_mtype
+                               var ret = self.mtype
                                var useiset = not ret.is_c_primitive and not ret isa MNullableType
                                var guard = self.mlazypropdef.mproperty
                                if useiset then
@@ -2485,7 +2485,7 @@ redef class AAttrPropdef
                        assert arguments.length == 2
                        v.write_attribute(self.mpropdef.mproperty, arguments.first, arguments[1])
                        if is_lazy then
-                               var ret = self.mpropdef.static_mtype
+                               var ret = self.mtype
                                var useiset = not ret.is_c_primitive and not ret isa MNullableType
                                if not useiset then
                                        v.write_attribute(self.mlazypropdef.mproperty, arguments.first, v.bool_instance(true))
@@ -2507,11 +2507,11 @@ redef class AAttrPropdef
                var oldnode = v.current_node
                v.current_node = self
                var old_frame = v.frame
-               var frame = new StaticFrame(v, self.mpropdef.as(not null), recv.mcasttype.undecorate.as(MClassType), [recv])
+               var frame = new StaticFrame(v, self.mreadpropdef.as(not null), recv.mcasttype.undecorate.as(MClassType), [recv])
                v.frame = frame
 
                var value
-               var mtype = self.mpropdef.static_mtype
+               var mtype = self.mtype
                assert mtype != null
 
                var nexpr = self.n_expr
index 16e0b48..53f2f41 100644 (file)
@@ -1245,13 +1245,13 @@ redef class AAttrPropdef
        do
                if is_lazy then return
                if has_value then
-                       var f = v.new_frame(self, mpropdef.as(not null), [recv])
+                       var f = v.new_frame(self, mreadpropdef.as(not null), [recv])
                        evaluate_expr(v, recv, f)
                        return
                end
                var mpropdef = self.mpropdef
                if mpropdef == null then return
-               var mtype = mpropdef.static_mtype.as(not null)
+               var mtype = self.mtype.as(not null)
                mtype = mtype.anchor_to(v.mainmodule, recv.mtype.as(MClassType))
                if mtype isa MNullableType then
                        v.write_attribute(self.mpropdef.mproperty, recv, v.null_instance)
index 91c552f..1afce19 100644 (file)
@@ -158,9 +158,6 @@ redef class ModelBuilder
                        return
                end
 
-               # Is the class forbid constructors?
-               if not mclassdef.mclass.kind.need_init then return
-
                # Is there already a constructor defined?
                var defined_init: nullable MMethodDef = null
                for mpropdef in mclassdef.mpropdefs do
@@ -182,18 +179,11 @@ redef class ModelBuilder
                var initializers = new Array[MProperty]
                for npropdef in nclassdef.n_propdefs do
                        if npropdef isa AMethPropdef then
+                               if not npropdef.is_autoinit then continue # Skip non tagged autoinit
                                if npropdef.mpropdef == null then return # Skip broken method
-                               var at = npropdef.get_single_annotation("autoinit", self)
-                               if at == null then continue # Skip non tagged init
-
                                var sig = npropdef.mpropdef.msignature
                                if sig == null then continue # Skip broken method
 
-                               if not npropdef.mpropdef.is_intro then
-                                       self.error(at, "Error: `autoinit` cannot be set on redefinitions.")
-                                       continue
-                               end
-
                                for param in sig.mparameters do
                                        var ret_type = param.mtype
                                        var mparameter = new MParameter(param.name, ret_type, false, ret_type isa MNullableType)
@@ -743,6 +733,8 @@ end
 redef class AMethPropdef
        redef type MPROPDEF: MMethodDef
 
+       # Is the method annotated `autoinit`?
+       var is_autoinit = false
 
        # Can self be used as a root init?
        private fun look_like_a_root_init(modelbuilder: ModelBuilder, mclassdef: MClassDef): Bool
@@ -988,6 +980,17 @@ redef class AMethPropdef
                # Check annotations
                var at = self.get_single_annotation("lazy", modelbuilder)
                if at != null then modelbuilder.error(at, "Syntax Error: `lazy` must be used on attributes.")
+
+               var atautoinit = self.get_single_annotation("autoinit", modelbuilder)
+               if atautoinit != null then
+                       if not mpropdef.is_intro then
+                               modelbuilder.error(atautoinit, "Error: `autoinit` cannot be set on redefinitions.")
+                       else if not mclassdef.is_intro then
+                               modelbuilder.error(atautoinit, "Error: `autoinit` cannot be used in class refinements.")
+                       else
+                               self.is_autoinit = true
+                       end
+               end
        end
 
        redef fun check_signature(modelbuilder)
@@ -1135,6 +1138,10 @@ end
 redef class AAttrPropdef
        redef type MPROPDEF: MAttributeDef
 
+       # The static type of the property (declared, inferred or inherited)
+       # This attribute is also used to check if the property was analyzed and is valid.
+       var mtype: nullable MType
+
        # Is the node tagged `noinit`?
        var noinit = false
 
@@ -1209,8 +1216,7 @@ redef class AAttrPropdef
                                return
                        end
                        if atabstract != null then
-                               modelbuilder.error(atnoinit, "Error: `noautoinit` attributes cannot be abstract.")
-                               return
+                               modelbuilder.warning(atnoinit, "useless-noautoinit", "Warning: superfluous `noautoinit` on abstract attribute.")
                        end
                end
 
@@ -1282,6 +1288,22 @@ redef class AAttrPropdef
                modelbuilder.mpropdef2npropdef[mwritepropdef] = self
                mwritepropdef.mdoc = mreadpropdef.mdoc
                if atabstract != null then mwritepropdef.is_abstract = true
+
+               var atautoinit = self.get_single_annotation("autoinit", modelbuilder)
+               if atautoinit != null then
+                       if has_value then
+                               modelbuilder.error(atautoinit, "Error: `autoinit` attributes cannot have an initial value.")
+                       else if not mwritepropdef.is_intro then
+                               modelbuilder.error(atautoinit, "Error: `autoinit` attributes cannot be set on redefinitions.")
+                       else if not mclassdef.is_intro then
+                               modelbuilder.error(atautoinit, "Error: `autoinit` attributes cannot be used in class refinements.")
+                       else if atabstract == null then
+                               modelbuilder.warning(atautoinit, "useless-autoinit", "Warning: superfluous `autoinit` on attribute.")
+                       end
+               else if atabstract != null then
+                       # By default, abstract attribute are not autoinit
+                       noinit = true
+               end
        end
 
        redef fun build_signature(modelbuilder)
@@ -1359,6 +1381,8 @@ redef class AAttrPropdef
                        return
                end
 
+               self.mtype = mtype
+
                if mpropdef != null then
                        mpropdef.static_mtype = mtype
                end
@@ -1389,7 +1413,7 @@ redef class AAttrPropdef
                var mpropdef = self.mpropdef
                if mpropdef == null then return # Error thus skipped
                var ntype = self.n_type
-               var mtype = self.mpropdef.static_mtype
+               var mtype = self.mtype
                if mtype == null then return # Error thus skipped
 
                var mclassdef = mpropdef.mclassdef
index d81d1c7..9010dde 100644 (file)
@@ -359,7 +359,7 @@ class RapidTypeAnalysis
                        for npropdef in modelbuilder.collect_attr_propdef(cd) do
                                if not npropdef.has_value then continue
 
-                               var mpropdef = npropdef.mpropdef.as(not null)
+                               var mpropdef = npropdef.mreadpropdef.as(not null)
                                var v = new RapidTypeVisitor(self, bound_mtype, mpropdef)
                                v.enter_visit(npropdef.n_expr)
                                v.enter_visit(npropdef.n_block)
index 31cc4b0..b37e4a4 100644 (file)
@@ -760,15 +760,15 @@ redef class AAttrPropdef
        do
                if not has_value then return
 
-               var mpropdef = self.mpropdef
-               if mpropdef == null then return # skip error
+               var mpropdef = self.mreadpropdef
+               if mpropdef == null or mpropdef.msignature == null then return # skip error
 
                var v = new TypeVisitor(modelbuilder, mpropdef.mclassdef.mmodule, mpropdef)
                self.selfvariable = v.selfvariable
 
                var nexpr = self.n_expr
                if nexpr != null then
-                       var mtype = self.mpropdef.static_mtype
+                       var mtype = self.mtype
                        v.visit_expr_subtype(nexpr, mtype)
                end
                var nblock = self.n_block
index b8f02dc..1b88711 100644 (file)
@@ -31,9 +31,15 @@ end
 class C
        super B
        redef fun foo: Int do return 100
-       redef fun bar=(i: Int) do i.output
+       redef fun bar=(i: Int) do
+               super
+               i.output
+       end
        redef fun baz: Int do return 400
-       redef fun baz=(i: Int) do i.output
+       redef fun baz=(i: Int) do
+               super
+               i.output
+       end
 end
 
 var a = new A
index 34c1e4c..d4b07a7 100644 (file)
 
 import kernel
 
-interface Foo
+class Foo
        var a: Object is abstract
-       #alt1#var b = 1 is abstract
-       #alt2#var b is abstract, noautoinit
+       var b: Object = 10 is abstract
+       #alt1#var b is abstract, noautoinit
+       #alt1#var c = 1 is abstract, lazy
+       #alt1#var d = 1 is abstract, autoinit
+       #alt1#var e = 1 is abstract, readonly
 end
 
 class Bar
        super Foo
        redef var a
+       redef var b is noinit
 end
 
 class Baz
        super Foo
-       redef fun a do return 100
-       redef fun a=(x) do (101).output
-end
-
-class FooBar
-       super Foo
+       redef fun a do return 100 #alt2#
+       redef fun a=(x) do (101).output #alt3#
+       redef fun b do return 200 #alt4#
+       redef fun b=(x) do (201).output #alt5#
 end
 
 var f: Foo = new Bar(1)
@@ -40,11 +42,21 @@ f.a.output
 f.a = 2
 f.a.output
 
+'\n'.output
+
+f.b.output
+f.b = 20
+f.b.output
+
+'\n'.output
+
 f = new Baz
 f.a.output
 f.a = 3
 f.a.output
 
-f = new FooBar
-#alt3#f.a.output
-#alt4#f.a = 4
+'\n'.output
+
+f.b.output
+f.b = 30
+f.b.output
index 931f334..0a5b8e9 100644 (file)
@@ -16,7 +16,7 @@ import standard::kernel
 
 abstract class A
        var x: Int
-       var y: Int is abstract
+       var y: Int is abstract, autoinit
 end
 
 class B
diff --git a/tests/base_attr_abstract3.nit b/tests/base_attr_abstract3.nit
new file mode 100644 (file)
index 0000000..d67a45f
--- /dev/null
@@ -0,0 +1,76 @@
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import standard::kernel
+
+interface A
+       var i: Int is abstract, autoinit
+       fun j: Int is abstract, autoinit
+       fun j=(o: Int) is abstract, autoinit
+end
+
+class B
+       super A
+       var k: Int is abstract, autoinit
+       fun l: Int is abstract, autoinit
+       fun l=(o: Int) is abstract, autoinit
+end
+
+class C
+       super B
+       redef fun i do
+               'i'.output
+               return 1
+       end
+       redef fun i=(o) do
+               'i'.output
+               '='.output
+               o.output
+       end
+       redef fun j do
+               'j'.output
+               return 2
+       end
+       redef fun j=(o) do
+               'j'.output
+               '='.output
+               o.output
+       end
+       redef fun k do
+               'k'.output
+               return 3
+       end
+       redef fun k=(o)
+       do
+               'k'.output
+               '='.output
+               o.output
+       end
+       redef fun l do
+               'l'.output
+               return 4
+       end
+       redef fun l=(o) do
+               'l'.output
+               '='.output
+               o.output
+       end
+end
+
+var c = new C(10,20,30,40)
+'\n'.output
+c.i.output
+c.j.output
+c.k.output
+c.l.output
diff --git a/tests/base_attr_abstract4.nit b/tests/base_attr_abstract4.nit
new file mode 100644 (file)
index 0000000..876b85a
--- /dev/null
@@ -0,0 +1,75 @@
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import standard::kernel
+
+interface A
+       var i: Int is abstract
+       fun j: Int is abstract
+       fun j=(o: Int) is abstract
+end
+
+class B
+       super A
+       var k: Int is abstract
+       fun l: Int is abstract
+       fun l=(o: Int) is abstract
+end
+
+class C
+       super B
+       redef fun i do
+               'i'.output
+               return 1
+       end
+       redef fun i=(o) do
+               'i'.output
+               '='.output
+               o.output
+       end
+       redef fun j do
+               'j'.output
+               return 2
+       end
+       redef fun j=(o) do
+               'j'.output
+               '='.output
+               o.output
+       end
+       redef fun k do
+               'k'.output
+               return 3
+       end
+       redef fun k=(o)
+       do
+               'k'.output
+               '='.output
+               o.output
+       end
+       redef fun l do
+               'l'.output
+               return 4
+       end
+       redef fun l=(o) do
+               'l'.output
+               '='.output
+               o.output
+       end
+end
+
+var c = new C
+c.i.output
+c.j.output
+c.k.output
+c.l.output
diff --git a/tests/base_attr_annot.nit b/tests/base_attr_annot.nit
new file mode 100644 (file)
index 0000000..17f7076
--- /dev/null
@@ -0,0 +1,34 @@
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import standard::kernel
+
+class A
+       var a: Object is
+               #alt2# noautoinit
+               #alt3# autoinit
+               #alt4# lazy
+               #alt5# readonly
+               #alt6# abstract
+               #alt7# lateinit
+               writable
+       end #1alt1# do return 1
+end
+
+class B
+       super A
+end
+
+var b = new B(1) #alt1,2,4,5,6,7# var b = new B
+b.a.output
diff --git a/tests/base_init_setter.nit b/tests/base_init_setter.nit
new file mode 100644 (file)
index 0000000..52a4c94
--- /dev/null
@@ -0,0 +1,37 @@
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import standard::kernel
+
+class A
+       var i: Int = 1
+end
+
+class B
+       super A
+       redef fun i=(v)
+       do
+               super
+               'i'.output
+               v.output
+       end
+end
+
+var a = new A
+a.i.output
+
+'\n'.output
+
+var b = new B
+b.i.output
index 635a8c2..3278c31 100644 (file)
@@ -9,6 +9,6 @@
 
 100
 200
-30
+200
 300
 400
index 5d77e90..2fa9ce5 100644 (file)
@@ -1 +1 @@
-alt/base_attr4_alt1.nit:40,3--5: Error: method `foo=` does not exists in `A`.
+alt/base_attr4_alt1.nit:46,3--5: Error: method `foo=` does not exists in `A`.
index 30b0f43..2f0440d 100644 (file)
@@ -1 +1 @@
-alt/base_attr4_alt2.nit:43,3--5: Error: method `bar` does not exists in `A`.
+alt/base_attr4_alt2.nit:49,3--5: Error: method `bar` does not exists in `A`.
index 36f0f1a..fa5258d 100644 (file)
@@ -1,5 +1,3 @@
-1
-2
-100
-101
-100
+base_attr_abstract.nit:19,24--31: Error: `abstract` attributes cannot have an initial value.
+base_attr_abstract.nit:37,12--13: Error: no property `Baz::b=` is inherited. Remove the `redef` keyword to define a new property.
+base_attr_abstract.nit:37,15: Error: untyped parameter `x'.
diff --git a/tests/sav/base_attr_abstract3.res b/tests/sav/base_attr_abstract3.res
new file mode 100644 (file)
index 0000000..d328d13
--- /dev/null
@@ -0,0 +1,9 @@
+i=10
+jj=20
+k=30
+ll=40
+
+i1
+j2
+k3
+l4
diff --git a/tests/sav/base_attr_abstract4.res b/tests/sav/base_attr_abstract4.res
new file mode 100644 (file)
index 0000000..4d4bee4
--- /dev/null
@@ -0,0 +1,4 @@
+i1
+j2
+k3
+l4
index 4b97e69..e3a1ef5 100644 (file)
@@ -1 +1,7 @@
-alt/base_attr_abstract_alt1.nit:19,15--22: Error: `abstract` attributes cannot have an initial value.
+alt/base_attr_abstract_alt1.nit:19,24--31: Error: `abstract` attributes cannot have an initial value.
+alt/base_attr_abstract_alt1.nit:20,6: Error: a property `b` is already defined in class `Foo` at line 19.
+alt/base_attr_abstract_alt1.nit:21,15--22: Error: `abstract` attributes cannot have an initial value.
+alt/base_attr_abstract_alt1.nit:22,15--22: Error: `abstract` attributes cannot have an initial value.
+alt/base_attr_abstract_alt1.nit:23,15--22: Error: `abstract` attributes cannot have an initial value.
+alt/base_attr_abstract_alt1.nit:37,12--13: Error: no property `Baz::b=` is inherited. Remove the `redef` keyword to define a new property.
+alt/base_attr_abstract_alt1.nit:37,15: Error: untyped parameter `x'.
index af3a672..f79bebd 100644 (file)
@@ -1,2 +1,3 @@
-alt/base_attr_abstract_alt2.nit:20,6: Error: untyped attribute `base_attr_abstract_alt2#Foo#b`.
-alt/base_attr_abstract_alt2.nit:20,21--30: Error: `noautoinit` attributes cannot be abstract.
+alt/base_attr_abstract_alt2.nit:19,24--31: Error: `abstract` attributes cannot have an initial value.
+alt/base_attr_abstract_alt2.nit:37,12--13: Error: no property `Baz::b=` is inherited. Remove the `redef` keyword to define a new property.
+alt/base_attr_abstract_alt2.nit:37,15: Error: untyped parameter `x'.
index 4052598..b112e42 100644 (file)
@@ -1,6 +1,3 @@
-Runtime error: Abstract method `a` called on `FooBar` (alt/base_attr_abstract_alt3.nit:18)
-1
-2
-100
-101
-100
+alt/base_attr_abstract_alt3.nit:19,24--31: Error: `abstract` attributes cannot have an initial value.
+alt/base_attr_abstract_alt3.nit:37,12--13: Error: no property `Baz::b=` is inherited. Remove the `redef` keyword to define a new property.
+alt/base_attr_abstract_alt3.nit:37,15: Error: untyped parameter `x'.
index 09d65f9..0d349af 100644 (file)
@@ -1,6 +1,3 @@
-Runtime error: Abstract method `a=` called on `FooBar` (alt/base_attr_abstract_alt4.nit:18)
-1
-2
-100
-101
-100
+alt/base_attr_abstract_alt4.nit:19,24--31: Error: `abstract` attributes cannot have an initial value.
+alt/base_attr_abstract_alt4.nit:37,12--13: Error: no property `Baz::b=` is inherited. Remove the `redef` keyword to define a new property.
+alt/base_attr_abstract_alt4.nit:37,15: Error: untyped parameter `x'.
diff --git a/tests/sav/base_attr_abstract_alt5.res b/tests/sav/base_attr_abstract_alt5.res
new file mode 100644 (file)
index 0000000..431493f
--- /dev/null
@@ -0,0 +1 @@
+alt/base_attr_abstract_alt5.nit:19,24--31: Error: `abstract` attributes cannot have an initial value.
diff --git a/tests/sav/base_attr_annot.res b/tests/sav/base_attr_annot.res
new file mode 100644 (file)
index 0000000..d00491f
--- /dev/null
@@ -0,0 +1 @@
+1
diff --git a/tests/sav/base_attr_annot_1alt1.res b/tests/sav/base_attr_annot_1alt1.res
new file mode 100644 (file)
index 0000000..4cd5256
--- /dev/null
@@ -0,0 +1 @@
+alt/base_attr_annot_1alt1.nit:33,9--11: Error: expected 0 argument(s) for `init`; got 1. See introduction at `standard::Object::init`.
diff --git a/tests/sav/base_attr_annot_1alt1_alt1.res b/tests/sav/base_attr_annot_1alt1_alt1.res
new file mode 100644 (file)
index 0000000..d00491f
--- /dev/null
@@ -0,0 +1 @@
+1
diff --git a/tests/sav/base_attr_annot_1alt1_alt2.res b/tests/sav/base_attr_annot_1alt1_alt2.res
new file mode 100644 (file)
index 0000000..225f15c
--- /dev/null
@@ -0,0 +1 @@
+alt/base_attr_annot_1alt1_alt2.nit:19,3--12: Error: `noautoinit` attributes cannot have an initial value.
diff --git a/tests/sav/base_attr_annot_1alt1_alt3.res b/tests/sav/base_attr_annot_1alt1_alt3.res
new file mode 100644 (file)
index 0000000..dac6bc0
--- /dev/null
@@ -0,0 +1 @@
+alt/base_attr_annot_1alt1_alt3.nit:19,3--20,10: Error: `autoinit` attributes cannot have an initial value.
diff --git a/tests/sav/base_attr_annot_1alt1_alt4.res b/tests/sav/base_attr_annot_1alt1_alt4.res
new file mode 100644 (file)
index 0000000..d00491f
--- /dev/null
@@ -0,0 +1 @@
+1
diff --git a/tests/sav/base_attr_annot_1alt1_alt5.res b/tests/sav/base_attr_annot_1alt1_alt5.res
new file mode 100644 (file)
index 0000000..d00491f
--- /dev/null
@@ -0,0 +1 @@
+1
diff --git a/tests/sav/base_attr_annot_1alt1_alt6.res b/tests/sav/base_attr_annot_1alt1_alt6.res
new file mode 100644 (file)
index 0000000..0bd4036
--- /dev/null
@@ -0,0 +1 @@
+alt/base_attr_annot_1alt1_alt6.nit:19,3--23,10: Error: `abstract` attributes cannot have an initial value.
diff --git a/tests/sav/base_attr_annot_1alt1_alt7.res b/tests/sav/base_attr_annot_1alt1_alt7.res
new file mode 100644 (file)
index 0000000..d00491f
--- /dev/null
@@ -0,0 +1 @@
+1
diff --git a/tests/sav/base_attr_annot_alt1.res b/tests/sav/base_attr_annot_alt1.res
new file mode 100644 (file)
index 0000000..0b649c6
--- /dev/null
@@ -0,0 +1 @@
+alt/base_attr_annot_alt1.nit:33,9--11: Error: expected 1 argument(s) for `init(a: Object)`; got 0. See introduction at `standard::Object::init`.
diff --git a/tests/sav/base_attr_annot_alt2.res b/tests/sav/base_attr_annot_alt2.res
new file mode 100644 (file)
index 0000000..1211ed7
--- /dev/null
@@ -0,0 +1 @@
+Runtime error: Uninitialized attribute _a (alt/base_attr_annot_alt2.nit:18)
diff --git a/tests/sav/base_attr_annot_alt3.res b/tests/sav/base_attr_annot_alt3.res
new file mode 100644 (file)
index 0000000..fdf9917
--- /dev/null
@@ -0,0 +1,2 @@
+alt/base_attr_annot_alt3.nit:19,3--20,10: Warning: superfluous `autoinit` on attribute.
+1
diff --git a/tests/sav/base_attr_annot_alt4.res b/tests/sav/base_attr_annot_alt4.res
new file mode 100644 (file)
index 0000000..c1a929e
--- /dev/null
@@ -0,0 +1 @@
+alt/base_attr_annot_alt4.nit:19,3--21,6: Error: `lazy` attributes need a value.
diff --git a/tests/sav/base_attr_annot_alt5.res b/tests/sav/base_attr_annot_alt5.res
new file mode 100644 (file)
index 0000000..21b6b60
--- /dev/null
@@ -0,0 +1 @@
+alt/base_attr_annot_alt5.nit:19,3--22,10: Error: `readonly` attributes need a value.
diff --git a/tests/sav/base_attr_annot_alt6.res b/tests/sav/base_attr_annot_alt6.res
new file mode 100644 (file)
index 0000000..a594cce
--- /dev/null
@@ -0,0 +1 @@
+Runtime error: Abstract method `a` called on `B` (alt/base_attr_annot_alt6.nit:18)
diff --git a/tests/sav/base_attr_annot_alt7.res b/tests/sav/base_attr_annot_alt7.res
new file mode 100644 (file)
index 0000000..75208d1
--- /dev/null
@@ -0,0 +1 @@
+alt/base_attr_annot_alt7.nit:19,3--24,10: Error: `lateinit` attributes need a value.
diff --git a/tests/sav/base_init_setter.res b/tests/sav/base_init_setter.res
new file mode 100644 (file)
index 0000000..a594e14
--- /dev/null
@@ -0,0 +1,3 @@
+1
+
+1
index 38a9af9..2fd90b2 100644 (file)
@@ -1 +1,12 @@
+../lib/standard/kernel.nit:24,1--95,3: Error: `kernel#Object` does not specialize `module_0#Object`. Possible duplication of the root class `Object`?
 ../lib/standard/kernel.nit:97,1--111,3: Error: `kernel#Sys` does not specialize `module_0#Object`. Possible duplication of the root class `Object`?
+../lib/standard/kernel.nit:124,1--182,3: Error: `kernel#Comparable` does not specialize `module_0#Object`. Possible duplication of the root class `Object`?
+../lib/standard/kernel.nit:184,1--221,3: Error: `kernel#Discrete` does not specialize `module_0#Object`. Possible duplication of the root class `Object`?
+../lib/standard/kernel.nit:223,1--240,3: Error: `kernel#Cloneable` does not specialize `module_0#Object`. Possible duplication of the root class `Object`?
+../lib/standard/kernel.nit:242,1--297,3: Error: `kernel#Numeric` does not specialize `module_0#Object`. Possible duplication of the root class `Object`?
+../lib/standard/kernel.nit:303,1--326,3: Error: `kernel#Bool` does not specialize `module_0#Object`. Possible duplication of the root class `Object`?
+../lib/standard/kernel.nit:328,1--410,3: Error: `kernel#Float` does not specialize `module_0#Object`. Possible duplication of the root class `Object`?
+../lib/standard/kernel.nit:412,1--514,3: Error: `kernel#Byte` does not specialize `module_0#Object`. Possible duplication of the root class `Object`?
+../lib/standard/kernel.nit:516,1--707,3: Error: `kernel#Int` does not specialize `module_0#Object`. Possible duplication of the root class `Object`?
+../lib/standard/kernel.nit:709,1--849,3: Error: `kernel#Char` does not specialize `module_0#Object`. Possible duplication of the root class `Object`?
+../lib/standard/kernel.nit:851,1--858,3: Error: `kernel#Pointer` does not specialize `module_0#Object`. Possible duplication of the root class `Object`?
diff --git a/tests/sav/niti/base_attr_annot_alt2.res b/tests/sav/niti/base_attr_annot_alt2.res
new file mode 100644 (file)
index 0000000..f51ab75
--- /dev/null
@@ -0,0 +1 @@
+Runtime error: Uninitialized attribute _a (alt/base_attr_annot_alt2.nit:34)