Merge: toolcontext: new option -w to enable/disable warning
authorJean Privat <jean@pryen.org>
Tue, 30 Sep 2014 10:51:52 +0000 (06:51 -0400)
committerJean Privat <jean@pryen.org>
Tue, 30 Sep 2014 10:51:52 +0000 (06:51 -0400)
The `-w` option takes the name of a warning (displayed at the end of message, between parentheses) to activate it; and "no-{name}" to disable it. It has precedence over -q and -W.

To show only missing-doc warnings in standard
~~~sh
$ nitg -q -w missing-doc standard
~~~

To show all warnings and advices, except missing-doc
~~~sh
$ nitg -W -w no-missing-doc standard
~~~

To show standard warnings except useless-type-test, but not advice except missing-doc
~~~sh
$ nitg -w missing-doc -w no-useless-type-test standard
~~~

Pull-Request: #790
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>

59 files changed:
examples/clock.nit
lib/standard/collection/abstract_collection.nit
misc/jenkins/checklicense.sh
src/compiler/abstract_compiler.nit
src/compiler/separate_compiler.nit
src/doc/doc_model.nit
src/frontend/check_annotation.nit
src/highlight.nit
src/interpreter/naive_interpreter.nit
src/model/model.nit
src/model_utils.nit
src/modelize/modelize_class.nit
src/modelize/modelize_property.nit
src/neo.nit
src/nitx.nit
src/uml/uml_class.nit
src/uml/uml_module.nit
tests/base_gen_redef.nit [new file with mode: 0644]
tests/base_init_autoinit.nit [new file with mode: 0644]
tests/sav/base_as_notnull2.res
tests/sav/base_as_notnull2_alt1.res
tests/sav/base_as_notnull2_alt2.res
tests/sav/base_as_notnull2_alt3.res
tests/sav/base_autocast_alt1.res
tests/sav/base_covar_gen_1alt1_alt1.res
tests/sav/base_covar_gen_1alt1_alt2.res
tests/sav/base_covar_gen_alt3.res
tests/sav/base_covar_gen_alt4.res
tests/sav/base_gen_bound_alt1.res
tests/sav/base_gen_bound_alt2.res
tests/sav/base_gen_bound_alt3.res
tests/sav/base_gen_bound_alt4.res
tests/sav/base_gen_reassign_alt1.res
tests/sav/base_gen_reassign_alt2.res
tests/sav/base_gen_reassign_alt4.res
tests/sav/base_gen_reassign_alt5.res
tests/sav/base_gen_reassign_alt6.res
tests/sav/base_gen_redef.res [new file with mode: 0644]
tests/sav/base_gen_redef_alt1.res [new file with mode: 0644]
tests/sav/base_gen_redef_alt2.res [new file with mode: 0644]
tests/sav/base_gen_redef_alt3.res [new file with mode: 0644]
tests/sav/base_gen_variance2_alt1.res
tests/sav/base_gen_variance2_alt2.res
tests/sav/base_gen_variance3_alt1.res
tests/sav/base_gen_variance_alt3.res
tests/sav/base_gen_variance_alt6.res
tests/sav/base_gen_variance_alt8.res
tests/sav/base_gen_variance_int_alt1.res
tests/sav/base_init_autoinit.res [new file with mode: 0644]
tests/sav/base_init_autoinit_alt1.res [new file with mode: 0644]
tests/sav/base_isa_vt_gen1.res
tests/sav/error_class_generic_alt1.res
tests/sav/error_class_generic_alt3.res
tests/sav/error_class_generic_alt6.res
tests/sav/error_inh_clash4.res
tests/sav/test_multiconstraint_inh.res
tests/sav/test_new_native_alt1.res
tests/sav/test_paire.res
tests/test_paire.nit

index 8fdb9ab..811392b 100644 (file)
@@ -20,7 +20,7 @@ module clock
 # A simple wall clock with 60 minutes and 12 hours.
 class Clock
        # total number of minutes from 0 to 719
-       var total_minutes: Int
+       var total_minutes: Int is noinit
        # Note: only the read acces is public, the write access is private.
 
        # number of minutes in the current hour (from 0 to 59)
@@ -46,9 +46,7 @@ class Clock
 
        redef fun to_s do return "{hours}:{minutes}"
 
-       fun reset(hours, minutes: Int) do self.total_minutes = hours*60 + minutes
-
-       init(hours, minutes: Int) do self.reset(hours, minutes)
+       fun reset(hours, minutes: Int) is autoinit do self.total_minutes = hours*60 + minutes
 
        redef fun ==(o)
        do
index 7320e83..d2cdb2c 100644 (file)
@@ -333,7 +333,7 @@ interface Set[E: Object]
 end
 
 # MapRead are abstract associative collections: `key` -> `item`.
-interface MapRead[K: Object, E]
+interface MapRead[K: Object, V]
        # Get the item at `key`
        #
        #     var x = new HashMap[String, Int]
@@ -343,7 +343,7 @@ interface MapRead[K: Object, E]
        #
        # If the key is not in the map, `provide_default_value` is called (that aborts by default)
        # See `get_or_null` and `get_or_default` for safe variations.
-       fun [](key: K): E is abstract
+       fun [](key: K): V is abstract
 
        # Get the item at `key` or null if `key` is not in the map.
        #
@@ -352,8 +352,8 @@ interface MapRead[K: Object, E]
        #     assert x.get_or_null("four") == 4
        #     assert x.get_or_null("five") == null
        #
-       # Note: use `has_key` and `[]` if you need the distinction bewteen a key associated with null, and no key.
-       fun get_or_null(key: K): nullable E
+       # Note: use `has_key` and `[]` if you need the distinction between a key associated with null, and no key.
+       fun get_or_null(key: K): nullable V
        do
                if has_key(key) then return self[key]
                return null
@@ -366,17 +366,17 @@ interface MapRead[K: Object, E]
        #     assert x.get_or_default("four", 40) == 4
        #     assert x.get_or_default("five", 50) == 50
        #
-       fun get_or_default(key: K, default: E): E
+       fun get_or_default(key: K, default: V): V
        do
                if has_key(key) then return self[key]
                return default
        end
 
-       # Depreciated alias for `keys.has`
+       # Alias for `keys.has`
        fun has_key(key: K): Bool do return self.keys.has(key)
 
        # Get a new iterator on the map.
-       fun iterator: MapIterator[K, E] is abstract
+       fun iterator: MapIterator[K, V] is abstract
 
        # Return the point of view of self on the values only.
        # Note that `self` and `values` are views on the same data;
