syntax: new-style attributes for those without underscore
authorJean Privat <jean@pryen.org>
Wed, 5 Jan 2011 08:18:41 +0000 (03:18 -0500)
committerJean Privat <jean@pryen.org>
Sat, 22 Jan 2011 03:12:43 +0000 (22:12 -0500)
A "new-style" attribute is not directly accessible.
Therefore it automatically comes with two accessors.

Signed-off-by: Jean Privat <jean@pryen.org>

36 files changed:
src/metamodel/inheritance.nit
src/syntax/mmbuilder.nit
tests/base_attr2.nit [new file with mode: 0644]
tests/base_attr3.nit [new file with mode: 0644]
tests/base_attr4.nit [new file with mode: 0644]
tests/base_attr5.nit [new file with mode: 0644]
tests/base_attr6.nit [new file with mode: 0644]
tests/sav/base_attr2.sav [new file with mode: 0644]
tests/sav/base_attr3.sav [new file with mode: 0644]
tests/sav/base_attr3_alt1.sav [new file with mode: 0644]
tests/sav/base_attr3_alt2.sav [new file with mode: 0644]
tests/sav/base_attr3_alt3.sav [new file with mode: 0644]
tests/sav/base_attr3_alt4.sav [new file with mode: 0644]
tests/sav/base_attr4.sav [new file with mode: 0644]
tests/sav/base_attr4_alt1.sav [new file with mode: 0644]
tests/sav/base_attr4_alt2.sav [new file with mode: 0644]
tests/sav/base_attr5.sav [new file with mode: 0644]
tests/sav/base_attr5_alt1.sav [new file with mode: 0644]
tests/sav/base_attr5_alt11.sav [new file with mode: 0644]
tests/sav/base_attr5_alt12.sav [new file with mode: 0644]
tests/sav/base_attr5_alt13.sav [new file with mode: 0644]
tests/sav/base_attr5_alt14.sav [new file with mode: 0644]
tests/sav/base_attr5_alt15.sav [new file with mode: 0644]
tests/sav/base_attr5_alt16.sav [new file with mode: 0644]
tests/sav/base_attr5_alt2.sav [new file with mode: 0644]
tests/sav/base_attr5_alt21.sav [new file with mode: 0644]
tests/sav/base_attr5_alt22.sav [new file with mode: 0644]
tests/sav/base_attr5_alt23.sav [new file with mode: 0644]
tests/sav/base_attr5_alt24.sav [new file with mode: 0644]
tests/sav/base_attr5_alt25.sav [new file with mode: 0644]
tests/sav/base_attr5_alt26.sav [new file with mode: 0644]
tests/sav/base_attr5_alt3.sav [new file with mode: 0644]
tests/sav/base_attr5_alt4.sav [new file with mode: 0644]
tests/sav/base_attr5_alt5.sav [new file with mode: 0644]
tests/sav/base_attr5_alt6.sav [new file with mode: 0644]
tests/sav/base_attr6.sav [new file with mode: 0644]

index 196ef85..ebc15fe 100644 (file)
@@ -129,6 +129,9 @@ redef class MMLocalClass
                                        continue
                                end
 
+                               # Do not inherit new style attributes
+                               if glob.intro.name.to_s[0] == '@' then continue
+
                                make_visible_an_inherited_global_property(glob)
                        end
                end
@@ -184,6 +187,7 @@ redef class MMLocalClass
                                var g = c.get_property_by_name(n)
                                if not set.has(g) then set.add(g)
                                if g.is_init and g.intro.local_class.global != global then continue
+                               if g.intro.name.to_s.first == '@' then continue # inherited new style attibutes are invisible
                                if nset.has(g) then continue
                                nset.add(g)
                        end
index 585c70c..a0ca58f 100644 (file)
@@ -921,20 +921,33 @@ redef class AAttrPropdef
        redef fun accept_property_builder(v)
        do
                super
-               var name = n_id.to_symbol
+               var name: Symbol
+               if n_id != null then
+                       name = n_id.to_symbol
+               else
+                       name = ("@" + n_id2.text).to_symbol
+               end
                var lc = v.local_class
                var prop = new MMSrcAttribute(name, lc, self)
                _prop = prop
                v.local_class.add_src_local_property(v, prop)
 
