Merge: typing: new warning `useless-truism` to catch trainees.
authorJean Privat <jean@pryen.org>
Tue, 18 Jul 2017 12:38:12 +0000 (08:38 -0400)
committerJean Privat <jean@pryen.org>
Tue, 18 Jul 2017 12:38:12 +0000 (08:38 -0400)
Warning on `if a == true then` constructions.

Pull-Request: #2520
Reviewed-by: Jean-Christophe Beaupré <jcbrinfo.public@gmail.com>

1  2 
src/model/model.nit

diff --combined src/model/model.nit
@@@ -885,7 -885,7 +885,7 @@@ abstract class MTyp
                if anchor == null then anchor = sub # UGLY: any anchor will work
                var resolved_sub = sub.anchor_to(mmodule, anchor)
                var res = resolved_sub.collect_mclasses(mmodule).has(sup.mclass)
-               if res == false then return false
+               if not res then return false
                if not sup isa MGenericType then return true
                var sub2 = sub.supertype_to(mmodule, anchor, sup.mclass)
                assert sub2.mclass == sup.mclass
                        var sub_arg = sub2.arguments[i]
                        var sup_arg = sup.arguments[i]
                        res = sub_arg.is_subtype(mmodule, anchor, sup_arg)
-                       if res == false then return false
+                       if not res then return false
                end
                return true
        end
@@@ -1975,34 -1975,16 +1975,34 @@@ class MSignatur
                var b = new FlatBuffer
                if not mparameters.is_empty then
                        b.append("(")
 +                      var last_mtype = null
                        for i in [0..mparameters.length[ do
                                var mparameter = mparameters[i]
 +
 +                              # Group types that are common to contiguous parameters
 +                              if mparameter.mtype != last_mtype and last_mtype != null then
 +                                      b.append(": ")
 +                                      b.append(last_mtype.to_s)
 +                              end
 +
                                if i > 0 then b.append(", ")
                                b.append(mparameter.name)
 -                              b.append(": ")
 -                              b.append(mparameter.mtype.to_s)
 +
                                if mparameter.is_vararg then
 +                                      b.append(": ")
 +                                      b.append(mparameter.mtype.to_s)
                                        b.append("...")
 +                                      last_mtype = null
 +                              else
 +                                      last_mtype = mparameter.mtype
                                end
                        end
 +
 +                      if last_mtype != null then
 +                              b.append(": ")
 +                              b.append(last_mtype.to_s)
 +                      end
 +
                        b.append(")")
                end
                var ret = self.return_mtype