@@ -386,7 +386,7 @@ interface MapRead[K: Object, E]
        #     x["four"] = 4
        #     assert x.values.has(4) == true
        #     assert x.values.has(5) == false
-       fun values: Collection[E] is abstract
+       fun values: Collection[V] is abstract
 
        # Return the point of view of self on the keys only.
        # Note that `self` and `keys` are views on the same data;
@@ -421,7 +421,7 @@ interface MapRead[K: Object, E]
        #
        # Note: the value is returned *as is*, implementations may want to store the value in the map before returning it
        # @toimplement
-       protected fun provide_default_value(key: K): E do abort
+       protected fun provide_default_value(key: K): V do abort
 end
 
 # Maps are associative collections: `key` -> `item`.
@@ -448,8 +448,8 @@ end
 #     assert map.values.has(1)      ==  true
 #     assert map.values.has(3)      ==  false
 #
-interface Map[K: Object, E]
-       super MapRead[K, E]
+interface Map[K: Object, V]
+       super MapRead[K, V]
 
        # Set the `value` at `key`.
        #
@@ -459,14 +459,14 @@ interface Map[K: Object, E]
        #     x["four"] = 4
        #     assert x["four"]   == 4
        #
-       # If the key was associated with a value, this old value is discarted
+       # If the key was associated with a value, this old value is discarded
        # and replaced with the new one.
        #
        #     x["four"] = 40
        #     assert x["four"]         == 40
        #     assert x.values.has(4)   == false
        #
-       fun []=(key: K, value: E) is abstract
+       fun []=(key: K, value: V) is abstract
 
        # Add each (key,value) of `map` into `self`.
        # If a same key exists in `map` and `self`, then the value in self is discarded.
@@ -483,7 +483,7 @@ interface Map[K: Object, E]
        #     assert x["four"]  == 40
        #     assert x["five"]  == 5
        #     assert x["nine"]  == 90
-       fun recover_with(map: Map[K, E])
+       fun recover_with(map: MapRead[K, V])
        do
                var i = map.iterator
                while i.is_ok do
@@ -502,16 +502,16 @@ interface Map[K: Object, E]
        # ENSURE `is_empty`
        fun clear is abstract
 
-       redef fun values: RemovableCollection[E] is abstract
+       redef fun values: RemovableCollection[V] is abstract
 
        redef fun keys: RemovableCollection[K] is abstract
 end
 
 # Iterators for Map.
-interface MapIterator[K: Object, E]
+interface MapIterator[K: Object, V]
        # The current item.
        # Require `is_ok`.
-       fun item: E is abstract
+       fun item: V is abstract
 
        # The key of the current item.
        # Require `is_ok`.
@@ -887,18 +887,18 @@ end
 
 # Associative arrays that internally uses couples to represent each (key, value) pairs.
 # This is an helper class that some specific implementation of Map may implements.
-interface CoupleMap[K: Object, E]
-       super Map[K, E]
+interface CoupleMap[K: Object, V]
+       super Map[K, V]
 
        # Return the couple of the corresponding key
        # Return null if the key is no associated element
-       protected fun couple_at(key: K): nullable Couple[K, E] is abstract
+       protected fun couple_at(key: K): nullable Couple[K, V] is abstract
 
        # Return a new iteralot on all couples
        # Used to provide `iterator` and others
-       protected fun couple_iterator: Iterator[Couple[K,E]] is abstract
+       protected fun couple_iterator: Iterator[Couple[K,V]] is abstract
 
-       redef fun iterator do return new CoupleMapIterator[K,E](couple_iterator)
+       redef fun iterator do return new CoupleMapIterator[K,V](couple_iterator)
 
        redef fun [](key)
        do
@@ -914,8 +914,8 @@ end
 # Iterator on CoupleMap
 #
 # Actually it is a wrapper around an iterator of the internal array of the map.
-private class CoupleMapIterator[K: Object, E]
-       super MapIterator[K, E]
+private class CoupleMapIterator[K: Object, V]
+       super MapIterator[K, V]
        redef fun item do return _iter.item.second
        
        #redef fun item=(e) do _iter.item.second = e
@@ -929,9 +929,9 @@ private class CoupleMapIterator[K: Object, E]
                _iter.next
        end
 
-       private var iter: Iterator[Couple[K,E]]
+       private var iter: Iterator[Couple[K,V]]
 
-       init(i: Iterator[Couple[K,E]]) do _iter = i
+       init(i: Iterator[Couple[K,V]]) do _iter = i
 end
 
 # Some tools ###################################################################
index 3a28ae4..3fcd8af 100755 (executable)
@@ -13,7 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# Check missing signed-off-by in commits
+# Check missing "This file is part of NIT…" comment in committed scripts.
 
 if test "$#" -lt 2; then
        echo "Usage: checklicense from to"
@@ -28,5 +28,5 @@ err=0
 
 git diff --name-status $from..$to -- "*.nit" "*.sh" | sed -n 's/^A\s*//p' > checklicense_new_files.out
 test -s checklicense_new_files.out || exit 0
-grep -L 'his file is part of NIT' `cat checklicense_new_files.out` 2>/dev/null | tee checklicense_missing.out
+grep -L '\(^\|\b\)# [Tt]his file is part of NIT ' `cat checklicense_new_files.out` 2>/dev/null | tee checklicense_missing.out
 test \! -s checklicense_missing.out
index 5251f34..2efd979 100644 (file)
@@ -330,7 +330,7 @@ class MakefileToolchain
 
                var outname = outfile(mainmodule)
 
-               var orig_dir=".." # FIXME only works if `compile_dir` is a subdirectory of cwd
+               var orig_dir = compile_dir.relpath(".")
                var outpath = orig_dir.join_path(outname).simplify_path
                var makename = makefile_name(mainmodule)
                var makepath = "{compile_dir}/{makename}"
@@ -1053,16 +1053,21 @@ abstract class AbstractCompilerVisitor
                if not initializers.is_empty then
                        var recv = arguments.first
 
-                       assert initializers.length == arguments.length - 1 else debug("expected {initializers.length}, got {arguments.length - 1}")
                        var i = 1
                        for p in initializers do
                                if p isa MMethod then
-                                       self.send(p, [recv, arguments[i]])
+                                       var args = [recv]
+                                       for x in p.intro.msignature.mparameters do
+                                               args.add arguments[i]
+                                               i += 1
+                                       end
+                                       self.send(p, args)
                                else if p isa MAttribute then
                                        self.write_attribute(p, recv, arguments[i])