-               if n_readable != null then
-                       name = n_id.text.substring_from(1).to_symbol
+               if n_readable != null or n_id == null then
+                       if n_id != null then
+                               name = n_id.text.substring_from(1).to_symbol
+                       else
+                               name = n_id2.to_symbol
+                       end
                        var readmethod = new MMReadImplementationMethod(name, lc, self)
                        _readmethod = readmethod
                        v.local_class.add_src_local_property(v, readmethod)
                end
-               if n_writable != null then
-                       name = (n_id.text.substring_from(1) + "=").to_symbol
+               if n_writable != null or n_id == null then
+                       if n_id != null then
+                               name = (n_id.text.substring_from(1) + "=").to_symbol
+                       else
+                               name = (n_id2.text + "=").to_symbol
+                       end
                        var writemethod = new MMWriteImplementationMethod(name, lc, self)
                        _writemethod = writemethod
                        v.local_class.add_src_local_property(v, writemethod)
@@ -957,17 +970,21 @@ redef class AAttrPropdef
                var signature = new MMSignature(new Array[MMType], t, v.local_class.get_type)
                prop.signature = signature
                var visibility_level = n_visibility.level
-               process_and_check(v, prop, n_kwredef != null, visibility_level)
-               if n_readable != null then
+               process_and_check(v, prop, n_id != null and n_kwredef != null, visibility_level)
+               if n_readable != null or n_id == null then
                        var m = _readmethod.as(not null)
                        m.signature = signature
-                       process_and_check(v, m, n_readable.n_kwredef != null, visibility_level)
+                       process_and_check(v, m, (n_readable != null and n_readable.n_kwredef != null) or (n_id == null and n_kwredef != null), visibility_level)
                        n_type.check_visibility(v, m)
                end
-               if n_writable != null then
+               if n_writable != null or n_id == null then
                        var m = _writemethod.as(not null)
                        m.signature = new MMSignature(new Array[MMType].with_items(t), null, v.local_class.get_type)
-                       process_and_check(v, m, n_writable.n_kwredef != null, visibility_level)
+                       var vl = visibility_level
+                       if n_id == null then
+                               if n_writable == null then vl = 3 else vl = n_writable.n_visibility.level # write accessor has a specific visibility
+                       end
+                       process_and_check(v, m, n_writable != null and n_writable.n_kwredef != null, vl)
                        n_type.check_visibility(v, m)
                end
        end