+                                       i += 1
                                else abort
-                               i += 1
                        end
+                       assert i == arguments.length
 
                        return self.send(callsite.mproperty, [recv])
                end
index 84bc443..8c400f9 100644 (file)
@@ -1762,7 +1762,7 @@ class SeparateCompilerVisitor
        redef fun calloc_array(ret_type, arguments)
        do
                var mclass = self.get_class("ArrayCapable")
-               var ft = mclass.mclass_type.arguments.first.as(MParameterType)
+               var ft = mclass.mparameters.first
                var res = self.native_array_instance(ft, arguments[1])
                self.ret(res)
        end
index 5d666c8..f13d69f 100644 (file)
@@ -291,7 +291,11 @@ redef class MClass
                var tpl = new Template
                if arity > 0 then
                        tpl.add "["
-                       tpl.add intro.parameter_names.join(", ")
+                       var parameter_names = new Array[String]
+                       for p in mparameters do
+                               parameter_names.add(p.name)
+                       end
+                       tpl.add parameter_names.join(", ")
                        tpl.add "]"
                end
                return tpl
@@ -353,12 +357,13 @@ redef class MClassDef
 
        fun tpl_signature: Template do
                var tpl = new Template
-               if not parameter_names.is_empty then
+               var mparameters = mclass.mparameters
+               if not mparameters.is_empty then
                        tpl.add "["