diff --git a/tests/base_attr2.nit b/tests/base_attr2.nit
new file mode 100644 (file)
index 0000000..df439a1
--- /dev/null
@@ -0,0 +1,132 @@
+# 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 kernel
+
+class A
+       var a1: Object = self
+       protected var a2: Object = self
+       private var a3: Object = self
+
+       var a4: Object writable = self
+       protected var a5: Object writable = self
+       private var a6: Object writable = self
+
+       var a7: Object protected writable = self
+       protected var a8: Object protected writable = self
+       private var a9: Object protected writable = self
+
+       var a10: Object private writable = self
+       protected var a11: Object private writable = self
+       private var a12: Object private writable = self
+
+       var _cpt: Int = 0
+
+       redef fun output
+       do
+               _cpt += 1
+               _cpt.output
+       end
+
+       fun foo_a(a: A)
+       do
+               a1.output
+               a1 = a
+               a2.output
+               a2 = a
+               a3.output
+               a3 = a
+               a4.output
+               a4 = a
+               a5.output
+               a5 = a
+               a6.output
+               a6 = a
+               a7.output
+               a7 = a
+               a8.output
+               a8 = a
+               a9.output
+               a9 = a
+               a10.output
+               a10 = a
+               a11.output
+               a11 = a
+               a12.output
+               a12 = a
+
+               '\n'.output
+
+               a.a1.output
+               a.a1 = a
+               a.a2.output
+               a.a2 = a
+               a.a3.output
+               a.a3 = a
+               a.a4.output
+               a.a4 = a
+               a.a5.output
+               a.a5 = a
+               a.a6.output
+               a.a6 = a
+               a.a7.output
+               a.a7 = a
+               a.a8.output
+               a.a8 = a
+               a.a9.output
+               a.a9 = a
+               a.a10.output
+               a.a10 = a
+               a.a11.output
+               a.a11 = a
+               a.a12.output
+               a.a12 = a
+
+               '\n'.output
+       end
+end
+
+fun foo(a: A)
+do
+       a.a1.output
+       a.a1 = a
+       a.a2.output
+       a.a2 = a
+       a.a3.output
+       a.a3 = a
+       a.a4.output
+       a.a4 = a
+       a.a5.output
+       a.a5 = a
+       a.a6.output
+       a.a6 = a
+       a.a7.output
+       a.a7 = a
+       a.a8.output
+       a.a8 = a
+       a.a9.output
+       a.a9 = a
+       a.a10.output
+       a.a10 = a
+       a.a11.output
+       a.a11 = a
+       a.a12.output
+       a.a12 = a
+
+       '\n'.output
+end
+
+var a = new A
+a.foo_a(a)
+foo(a)
diff --git a/tests/base_attr3.nit b/tests/base_attr3.nit
new file mode 100644 (file)
index 0000000..8961423
--- /dev/null
@@ -0,0 +1,140 @@
+# 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 base_attr2
+
+class B
+special A
+       fun foo_b(a: A)
+       do
+               a1.output
+               #alt1#a1 = a
+               a2.output
+               #alt1#a2 = a
+               #alt1#a3.output
+               #alt1#a3 = a
+               a4.output
+               a4 = a
+               a5.output
+               a5 = a
+               #alt1#a6.output
+               a6 = a
+               a7.output
+               a7 = a
+               a8.output
+               a8 = a
+               #alt1#a9.output
+               a9 = a
+               a10.output
+               #alt1#a10 = a
+               a11.output
+               #alt1#a11 = a
+               #alt1#a12.output
+               #alt1#a12 = a
+
+               '\n'.output
+
+               a.a1.output
+               #alt2#a.a1 = a
+               #alt2#a.a2.output
+               #alt2#a.a2 = a
+               #alt2#a.a3.output
+               #alt2#a.a3 = a
+               a.a4.output
+               a.a4 = a
+               #alt2#a.a5.output
+               a.a5 = a
+               #alt2#a.a6.output
+               a.a6 = a
+               a.a7.output
+               #alt2#a.a7 = a
+               #alt2#a.a8.output
+               #alt2#a.a8 = a
+               #alt2#a.a9.output
+               #alt2#a.a9 = a
+               a.a10.output
+               #alt2#a.a10 = a
+               #alt2#a.a11.output
+               #alt2#a.a11 = a
+               #alt2#a.a12.output
+               #alt2#a.a12 = a
+
+               '\n'.output
+       end
+end
+
+fun foo2(a: A)
+do
+       a.a1.output
+       #alt3#a.a1 = a
+       #alt3#a.a2.output
+       #alt3#a.a2 = a
+       #alt3#a.a3.output
+       #alt3#a.a3 = a
+       a.a4.output
+       a.a4 = a
+       #alt3#a.a5.output
+       a.a5 = a
+       #alt3#a.a6.output
+       a.a6 = a
+       a.a7.output
+       #alt3#a.a7 = a
+       #alt3#a.a8.output
+       #alt3#a.a8 = a
+       #alt3#a.a9.output
+       #alt3#a.a9 = a
+       a.a10.output
+       #alt3#a.a10 = a
+       #alt3#a.a11.output
+       #alt3#a.a11 = a
+       #alt3#a.a12.output
+       #alt3#a.a12 = a
+
+       '\n'.output
+end
+
+fun foo3(a: B)
+do
+       a.a1.output
+       #alt4#a.a1 = a
+       #alt4#a.a2.output
+       #alt4#a.a2 = a
+       #alt4#a.a3.output
+       #alt4#a.a3 = a
+       a.a4.output
+       a.a4 = a
+       #alt4#a.a5.output
+       a.a5 = a
+       #alt4#a.a6.output
+       a.a6 = a
+       a.a7.output
+       #alt4#a.a7 = a
+       #alt4#a.a8.output
+       #alt4#a.a8 = a
+       #alt4#a.a9.output
+       #alt4#a.a9 = a
+       a.a10.output
+       #alt4#a.a10 = a
+       #alt4#a.a11.output
+       #alt4#a.a11 = a
+       #alt4#a.a12.output
+       #alt4#a.a12 = a
+
+       '\n'.output
+end
+
+var b = new B
+b.foo_b(b)
+foo2(b)
+foo3(b)
diff --git a/tests/base_attr4.nit b/tests/base_attr4.nit
new file mode 100644 (file)
index 0000000..7511824
--- /dev/null
@@ -0,0 +1,65 @@
+# 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 kernel
+
+class A
+       fun foo: Int do return 1
+       fun bar=(i: Int) do i.output
+       fun baz: Int do return 4
+       fun baz=(i: Int) do i.output
+end
+
+class B
+special A
+       redef var foo: Int = 20
+       var bar: Int redef writable = 30
+       redef var baz: Int redef writable = 40
+end
+
+class C
+special B
+       redef fun foo: Int do return 100
+       redef fun bar=(i: Int) do i.output
+       redef fun baz: Int do return 400
+       redef fun baz=(i: Int) do i.output
+end
+
+var a = new A
+#alt1#a.foo = 1
+a.foo.output
+a.bar = 2
+#alt2#a.bar.output
+a.baz = 3
+a.baz.output
+
+'\n'.output
+
+var b = new B
+b.foo = 10
+b.foo.output
+b.bar = 20
+b.bar.output
+b.baz = 30
+b.baz.output
+
+'\n'.output
+
+var c = new C
+c.foo = 100
+c.foo.output
+c.bar = 200
+c.bar.output
+c.baz = 300
+c.baz.output
diff --git a/tests/base_attr5.nit b/tests/base_attr5.nit
new file mode 100644 (file)
index 0000000..c20f718
--- /dev/null
@@ -0,0 +1,68 @@
+# 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 kernel
+
+class A
+       fun foo: Int do return 1
+       fun bar=(i: Int)
+       do
+               '#'.output
+               i.output
+       end
+       fun baz: Int do return 3
+       fun baz=(i: Int)
+       do
+               '#'.output
+               i.output
+       end
+end
+
+class B
+special A
+       #alt1#var foo: Int = 10
+       #alt2#redef var foo: Int = 10
+       #alt3#var foo: Int writable = 10
+       #alt4#redef var foo: Int writable = 10
+       #alt5#var foo: Int redef writable = 10
+       #alt6#redef var foo: Int redef writable = 10
+
+       #alt11#var bar: Int = 20
+       #alt12#redef var bar: Int = 20
+       #alt13#var bar: Int writable = 20
+       #alt14#redef var bar: Int writable = 20
+       #alt15#var bar: Int redef writable = 20
+       #alt16#redef var bar: Int redef writable = 20
+
+       #alt21#var baz: Int = 30
+       #alt22#redef var baz: Int = 30
+       #alt23#var baz: Int writable = 30
+       #alt24#redef var baz: Int writable = 30
+       #alt25#var baz: Int redef writable = 30
+       #alt26#redef var baz: Int redef writable = 30
+end
+
+var b = new B
+b.foo.output
+#alt2#b.foo = 100
+#alt4#b.foo = 100
+b.foo.output
+'\n'.output
+#alt15#b.bar.output
+b.bar = 200
+#alt15#b.bar.output
+'\n'.output
+b.baz.output
+b.baz = 300
+b.baz.output
diff --git a/tests/base_attr6.nit b/tests/base_attr6.nit
new file mode 100644 (file)
index 0000000..3945095
--- /dev/null
@@ -0,0 +1,58 @@
+# 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 kernel
+
+class A
+       var foo: Int = 1
+       var bar: Int = 2
+       var baz: Int = 3
+       var vaz: Int = 4
+end
+
+class B
+special A
+       redef fun foo: Int do return super + 10
+       redef fun bar=(i: Int)
+       do
+               '#'.output
+               i.output
+               super(i+20)
+       end
+       redef fun baz: Int do return super + 30
+       redef fun baz=(i: Int)
+       do
+               '#'.output
+               i.output
+               super(i+30)
+       end
+       redef var vaz: Int redef writable = 40
+end
+
+var b = new B
+b.foo.output
+b.foo = 100
+b.foo.output
+'\n'.output
+b.bar.output
+b.bar = 200
+b.bar.output
+'\n'.output
+b.baz.output
+b.baz = 300
+b.baz.output
+'\n'.output
+b.vaz.output
+b.vaz = 400
+b.vaz.output
diff --git a/tests/sav/base_attr2.sav b/tests/sav/base_attr2.sav
new file mode 100644 (file)
index 0000000..28e67f8
--- /dev/null
@@ -0,0 +1,39 @@
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+
diff --git a/tests/sav/base_attr3.sav b/tests/sav/base_attr3.sav
new file mode 100644 (file)
index 0000000..735c963
--- /dev/null
@@ -0,0 +1,24 @@
+1
+2
+3
+4
+5
+6
+7
+8
+
+9
+10
+11
+12
+
+13
+14
+15
+16
+
+17
+18
+19
+20
+
diff --git a/tests/sav/base_attr3_alt1.sav b/tests/sav/base_attr3_alt1.sav
new file mode 100644 (file)
index 0000000..bc181e7
--- /dev/null
@@ -0,0 +1,10 @@
+alt/base_attr3_alt1.nit:22,3--8: Visibility error: Property base_attr2::A::a1= is private.
+alt/base_attr3_alt1.nit:24,3--8: Visibility error: Property base_attr2::A::a2= is private.
+alt/base_attr3_alt1.nit:25,3--4: Visibility error: Property base_attr2::A::a3 is private.
+alt/base_attr3_alt1.nit:26,3--8: Visibility error: Property base_attr2::A::a3= is private.
+alt/base_attr3_alt1.nit:31,3--4: Visibility error: Property base_attr2::A::a6 is private.
+alt/base_attr3_alt1.nit:37,3--4: Visibility error: Property base_attr2::A::a9 is private.
+alt/base_attr3_alt1.nit:40,3--9: Visibility error: Property base_attr2::A::a10= is private.
+alt/base_attr3_alt1.nit:42,3--9: Visibility error: Property base_attr2::A::a11= is private.
+alt/base_attr3_alt1.nit:43,3--5: Visibility error: Property base_attr2::A::a12 is private.
+alt/base_attr3_alt1.nit:44,3--9: Visibility error: Property base_attr2::A::a12= is private.
diff --git a/tests/sav/base_attr3_alt2.sav b/tests/sav/base_attr3_alt2.sav
new file mode 100644 (file)
index 0000000..0e3677f
--- /dev/null
@@ -0,0 +1,17 @@
+alt/base_attr3_alt2.nit:49,3--10: Visibility error: Property base_attr2::A::a1= is private.
+alt/base_attr3_alt2.nit:50,3--6: Visibility error: Property base_attr2::A::a2 is protected and can only acceded by self.
+alt/base_attr3_alt2.nit:51,3--10: Visibility error: Property base_attr2::A::a2= is private.
+alt/base_attr3_alt2.nit:52,3--6: Visibility error: Property base_attr2::A::a3 is private.
+alt/base_attr3_alt2.nit:53,3--10: Visibility error: Property base_attr2::A::a3= is private.
+alt/base_attr3_alt2.nit:56,3--6: Visibility error: Property base_attr2::A::a5 is protected and can only acceded by self.
+alt/base_attr3_alt2.nit:58,3--6: Visibility error: Property base_attr2::A::a6 is private.
+alt/base_attr3_alt2.nit:61,3--10: Visibility error: Property base_attr2::A::a7= is protected and can only acceded by self.
+alt/base_attr3_alt2.nit:62,3--6: Visibility error: Property base_attr2::A::a8 is protected and can only acceded by self.
+alt/base_attr3_alt2.nit:63,3--10: Visibility error: Property base_attr2::A::a8= is protected and can only acceded by self.
+alt/base_attr3_alt2.nit:64,3--6: Visibility error: Property base_attr2::A::a9 is private.
+alt/base_attr3_alt2.nit:65,3--10: Visibility error: Property base_attr2::A::a9= is protected and can only acceded by self.
+alt/base_attr3_alt2.nit:67,3--11: Visibility error: Property base_attr2::A::a10= is private.
+alt/base_attr3_alt2.nit:68,3--7: Visibility error: Property base_attr2::A::a11 is protected and can only acceded by self.
+alt/base_attr3_alt2.nit:69,3--11: Visibility error: Property base_attr2::A::a11= is private.
+alt/base_attr3_alt2.nit:70,3--7: Visibility error: Property base_attr2::A::a12 is private.
+alt/base_attr3_alt2.nit:71,3--11: Visibility error: Property base_attr2::A::a12= is private.
diff --git a/tests/sav/base_attr3_alt3.sav b/tests/sav/base_attr3_alt3.sav
new file mode 100644 (file)
index 0000000..7ad1598
--- /dev/null
@@ -0,0 +1,17 @@
+alt/base_attr3_alt3.nit:80,2--9: Visibility error: Property base_attr2::A::a1= is private.
+alt/base_attr3_alt3.nit:81,2--5: Visibility error: Property base_attr2::A::a2 is protected and can only acceded by self.
+alt/base_attr3_alt3.nit:82,2--9: Visibility error: Property base_attr2::A::a2= is private.
+alt/base_attr3_alt3.nit:83,2--5: Visibility error: Property base_attr2::A::a3 is private.
+alt/base_attr3_alt3.nit:84,2--9: Visibility error: Property base_attr2::A::a3= is private.
+alt/base_attr3_alt3.nit:87,2--5: Visibility error: Property base_attr2::A::a5 is protected and can only acceded by self.
+alt/base_attr3_alt3.nit:89,2--5: Visibility error: Property base_attr2::A::a6 is private.
+alt/base_attr3_alt3.nit:92,2--9: Visibility error: Property base_attr2::A::a7= is protected and can only acceded by self.
+alt/base_attr3_alt3.nit:93,2--5: Visibility error: Property base_attr2::A::a8 is protected and can only acceded by self.
+alt/base_attr3_alt3.nit:94,2--9: Visibility error: Property base_attr2::A::a8= is protected and can only acceded by self.
+alt/base_attr3_alt3.nit:95,2--5: Visibility error: Property base_attr2::A::a9 is private.
+alt/base_attr3_alt3.nit:96,2--9: Visibility error: Property base_attr2::A::a9= is protected and can only acceded by self.
+alt/base_attr3_alt3.nit:98,2--10: Visibility error: Property base_attr2::A::a10= is private.
+alt/base_attr3_alt3.nit:99,2--6: Visibility error: Property base_attr2::A::a11 is protected and can only acceded by self.
+alt/base_attr3_alt3.nit:100,2--10: Visibility error: Property base_attr2::A::a11= is private.
+alt/base_attr3_alt3.nit:101,2--6: Visibility error: Property base_attr2::A::a12 is private.
+alt/base_attr3_alt3.nit:102,2--10: Visibility error: Property base_attr2::A::a12= is private.
diff --git a/tests/sav/base_attr3_alt4.sav b/tests/sav/base_attr3_alt4.sav
new file mode 100644 (file)
index 0000000..4b52598
--- /dev/null
@@ -0,0 +1,17 @@
+alt/base_attr3_alt4.nit:110,2--9: Visibility error: Property base_attr2::A::a1= is private.
+alt/base_attr3_alt4.nit:111,2--5: Visibility error: Property base_attr2::A::a2 is protected and can only acceded by self.
+alt/base_attr3_alt4.nit:112,2--9: Visibility error: Property base_attr2::A::a2= is private.
+alt/base_attr3_alt4.nit:113,2--5: Visibility error: Property base_attr2::A::a3 is private.
+alt/base_attr3_alt4.nit:114,2--9: Visibility error: Property base_attr2::A::a3= is private.
+alt/base_attr3_alt4.nit:117,2--5: Visibility error: Property base_attr2::A::a5 is protected and can only acceded by self.
+alt/base_attr3_alt4.nit:119,2--5: Visibility error: Property base_attr2::A::a6 is private.
+alt/base_attr3_alt4.nit:122,2--9: Visibility error: Property base_attr2::A::a7= is protected and can only acceded by self.
+alt/base_attr3_alt4.nit:123,2--5: Visibility error: Property base_attr2::A::a8 is protected and can only acceded by self.
+alt/base_attr3_alt4.nit:124,2--9: Visibility error: Property base_attr2::A::a8= is protected and can only acceded by self.
+alt/base_attr3_alt4.nit:125,2--5: Visibility error: Property base_attr2::A::a9 is private.
+alt/base_attr3_alt4.nit:126,2--9: Visibility error: Property base_attr2::A::a9= is protected and can only acceded by self.
+alt/base_attr3_alt4.nit:128,2--10: Visibility error: Property base_attr2::A::a10= is private.
+alt/base_attr3_alt4.nit:129,2--6: Visibility error: Property base_attr2::A::a11 is protected and can only acceded by self.
+alt/base_attr3_alt4.nit:130,2--10: Visibility error: Property base_attr2::A::a11= is private.
+alt/base_attr3_alt4.nit:131,2--6: Visibility error: Property base_attr2::A::a12 is private.
+alt/base_attr3_alt4.nit:132,2--10: Visibility error: Property base_attr2::A::a12= is private.
diff --git a/tests/sav/base_attr4.sav b/tests/sav/base_attr4.sav
new file mode 100644 (file)
index 0000000..635a8c2
--- /dev/null
@@ -0,0 +1,14 @@
+1
+2
+3
+4
+
+10
+20
+30
+
+100
+200
+30
+300
+400
diff --git a/tests/sav/base_attr4_alt1.sav b/tests/sav/base_attr4_alt1.sav
new file mode 100644 (file)
index 0000000..f936345
--- /dev/null
@@ -0,0 +1 @@
+alt/base_attr4_alt1.nit:40,1--9: Error: Method 'foo=' doesn't exists in A.
diff --git a/tests/sav/base_attr4_alt2.sav b/tests/sav/base_attr4_alt2.sav
new file mode 100644 (file)
index 0000000..56e09a6
--- /dev/null
@@ -0,0 +1 @@
+alt/base_attr4_alt2.nit:43,1--5: Error: Method 'bar' doesn't exists in A.
diff --git a/tests/sav/base_attr5.sav b/tests/sav/base_attr5.sav
new file mode 100644 (file)
index 0000000..d5fac5b
--- /dev/null
@@ -0,0 +1,8 @@
+1
+1
+
+#200
+
+3
+#300
+3
diff --git a/tests/sav/base_attr5_alt1.sav b/tests/sav/base_attr5_alt1.sav
new file mode 100644 (file)
index 0000000..e65b884
--- /dev/null
@@ -0,0 +1 @@
+alt/base_attr5_alt1.nit:34,2--18: Redef error: B::foo is an inherited property. To redefine it, add the redef keyword.
diff --git a/tests/sav/base_attr5_alt11.sav b/tests/sav/base_attr5_alt11.sav
new file mode 100644 (file)
index 0000000..346d578
--- /dev/null
@@ -0,0 +1 @@
+alt/base_attr5_alt11.nit:41,2--18: Redef error: B::bar= is an inherited property. To redefine it, add the redef keyword.
diff --git a/tests/sav/base_attr5_alt12.sav b/tests/sav/base_attr5_alt12.sav
new file mode 100644 (file)
index 0000000..4a7fad3
--- /dev/null
@@ -0,0 +1,2 @@
+alt/base_attr5_alt12.nit:41,2--42,24: Error: No property B::bar is inherited. Remove the redef keyword to define a new property.
+alt/base_attr5_alt12.nit:41,2--42,24: Redef error: B::bar= is an inherited property. To redefine it, add the redef keyword.
diff --git a/tests/sav/base_attr5_alt13.sav b/tests/sav/base_attr5_alt13.sav
new file mode 100644 (file)
index 0000000..55c9894
--- /dev/null
@@ -0,0 +1 @@
+alt/base_attr5_alt13.nit:41,2--43,27: Redef error: B::bar= is an inherited property. To redefine it, add the redef keyword.
diff --git a/tests/sav/base_attr5_alt14.sav b/tests/sav/base_attr5_alt14.sav
new file mode 100644 (file)
index 0000000..32b4ed4
--- /dev/null
@@ -0,0 +1,2 @@
+alt/base_attr5_alt14.nit:41,2--44,33: Error: No property B::bar is inherited. Remove the redef keyword to define a new property.
+alt/base_attr5_alt14.nit:41,2--44,33: Redef error: B::bar= is an inherited property. To redefine it, add the redef keyword.
diff --git a/tests/sav/base_attr5_alt15.sav b/tests/sav/base_attr5_alt15.sav
new file mode 100644 (file)
index 0000000..86fb0d1
--- /dev/null
@@ -0,0 +1,9 @@
+1
+1
+
+20
+200
+
+3
+#300
+3
diff --git a/tests/sav/base_attr5_alt16.sav b/tests/sav/base_attr5_alt16.sav
new file mode 100644 (file)
index 0000000..500c953
--- /dev/null
@@ -0,0 +1 @@
+alt/base_attr5_alt16.nit:41,2--46,39: Error: No property B::bar is inherited. Remove the redef keyword to define a new property.
diff --git a/tests/sav/base_attr5_alt2.sav b/tests/sav/base_attr5_alt2.sav
new file mode 100644 (file)
index 0000000..bc7c27c
--- /dev/null
@@ -0,0 +1,8 @@
+10
+100
+
+#200
+
+3
+#300
+3
diff --git a/tests/sav/base_attr5_alt21.sav b/tests/sav/base_attr5_alt21.sav
new file mode 100644 (file)
index 0000000..842b17e
--- /dev/null
@@ -0,0 +1,2 @@
+alt/base_attr5_alt21.nit:48,2--18: Redef error: B::baz is an inherited property. To redefine it, add the redef keyword.
+alt/base_attr5_alt21.nit:48,2--18: Redef error: B::baz= is an inherited property. To redefine it, add the redef keyword.
diff --git a/tests/sav/base_attr5_alt22.sav b/tests/sav/base_attr5_alt22.sav
new file mode 100644 (file)
index 0000000..cbc00dc
--- /dev/null
@@ -0,0 +1 @@
+alt/base_attr5_alt22.nit:48,2--49,24: Redef error: B::baz= is an inherited property. To redefine it, add the redef keyword.
diff --git a/tests/sav/base_attr5_alt23.sav b/tests/sav/base_attr5_alt23.sav
new file mode 100644 (file)
index 0000000..3ee67c0
--- /dev/null
@@ -0,0 +1,2 @@
+alt/base_attr5_alt23.nit:48,2--50,27: Redef error: B::baz is an inherited property. To redefine it, add the redef keyword.
+alt/base_attr5_alt23.nit:48,2--50,27: Redef error: B::baz= is an inherited property. To redefine it, add the redef keyword.
diff --git a/tests/sav/base_attr5_alt24.sav b/tests/sav/base_attr5_alt24.sav
new file mode 100644 (file)
index 0000000..33d26ec
--- /dev/null
@@ -0,0 +1 @@
+alt/base_attr5_alt24.nit:48,2--51,33: Redef error: B::baz= is an inherited property. To redefine it, add the redef keyword.
diff --git a/tests/sav/base_attr5_alt25.sav b/tests/sav/base_attr5_alt25.sav
new file mode 100644 (file)
index 0000000..79508d8
--- /dev/null
@@ -0,0 +1 @@
+alt/base_attr5_alt25.nit:48,2--52,33: Redef error: B::baz is an inherited property. To redefine it, add the redef keyword.
diff --git a/tests/sav/base_attr5_alt26.sav b/tests/sav/base_attr5_alt26.sav
new file mode 100644 (file)
index 0000000..38a4119
--- /dev/null
@@ -0,0 +1,7 @@
+1
+1
+
+#200
+
+30
+300
diff --git a/tests/sav/base_attr5_alt3.sav b/tests/sav/base_attr5_alt3.sav
new file mode 100644 (file)
index 0000000..b9792b5
--- /dev/null
@@ -0,0 +1 @@
+alt/base_attr5_alt3.nit:34,2--36,27: Redef error: B::foo is an inherited property. To redefine it, add the redef keyword.
diff --git a/tests/sav/base_attr5_alt4.sav b/tests/sav/base_attr5_alt4.sav
new file mode 100644 (file)
index 0000000..bc7c27c
--- /dev/null
@@ -0,0 +1,8 @@
+10
+100
+
+#200
+
+3
+#300
+3
diff --git a/tests/sav/base_attr5_alt5.sav b/tests/sav/base_attr5_alt5.sav
new file mode 100644 (file)
index 0000000..93e9b7d
--- /dev/null
@@ -0,0 +1,2 @@
+alt/base_attr5_alt5.nit:34,2--38,33: Redef error: B::foo is an inherited property. To redefine it, add the redef keyword.
+alt/base_attr5_alt5.nit:34,2--38,33: Error: No property B::foo= is inherited. Remove the redef keyword to define a new property.
diff --git a/tests/sav/base_attr5_alt6.sav b/tests/sav/base_attr5_alt6.sav
new file mode 100644 (file)
index 0000000..7756f12
--- /dev/null
@@ -0,0 +1 @@
+alt/base_attr5_alt6.nit:34,2--39,39: Error: No property B::foo= is inherited. Remove the redef keyword to define a new property.
diff --git a/tests/sav/base_attr6.sav b/tests/sav/base_attr6.sav
new file mode 100644 (file)
index 0000000..d24973c
--- /dev/null
@@ -0,0 +1,13 @@
+11
+110
+
+2
+#200
+220
+
+33
+#300
+360
+
+40
+400