-                       for i in [0..parameter_names.length[ do
-                               tpl.add "{parameter_names[i]}: "
+                       for i in [0..mparameters.length[ do
+                               tpl.add "{mparameters[i].name}: "
                                tpl.add bound_mtype.arguments[i].tpl_signature
-                               if i < parameter_names.length - 1 then tpl.add ", "
+                               if i < mparameters.length - 1 then tpl.add ", "
                        end
                        tpl.add "]"
                end
@@ -638,7 +643,6 @@ end
 
 redef class MParameterType
        redef fun tpl_link do
-               var name = mclass.intro.parameter_names[rank]
                return new TplLink.with_title("{mclass.nitdoc_url}#FT_{name}", name, "formal type")
        end
        redef fun tpl_signature do return tpl_link
index 41abe43..7cd186e 100644 (file)
@@ -81,6 +81,7 @@ lazy
 noinit
 readonly
 writable
+autoinit
 cached
 nosuper
 old_style_init
index 4922a79..06075b4 100644 (file)
@@ -473,13 +473,11 @@ redef class MParameterType
        redef fun infobox(v)
        do
                var res = new HInfoBox(v, to_s)
-               var name = mclass.intro.parameter_names[rank]
                res.new_field("parameter type").append("{name} from class ").add mclass.intro.linkto
                return res
        end
        redef fun linkto
        do
-               var name = mclass.intro.parameter_names[rank]
                return (new HTMLTag("span")).text(name)
        end
 end
index d4c9173..5b79f0c 100644 (file)
@@ -407,18 +407,24 @@ private class NaiveInterpreter
        do
                var initializers = callsite.mpropdef.initializers
                if not initializers.is_empty then
-                       assert initializers.length == arguments.length - 1 else debug("expected {initializers.length} got {arguments.length - 1}")
                        var recv = arguments.first
                        var i = 1
                        for p in initializers do
                                if p isa MMethod then
-                                       self.send(p, [recv, arguments[i]])
+                                       var args = [recv]
+                                       for x in p.intro.msignature.mparameters do
+                                               args.add arguments[i]
+                                               i += 1
+                                       end
+                                       self.send(p, args)
                                else if p isa MAttribute then
                                        assert recv isa MutableInstance
                                        recv.attributes[p] = arguments[i]
+                                       i += 1
                                else abort
-                               i += 1
                        end
+                       assert i == arguments.length
+
                        return send(callsite.mproperty, [recv])
                end
                return send(callsite.mproperty, arguments)
index e0d941a..0174f93 100644 (file)
@@ -250,8 +250,8 @@ redef class MModule
                var cla = self.model.get_mclasses_by_name(name)
                if cla == null then
                        if name == "Bool" then
-                               var c = new MClass(self, name, 0, enum_kind, public_visibility)
-                               var cladef = new MClassDef(self, c.mclass_type, new Location(null, 0,0,0,0), new Array[String])
+                               var c = new MClass(self, name, null, enum_kind, public_visibility)
+                               var cladef = new MClassDef(self, c.mclass_type, new Location(null, 0,0,0,0))
                                return c
                        end
                        print("Fatal Error: no primitive class {name}")
@@ -360,6 +360,10 @@ class MClass
        # 0 if the class is not generic
        var arity: Int
 
+       # Each generic formal parameters in order.
+       # is empty if the class is not generic
+       var mparameters = new Array[MParameterType]
+
        # The kind of the class (interface, abstract class, etc.)
        # In Nit, the kind of a class cannot evolve in refinements
        var kind: MClassKind
@@ -368,11 +372,15 @@ class MClass
        # In Nit, the visibility of a class cannot evolve in refinements
        var visibility: MVisibility
 
-       init(intro_mmodule: MModule, name: String, arity: Int, kind: MClassKind, visibility: MVisibility)
+       init(intro_mmodule: MModule, name: String, parameter_names: nullable Array[String], kind: MClassKind, visibility: MVisibility)
        do
                self.intro_mmodule = intro_mmodule
                self.name = name
-               self.arity = arity
+               if parameter_names == null then
+                       self.arity = 0
+               else
+                       self.arity = parameter_names.length
+               end
                self.kind = kind
                self.visibility = visibility
                intro_mmodule.intro_mclasses.add(self)
@@ -382,11 +390,13 @@ class MClass
 
                # Create the formal parameter types
                if arity > 0 then
+                       assert parameter_names != null
                        var mparametertypes = new Array[MParameterType]
                        for i in [0..arity[ do
-                               var mparametertype = new MParameterType(self, i)
+                               var mparametertype = new MParameterType(self, i, parameter_names[i])
                                mparametertypes.add(mparametertype)
                        end
+                       self.mparameters = mparametertypes
                        var mclass_type = new MGenericType(self, mparametertypes)
                        self.mclass_type = mclass_type
                        self.get_mtype_cache.add(mclass_type)
@@ -494,9 +504,6 @@ class MClassDef
        # ENSURE: `bound_mtype.mclass == self.mclass`
        var bound_mtype: MClassType
 
-       # Name of each formal generic parameter (in order of declaration)
-       var parameter_names: Array[String]
-
        # The origin of the definition
        var location: Location
 
@@ -504,16 +511,14 @@ class MClassDef
        # Example: "mymodule#MyClass"
        redef var to_s: String
 
-       init(mmodule: MModule, bound_mtype: MClassType, location: Location, parameter_names: Array[String])
+       init(mmodule: MModule, bound_mtype: MClassType, location: Location)
        do
-               assert bound_mtype.mclass.arity == parameter_names.length
                self.bound_mtype = bound_mtype
                self.mmodule = mmodule
                self.mclass = bound_mtype.mclass
                self.location = location
                mmodule.mclassdefs.add(self)
                mclass.mclassdefs.add(self)
-               self.parameter_names = parameter_names
                self.to_s = "{mmodule}#{mclass}"
        end
 
@@ -1279,12 +1284,9 @@ class MParameterType
        # FIXME: is `position` a better name?
        var rank: Int
 
-       # Internal name of the parameter type
-       # Names of parameter types changes in each class definition
-       # Therefore, this method return an internal name.
-       # Example: return "G#1" for the second parameter of the class G
-       # FIXME: add a way to get the real name in a classdef
-       redef fun to_s do return "{mclass}#{rank}"
+       redef var name
+
+       redef fun to_s do return name
 
        # Resolve the bound for a given resolved_receiver
        # The result may be a other virtual type (or a parameter type)
@@ -1369,10 +1371,11 @@ class MParameterType
                return mtype.collect_mclassdefs(mmodule).has(mclass.intro)
        end
 
-       init(mclass: MClass, rank: Int)
+       init(mclass: MClass, rank: Int, name: String)
        do
                self.mclass = mclass
                self.rank = rank
+               self.name = name
        end
 end
 
index f184eec..ff1a8d9 100644 (file)
@@ -417,8 +417,8 @@ redef class MClass
        # Get the list of all parameter types in 'self'.
        fun parameter_types: Map[String, MType] do
                var res = new HashMap[String, MType]
-               for i in [0..intro.parameter_names.length[ do
-                       res[intro.parameter_names[i]] = intro.bound_mtype.arguments[i]
+               for p in mparameters do
+                       res[p.name] = p
                end
                return res
        end
index 8bc6ef2..2a5e9fb 100644 (file)
@@ -44,6 +44,7 @@ redef class ModelBuilder
                var nvisibility: nullable AVisibility
                var mvisibility: nullable MVisibility
                var arity = 0
+               var names = new Array[String]
                if nclassdef isa AStdClassdef then
                        name = nclassdef.n_id.text
                        nkind = nclassdef.n_classkind
@@ -58,6 +59,21 @@ redef class ModelBuilder
                                error(nvisibility, "Error: intrude is not a legal visibility for classes.")
                                return
                        end
+                       # Collect formal parameter names
+                       for i in [0..arity[ do
+                               var nfd = nclassdef.n_formaldefs[i]
+                               var ptname = nfd.n_id.text
+                               if names.has(ptname) then
+                                       error(nfd, "Error: A formal parameter type `{ptname}' already exists")
+                                       return
+                               end
+                               for c in ptname.chars do if c >= 'a' and c<= 'z' then
+                                       warning(nfd, "formal-type-name", "Warning: lowercase in the formal parameter type {ptname}")
+                                       break
+                               end
+                               names.add(ptname)
+                       end
+
                else if nclassdef isa ATopClassdef then
                        name = "Object"
                        nkind = null
@@ -80,7 +96,7 @@ redef class ModelBuilder
                                error(nclassdef, "Redef error: No imported class {name} to refine.")
                                return
                        end
-                       mclass = new MClass(mmodule, name, arity, mkind, mvisibility)
+                       mclass = new MClass(mmodule, name, names, mkind, mvisibility)
                        #print "new class {mclass}"
                else if nclassdef isa AStdClassdef and nmodule.mclass2nclassdef.has_key(mclass) then
                        error(nclassdef, "Error: A class {name} is already defined at line {nmodule.mclass2nclassdef[mclass].location.line_start}.")
@@ -88,7 +104,7 @@ redef class ModelBuilder
                else if nclassdef isa AStdClassdef and nclassdef.n_kwredef == null then
                        error(nclassdef, "Redef error: {name} is an imported class. Add the redef keyword to refine it.")
                        return
-               else if mclass.arity != arity then
+               else if arity != 0 and mclass.arity != arity then
                        error(nclassdef, "Redef error: Formal parameter arity missmatch; got {arity}, expected {mclass.arity}.")
                        return
                else if nkind != null and mkind != concrete_kind and mclass.kind != mkind then
@@ -121,35 +137,29 @@ redef class ModelBuilder
                        return
                end
 
-               var names = new Array[String]
                var bounds = new Array[MType]
                if nclassdef isa AStdClassdef and mclass.arity > 0 then
-                       # Collect formal parameter names
+                       # Revolve bound for formal parameters
                        for i in [0..mclass.arity[ do
-                               var nfd = nclassdef.n_formaldefs[i]
-                               var ptname = nfd.n_id.text
-                               if names.has(ptname) then
-                                       error(nfd, "Error: A formal parameter type `{ptname}' already exists")
-                                       return
-                               end
-                               for c in ptname.chars do if c >= 'a' and c<= 'z' then
-                                       warning(nfd, "formal-type-name", "Warning: lowercase in the formal parameter type {ptname}")
-                                       break
+                               if nclassdef.n_formaldefs.is_empty then
+                                       # Inherit the bound
+                                       var bound = mclass.intro.bound_mtype.arguments[i]
+                                       bounds.add(bound)
+                                       continue
                                end
-                               names.add(ptname)
-                               nfd.mtype = mclass.mclass_type.arguments[i].as(MParameterType)
-                       end
 
-                       # Revolve bound for formal parameter names
-                       for i in [0..mclass.arity[ do
                                var nfd = nclassdef.n_formaldefs[i]
+                               var pname = mclass.mparameters[i].name
+                               if nfd.n_id.text != pname then
+                                       error(nfd.n_id, "Error: Formal parameter type #{i} `{nfd.n_id.text}` must be named `{pname}' as in the original definition in module `{mclass.intro.mmodule}`.")
+                               end
                                var nfdt = nfd.n_type
                                if nfdt != null then
                                        var bound = resolve_mtype_unchecked(mmodule, null, nfdt, false)
                                        if bound == null then return # Forward error
                                        if bound.need_anchor then
                                                # No F-bounds!
-                                               error(nfd, "Error: Formal parameter type `{names[i]}' bounded with a formal parameter type")
+                                               error(nfd, "Error: Formal parameter type `{pname}' bounded with a formal parameter type")
                                        else
                                                bounds.add(bound)
                                                nfd.bound = bound
@@ -172,7 +182,7 @@ redef class ModelBuilder
                end
 
                var bound_mtype = mclass.get_mtype(bounds)
-               var mclassdef = new MClassDef(mmodule, bound_mtype, nclassdef.location, names)
+               var mclassdef = new MClassDef(mmodule, bound_mtype, nclassdef.location)
                nclassdef.mclassdef = mclassdef
                self.mclassdef2nclassdef[mclassdef] = nclassdef
 
@@ -426,19 +436,19 @@ redef class ModelBuilder
                end
 
                # Check parameter type
-               if mclassdef != null and mclassdef.parameter_names.has(name) then
-                       if not ntype.n_types.is_empty then
-                               error(ntype, "Type error: formal type {name} cannot have formal parameters.")
-                       end
-                       for i in [0..mclassdef.parameter_names.length[ do
-                               if mclassdef.parameter_names[i] == name then
-                                       res = mclassdef.mclass.mclass_type.arguments[i]
-                                       if ntype.n_kwnullable != null then res = res.as_nullable
-                                       ntype.mtype = res
-                                       return res
+               if mclassdef != null then
+                       for p in mclassdef.mclass.mparameters do
+                               if p.name != name then continue
+
+                               if not ntype.n_types.is_empty then
+                                       error(ntype, "Type error: formal type {name} cannot have formal parameters.")
                                end
+
+                               res = p
+                               if ntype.n_kwnullable != null then res = res.as_nullable
+                               ntype.mtype = res
+                               return res
                        end
-                       abort
                end
 
                # Check class
index 5542e91..5b51894 100644 (file)
@@ -121,8 +121,27 @@ redef class ModelBuilder
                # Collect undefined attributes
                var mparameters = new Array[MParameter]
                var initializers = new Array[MProperty]
-               var anode: nullable ANode = null
                for npropdef in nclassdef.n_propdefs do
+                       if npropdef isa AMethPropdef then
+                               if npropdef.mpropdef == null then return # Skip broken attribute
+                               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)
+                                       mparameters.add(mparameter)
+                               end
+                               initializers.add(npropdef.mpropdef.mproperty)
+                       end
                        if npropdef isa AAttrPropdef then
                                if npropdef.mpropdef == null then return # Skip broken attribute
                                var at = npropdef.get_single_annotation("noinit", self)
@@ -147,10 +166,8 @@ redef class ModelBuilder
                                        # Add the setter to the list
                                        initializers.add(msetter.mproperty)
                                end
-                               if anode == null then anode = npropdef
                        end
                end
-               if anode == null then anode = nclassdef
 
                if the_root_init_mmethod == null then return
 
index 70d593e..8da9966 100644 (file)
@@ -487,10 +487,14 @@ class NeoModel
        private fun mclass_node(mclass: MClass): NeoNode do
                var node = make_node(mclass)
                node.labels.add "MClass"
-               node["arity"] = mclass.arity
                node["full_name"] = mclass.full_name
                node["kind"] = mclass.kind.to_s
                node["visibility"] = mclass.visibility.to_s
+               if not mclass.mparameters.is_empty then
+                       var parameter_names = new Array[String]
+                       for p in mclass.mparameters do parameter_names.add(p.name)
+                       node["parameter_names"] = new JsonArray.from(parameter_names)
+               end
                node.out_edges.add(new NeoEdge(node, "CLASSTYPE", to_node(mclass.mclass_type)))
                return node
        end
@@ -503,10 +507,15 @@ class NeoModel
                assert node.labels.has("MClass")
                var mmodule = to_mmodule(model, node.in_nodes("INTRODUCES").first)
                var name = node["name"].to_s
-               var arity = node["arity"].to_s.to_i
                var kind = to_kind(node["kind"].to_s)
                var visibility = to_visibility(node["visibility"].to_s)
-               var mclass = new MClass(mmodule, name, arity, kind, visibility)
+               var parameter_names = new Array[String]
+               if node.has_key("parameter_names") then
+                       for e in node["parameter_names"].as(JsonArray) do
+                               parameter_names.add e.to_s
+                       end
+               end
+               var mclass = new MClass(mmodule, name, parameter_names, kind, visibility)
                mentities[node] = mclass
                set_doc(node, mclass)
                return mclass
@@ -518,9 +527,6 @@ class NeoModel
                node.labels.add "MClassDef"
                node["is_intro"] = mclassdef.is_intro
                node["location"] = mclassdef.location.to_s
-               if not mclassdef.parameter_names.is_empty then
-                       node["parameter_names"] = new JsonArray.from(mclassdef.parameter_names)
-               end
                node.out_edges.add(new NeoEdge(node, "BOUNDTYPE", to_node(mclassdef.bound_mtype)))
                node.out_edges.add(new NeoEdge(node, "MCLASS", to_node(mclassdef.mclass)))
                for mproperty in mclassdef.intro_mproperties do
@@ -544,13 +550,7 @@ class NeoModel
                var mmodule = to_mmodule(model, node.in_nodes("DEFINES").first)
                var mtype = to_mtype(model, node.out_nodes("BOUNDTYPE").first).as(MClassType)
                var location = to_location(node["location"].to_s)
-               var parameter_names = new Array[String]
-               if node.has_key("parameter_names") then
-                       for e in node["parameter_names"].as(JsonArray) do
-                               parameter_names.add e.to_s
-                       end
-               end
-               var mclassdef = new MClassDef(mmodule, mtype, location, parameter_names)
+               var mclassdef = new MClassDef(mmodule, mtype, location)
                mentities[node] = mclassdef
                set_doc(node, mclassdef)
                var supertypes = new Array[MClassType]
@@ -737,7 +737,7 @@ class NeoModel
                else if node.labels.has("MParameterType") then
                        var mclass = to_mclass(model, node.out_nodes("CLASS").first)
                        var rank = node["rank"].to_s.to_i
-                       var mtype = new MParameterType(mclass, rank)
+                       var mtype = mclass.mparameters[rank]
                        mentities[node] = mtype
                        return  mtype
                else if node.labels.has("MNullableType") then
index f71a78e..0353560 100644 (file)
@@ -456,9 +456,9 @@ redef class MClass
                var res = new FlatBuffer
                if arity > 0 then
                        res.append("[")
-                       for i in [0..intro.parameter_names.length[ do
-                               res.append(intro.parameter_names[i])
-                               if i < intro.parameter_names.length - 1 then res.append(", ")
+                       for i in [0..mparameters.length[ do
+                               res.append(mparameters[i].name)
+                               if i < mparameters.length - 1 then res.append(", ")
                        end
                        res.append("]")
                end
@@ -767,7 +767,7 @@ redef class MGenericType
 end
 
 redef class MParameterType
-       redef fun to_console do return mclass.intro.parameter_names[rank]
+       redef fun to_console do return name
 end
 
 redef class MVirtualType
index 7581f2a..205297f 100644 (file)
@@ -74,11 +74,10 @@ redef class MClass
                end
                if arity > 0 then
                        t.add "["
-                       var formal = intro.parameter_names
-                       t.add formal.first
-                       for i in [1 .. formal.length[ do
+                       t.add mparameters.first.name
+                       for i in [1 .. mparameters.length[ do
                                t.add ", "
-                               t.add formal[i]
+                               t.add mparameters[i].name
                        end
                        t.add "]"
                end
@@ -211,8 +210,7 @@ end
 
 redef class MParameterType
        redef fun tpl_class(c, m) do
-               var n = mclass.intro.parameter_names
-               return n[rank]
+               return name
        end
 end
 
index 55d16f3..8485c45 100644 (file)
@@ -90,11 +90,11 @@ redef class MClassDef
                end
                if mclass.arity > 0 then
                        t.add "["
-                       var formal = mclass.intro.parameter_names
-                       t.add formal.first
-                       for i in [1 .. formal.length[ do
+                       var mparameters = mclass.mparameters
+                       t.add mparameters.first.name
+                       for i in [1 .. mparameters.length[ do
                                t.add ", "
-                               t.add formal[i]
+                               t.add mparameters[i].name
                        end
                        t.add "]"
                end
diff --git a/tests/base_gen_redef.nit b/tests/base_gen_redef.nit
new file mode 100644 (file)
index 0000000..37030bf
--- /dev/null
@@ -0,0 +1,24 @@
+# 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_gen2
+
+redef class B[E] #alt1# redef class B #alt2# redef class B[X] #alt3# redef class B[E,X]
+       fun output2 do e2.output
+       fun e2: E do return e
+       #alt2#fun e3: X do return e
+end
+
+var b = new B[Int](2)
+b.output2
diff --git a/tests/base_init_autoinit.nit b/tests/base_init_autoinit.nit
new file mode 100644 (file)
index 0000000..e5bd4ab
--- /dev/null
@@ -0,0 +1,83 @@
+# 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 toto(i: Int) is autoinit do
+               'A'.output
+               'o'.output
+               i.output
+       end
+
+       fun tata is autoinit do
+               'A'.output
+               'a'.output
+               '\n'.output
+       end
+
+       init do
+               'A'.output
+               '\n'.output
+       end
+end
+
+class B
+       super A
+       fun tutu=(j: Int) is autoinit do
+               # no super here!
+               'B'.output
+               'u'.output
+               j.output
+       end
+
+       redef fun toto(i)
+       do
+               super
+               'B'.output
+               'o'.output
+               i.output
+       end
+
+       redef fun tata do #alt1#redef fun tata is autoinit do
+               'B'.output
+               'a'.output
+               '\n'.output
+       end
+
+       init do
+               'B'.output
+               '\n'.output
+       end
+end
+
+class C
+       super A
+       fun tete(k,l: Int) is autoinit do
+               'C'.output
+               'e'.output
+               k.output
+               l.output
+       end
+end
+
+var a = new A(1)
+
+'\n'.output
+
+var b = new B(10,20)
+
+'\n'.output
+
+var c = new C(100,200,300)
index c426288..a64bbf0 100644 (file)
@@ -1,5 +1,5 @@
-base_as_notnull2.nit:30,12--25: Warning: expression is already not null, since it is a `G#0: Object`.
-base_as_notnull2.nit:50,12--25: Warning: expression is already not null, since it is a `G#0: Object`.
+base_as_notnull2.nit:30,12--25: Warning: expression is already not null, since it is a `E: Object`.
+base_as_notnull2.nit:50,12--25: Warning: expression is already not null, since it is a `E: Object`.
 1
 1
 2
index e6b980e..a28e2e1 100644 (file)
@@ -1,3 +1,3 @@
-alt/base_as_notnull2_alt1.nit:30,12--25: Warning: expression is already not null, since it is a `G#0: Object`.
-alt/base_as_notnull2_alt1.nit:50,12--25: Warning: expression is already not null, since it is a `G#0: Object`.
+alt/base_as_notnull2_alt1.nit:30,12--25: Warning: expression is already not null, since it is a `E: Object`.
+alt/base_as_notnull2_alt1.nit:50,12--25: Warning: expression is already not null, since it is a `E: Object`.
 alt/base_as_notnull2_alt1.nit:58,7--10: Type error: expected Object, got null
index 0d136a8..ccaa594 100644 (file)
@@ -1,5 +1,5 @@
-alt/base_as_notnull2_alt2.nit:30,12--25: Warning: expression is already not null, since it is a `G#0: Object`.
-alt/base_as_notnull2_alt2.nit:50,12--25: Warning: expression is already not null, since it is a `G#0: Object`.
+alt/base_as_notnull2_alt2.nit:30,12--25: Warning: expression is already not null, since it is a `E: Object`.
+alt/base_as_notnull2_alt2.nit:50,12--25: Warning: expression is already not null, since it is a `E: Object`.
 Runtime error: Cast failed (alt/base_as_notnull2_alt2.nit:40)
 1
 1
index c166c42..7ce3a5b 100644 (file)
@@ -1,3 +1,3 @@
-alt/base_as_notnull2_alt3.nit:30,12--25: Warning: expression is already not null, since it is a `G#0: Object`.
-alt/base_as_notnull2_alt3.nit:50,12--25: Warning: expression is already not null, since it is a `G#0: Object`.
+alt/base_as_notnull2_alt3.nit:30,12--25: Warning: expression is already not null, since it is a `E: Object`.
+alt/base_as_notnull2_alt3.nit:50,12--25: Warning: expression is already not null, since it is a `E: Object`.
 alt/base_as_notnull2_alt3.nit:64,7--10: Type error: expected Int, got null
index 64e8ec9..a653d42 100644 (file)
@@ -1,3 +1,3 @@
-Runtime error: Cast failed. Expected `G#0`, got `Int` (alt/base_autocast_alt1.nit:22)
+Runtime error: Cast failed. Expected `E`, got `Int` (alt/base_autocast_alt1.nit:22)
 1
 2
index 5a6459b..c08a6e4 100644 (file)
@@ -1 +1 @@
-Runtime error: Cast failed. Expected `G#0`, got `Int` (alt/base_covar_gen_1alt1_alt1.nit:19)
+Runtime error: Cast failed. Expected `E`, got `Int` (alt/base_covar_gen_1alt1_alt1.nit:19)
index 1533602..8451fac 100644 (file)
@@ -1 +1 @@
-Runtime error: Cast failed. Expected `G#0`, got `Int` (alt/base_covar_gen_1alt1_alt2.nit:18)
+Runtime error: Cast failed. Expected `E`, got `Int` (alt/base_covar_gen_1alt1_alt2.nit:18)
index 3c2c470..2d49fad 100644 (file)
@@ -1 +1 @@
-Runtime error: Cast failed. Expected `G#0`, got `G[Object]` (alt/base_covar_gen_alt3.nit:19)
+Runtime error: Cast failed. Expected `E`, got `G[Object]` (alt/base_covar_gen_alt3.nit:19)
index 31237a8..6eaead5 100644 (file)
@@ -1 +1 @@
-Runtime error: Cast failed. Expected `G#0`, got `G[Object]` (alt/base_covar_gen_alt4.nit:18)
+Runtime error: Cast failed. Expected `E`, got `G[Object]` (alt/base_covar_gen_alt4.nit:18)
index 342698c..c7948e5 100644 (file)
@@ -1 +1 @@
-alt/base_gen_bound_alt1.nit:31,10: Type error: expected B, got H#0
+alt/base_gen_bound_alt1.nit:31,10: Type error: expected B, got F
index 79521ed..eec93b1 100644 (file)
@@ -1 +1 @@
-alt/base_gen_bound_alt2.nit:32,11: Type error: expected B, got H#0
+alt/base_gen_bound_alt2.nit:32,11: Type error: expected B, got F
index 26c07bc..d713b99 100644 (file)
@@ -1 +1 @@
-alt/base_gen_bound_alt3.nit:33,11: Type error: expected B, got H#0
+alt/base_gen_bound_alt3.nit:33,11: Type error: expected B, got F
index b7fca30..f79e28c 100644 (file)
@@ -1 +1 @@
-alt/base_gen_bound_alt4.nit:34,13: Type error: expected B, got H#0
+alt/base_gen_bound_alt4.nit:34,13: Type error: expected B, got F
index e789485..40782b2 100644 (file)
@@ -1,4 +1,4 @@
-Runtime error: Cast failed. Expected `G#0`, got `Int` (alt/base_gen_reassign_alt1.nit:23)
+Runtime error: Cast failed. Expected `E`, got `Int` (alt/base_gen_reassign_alt1.nit:23)
 11
 21
 31
index b8b97b2..d26da80 100644 (file)
@@ -1,4 +1,4 @@
-Runtime error: Cast failed. Expected `G#0`, got `Int` (alt/base_gen_reassign_alt2.nit:23)
+Runtime error: Cast failed. Expected `E`, got `Int` (alt/base_gen_reassign_alt2.nit:23)
 11
 21
 31
index 2e6e40b..02a3b8e 100644 (file)
@@ -1,4 +1,4 @@
-Runtime error: Cast failed. Expected `G#0`, got `Int` (alt/base_gen_reassign_alt4.nit:23)
+Runtime error: Cast failed. Expected `E`, got `Int` (alt/base_gen_reassign_alt4.nit:23)
 11
 21
 31
index 3c233b9..acf354b 100644 (file)
@@ -1,4 +1,4 @@
-Runtime error: Cast failed. Expected `G#0`, got `Int` (alt/base_gen_reassign_alt5.nit:23)
+Runtime error: Cast failed. Expected `E`, got `Int` (alt/base_gen_reassign_alt5.nit:23)
 11
 21
 31
index dd598d3..549a816 100644 (file)
@@ -1,4 +1,4 @@
-Runtime error: Cast failed. Expected `G#0`, got `Int` (alt/base_gen_reassign_alt6.nit:23)
+Runtime error: Cast failed. Expected `E`, got `Int` (alt/base_gen_reassign_alt6.nit:23)
 11
 21
 31
diff --git a/tests/sav/base_gen_redef.res b/tests/sav/base_gen_redef.res
new file mode 100644 (file)
index 0000000..0cfbf08
--- /dev/null
@@ -0,0 +1 @@
+2
diff --git a/tests/sav/base_gen_redef_alt1.res b/tests/sav/base_gen_redef_alt1.res
new file mode 100644 (file)
index 0000000..0cfbf08
--- /dev/null
@@ -0,0 +1 @@
+2
diff --git a/tests/sav/base_gen_redef_alt2.res b/tests/sav/base_gen_redef_alt2.res
new file mode 100644 (file)
index 0000000..09c27f7
--- /dev/null
@@ -0,0 +1 @@
+alt/base_gen_redef_alt2.nit:17,15: Error: Formal parameter type #0 `X` must be named `E' as in the original definition in module `base_gen2`.
diff --git a/tests/sav/base_gen_redef_alt3.res b/tests/sav/base_gen_redef_alt3.res
new file mode 100644 (file)
index 0000000..cc76588
--- /dev/null
@@ -0,0 +1 @@
+alt/base_gen_redef_alt3.nit:17,13: Redef error: Formal parameter arity missmatch; got 2, expected 1.
index 1ad479a..4b49330 100644 (file)
@@ -1,2 +1,2 @@
-Runtime error: Cast failed. Expected `G#0`, got `B` (alt/base_gen_variance2_alt1.nit:27)
+Runtime error: Cast failed. Expected `E`, got `B` (alt/base_gen_variance2_alt1.nit:27)
 3
index 2528c5e..10f4ba7 100644 (file)
@@ -1,2 +1,2 @@
-Runtime error: Cast failed. Expected `G#0`, got `D` (alt/base_gen_variance2_alt2.nit:27)
+Runtime error: Cast failed. Expected `E`, got `D` (alt/base_gen_variance2_alt2.nit:27)
 3
index 26d887d..f450e1f 100644 (file)
@@ -1,2 +1,2 @@
-Runtime error: Cast failed. Expected `G#0`, got `D` (alt/base_gen_variance3_alt1.nit:27)
+Runtime error: Cast failed. Expected `E`, got `D` (alt/base_gen_variance3_alt1.nit:27)
 2
index a81c369..bdccdbe 100644 (file)
@@ -1,4 +1,4 @@
-Runtime error: Cast failed. Expected `nullable G#0`, got `C` (alt/base_gen_variance_alt3.nit:18)
+Runtime error: Cast failed. Expected `nullable E`, got `C` (alt/base_gen_variance_alt3.nit:18)
 2
 20
 2
index 8b857dc..4a2c316 100644 (file)
@@ -1,4 +1,4 @@
-Runtime error: Cast failed. Expected `nullable G#0`, got `G[C]` (alt/base_gen_variance_alt6.nit:18)
+Runtime error: Cast failed. Expected `nullable E`, got `G[C]` (alt/base_gen_variance_alt6.nit:18)
 2
 20
 2
index 89e8b84..936f637 100644 (file)
@@ -1,4 +1,4 @@
-Runtime error: Cast failed. Expected `nullable G#0`, got `G[A]` (alt/base_gen_variance_alt8.nit:18)
+Runtime error: Cast failed. Expected `nullable E`, got `G[A]` (alt/base_gen_variance_alt8.nit:18)
 2
 20
 2
index 3057795..f912514 100644 (file)
@@ -1,2 +1,2 @@
-Runtime error: Cast failed. Expected `G#0`, got `Char` (alt/base_gen_variance_int_alt1.nit:27)
+Runtime error: Cast failed. Expected `E`, got `Char` (alt/base_gen_variance_int_alt1.nit:27)
 2
diff --git a/tests/sav/base_init_autoinit.res b/tests/sav/base_init_autoinit.res
new file mode 100644 (file)
index 0000000..64605d9
--- /dev/null
@@ -0,0 +1,16 @@
+Ao1
+Aa
+A
+
+Ao10
+Bo10
+Ba
+Bu20
+A
+B
+
+Ao100
+Aa
+Ce200
+300
+A
diff --git a/tests/sav/base_init_autoinit_alt1.res b/tests/sav/base_init_autoinit_alt1.res
new file mode 100644 (file)
index 0000000..af10e70
--- /dev/null
@@ -0,0 +1 @@
+alt/base_init_autoinit_alt1.nit:53,20--27: Error: `autoinit` cannot be set on redefinitions
index 032236e..f80c36c 100644 (file)
@@ -1,4 +1,4 @@
-base_isa_vt_gen1.nit:30,10--34: Warning: Expression is already a Triple[A#0, A#1, V].
+base_isa_vt_gen1.nit:30,10--34: Warning: Expression is already a Triple[T, U, V].
 base_isa_vt_gen1.nit:54,8--52: Warning: Expression is already a Triple[String, Int, nullable Object].
 base_isa_vt_gen1.nit:57,8--46: Warning: Expression is already a Triple[String, String, String].
 base_isa_vt_gen1.nit:60,8--48: Warning: Expression is already a Triple[String, String, B[String]].
index f7e9a89..24a450f 100644 (file)
@@ -1 +1 @@
-alt/error_class_generic_alt1.nit:17,13--17: Redef error: Formal parameter arity missmatch; got 0, expected 1.
+alt/error_class_generic_alt1.nit:25,8--12: Type error: 'Array' is a generic class.
index 95235a6..aa8128f 100644 (file)
@@ -1 +1 @@
-alt/error_class_generic_alt3.nit:19,13--17: Redef error: Formal parameter arity missmatch; got 2, expected 1.
+alt/error_class_generic_alt3.nit:19,29--34: Error: A formal parameter type `E' already exists
index eebfb9c..f1fcb86 100644 (file)
@@ -1 +1 @@
-alt/error_class_generic_alt6.nit:22,7--11: Redef error: Array is an imported class. Add the redef keyword to refine it.
+alt/error_class_generic_alt6.nit:22,23--28: Error: A formal parameter type `E' already exists
index 638259a..2f4865c 100644 (file)
@@ -1,2 +1,2 @@
-error_inh_clash4.nit:15,7: Error: Incompatibles ancestors for A: Sequence[A#1], Sequence[A#0]
-error_inh_clash4.nit:15,7: Error: Incompatibles ancestors for A: SequenceRead[A#1], SequenceRead[A#0]
+error_inh_clash4.nit:15,7: Error: Incompatibles ancestors for A: Sequence[F], Sequence[E]
+error_inh_clash4.nit:15,7: Error: Incompatibles ancestors for A: SequenceRead[F], SequenceRead[E]
index ec31f82..1137621 100644 (file)
@@ -1 +1 @@
-test_multiconstraint_inh.nit:39,18--21: Redef Error: Wrong type for parameter `e'. found J, expected I[G#0] as in test_multiconstraint_inh#G#baz.
+test_multiconstraint_inh.nit:39,18--21: Redef Error: Wrong type for parameter `e'. found J, expected I[E] as in test_multiconstraint_inh#G#baz.
index c08210d..5fac7da 100644 (file)
@@ -1,4 +1,4 @@
-Runtime error: Cast failed. Expected `NativeArray#0`, got `Bool` (../lib/standard/collection/array.nit:754)
+Runtime error: Cast failed. Expected `E`, got `Bool` (../lib/standard/collection/array.nit:754)
 NativeString
 N
 Nit
index f4fbe66..51e3f54 100644 (file)
@@ -1,2 +1,2 @@
-test_paire.nit:45,7--10: Redef error: Pair is an imported class. Add the redef keyword to refine it.
-test_paire.nit:54,7--10: Redef error: Pair is an imported class. Add the redef keyword to refine it.
+test_paire.nit:45,27--39: Error: A formal parameter type `E' already exists
+test_paire.nit:54,20--25: Error: A formal parameter type `E' already exists
index dc98ae0..f393851 100644 (file)
@@ -42,7 +42,7 @@ private
                end
 end
 
-class Pair[E: Comparable, E: Comparable]
+class Pair[E: Comparable, F: Comparable]
 
        fun >(p: Pair[Comparable, Comparable]): Bool
                do
@@ -51,7 +51,7 @@ class Pair[E: Comparable, E: Comparable]
                end
 end
 
-class Pair[E: Int, E: Int]
+class Pair[E: Int, F: Int]
 
        fun sum: Int
                do