Merge: Simplify CSV
authorJean Privat <jean@pryen.org>
Tue, 3 May 2016 15:04:31 +0000 (11:04 -0400)
committerJean Privat <jean@pryen.org>
Tue, 3 May 2016 15:04:31 +0000 (11:04 -0400)
This PR is a rewriting of the CSV library, it should now be easier to use and should not fail anymore due to `\r\n` being the default, this one has been replaced by a single `\n` character.

The `CSVFormat` class has been removed since it introduced more complexity than usefulness, and now the separator, eol and delimiter can be set independently after creation of the `CsvDocument` or a `CsvReader/Writer`.

Concerning performance, the new parser is way faster than the old one.
On a simple 4Mio file, parsing used to take 2.401s.
On the new parser, the measured user time is 0.179s, hence an improvement by a factor of ~12.

Old code sample
~~~nit
import csv

var fl = new FileReader.open(args[0])
var rd = new CsvReader.with_format(fl, new CsvFormat('"', ',', "\r"))

var lns = new Array[Array[String]]
for i in rd do lns.add i
~~~

New code sample
~~~nit
import csv

var rd = new CsvReader.from_string(args[0].to_path.read_all)
rd.eol = "\r"
rd.read_all
~~~

Pull-Request: #2048
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Jean Privat <jean@pryen.org>

21 files changed:
lib/core/text/flat.nit
src/modelbuilder_base.nit
src/modelize/modelize_class.nit
tests/base_name_conflict.nit [new file with mode: 0644]
tests/error_names.nit [new file with mode: 0644]
tests/module_1.nit
tests/module_1b.nit [new file with mode: 0644]
tests/names1.nit [new file with mode: 0644]
tests/sav/base_name_conflict.res [new file with mode: 0644]
tests/sav/base_name_conflict_alt1.res [new file with mode: 0644]
tests/sav/base_name_conflict_alt2.res [new file with mode: 0644]
tests/sav/base_name_conflict_alt3.res [new file with mode: 0644]
tests/sav/error_names.res [new file with mode: 0644]
tests/sav/error_redef_class.res
tests/sav/error_type_not_ok5.res
tests/sav/error_type_unk_alt2.res
tests/sav/error_unk_class.res
tests/sav/error_unk_class2.res
tests/sav/module_1b.res [new file with mode: 0644]
tests/sav/test_model_visitor_args2.res
tests/test_model_visitor.args

index 0fc5663..45ad144 100644 (file)
@@ -922,9 +922,9 @@ class FlatBuffer
 
        redef fun clear do
                is_dirty = true
-               if written then reset
                _bytelen = 0
                _length = 0
+               if written then reset
        end
 
        redef fun empty do return new Buffer
@@ -933,12 +933,13 @@ class FlatBuffer
        do
                var c = capacity
                if cap <= c then return
-               while c <= cap do c = c * 2 + 2
+               if c <= 16 then c = 16
+               while c <= cap do c = c * 2
                # The COW flag can be set at false here, since
                # it does a copy of the current `Buffer`
                written = false
                var bln = _bytelen
-               var a = new NativeString(c+1)
+               var a = new NativeString(c)
                if bln > 0 then
                        var it = _items
                        if bln > 0 then it.copy_to(a, bln, 0, 0)
@@ -1005,7 +1006,7 @@ class FlatBuffer
        init with_capacity(cap: Int)
        do
                assert cap >= 0
-               _items = new NativeString(cap + 1)
+               _items = new NativeString(cap)
                capacity = cap
                _bytelen = 0
        end
index 5c64d23..a60ef68 100644 (file)
@@ -81,6 +81,36 @@ class ModelBuilder
                return res
        end
 
+       # Return a class identified by `qid` visible by the module `mmodule`.
+       # Visibility in modules and qualified names are correctly handled.
+       #
+       # If more than one class exists, then null is silently returned.
+       # It is up to the caller to post-analysis the result and display a correct error message.
+       # The method `class_not_found` can be used to display such a message.
+       fun try_get_mclass_by_qid(qid: AQclassid, mmodule: MModule): nullable MClass
+       do
+               var name = qid.n_id.text
+
+               var classes = model.get_mclasses_by_name(name)
+               if classes == null then
+                       return null
+               end
+
+               var res: nullable MClass = null
+               for mclass in classes do
+                       if not mmodule.in_importation <= mclass.intro_mmodule then continue
+                       if not mmodule.is_visible(mclass.intro_mmodule, mclass.visibility) then continue
+                       if not qid.accept(mclass) then continue
+                       if res == null then
+                               res = mclass
+                       else
+                               return null
+                       end
+               end
+
+               return res
+       end
+
        # Like `try_get_mclass_by_name` but display an error message when the class is not found
        fun get_mclass_by_name(node: ANode, mmodule: MModule, name: String): nullable MClass
        do
@@ -235,7 +265,8 @@ class ModelBuilder
        # FIXME: the name "resolve_mtype" is awful
        fun resolve_mtype_unchecked(mmodule: MModule, mclassdef: nullable MClassDef, ntype: AType, with_virtual: Bool): nullable MType
        do
-               var name = ntype.n_qid.n_id.text
+               var qid = ntype.n_qid
+               var name = qid.n_id.text
                var res: MType
 
                # Check virtual type
@@ -269,7 +300,7 @@ class ModelBuilder
                end
 
                # Check class
-               var mclass = try_get_mclass_by_name(ntype, mmodule, name)
+               var mclass = try_get_mclass_by_qid(qid, mmodule)
                if mclass != null then
                        var arity = ntype.n_types.length
                        if arity != mclass.arity then
@@ -304,27 +335,54 @@ class ModelBuilder
                # If everything fail, then give up with class by proposing things.
                #
                # TODO Give hints on formal types (param and virtual)
-               # TODO How to move this in a libified autonomous code?
+               class_not_found(qid, mmodule)
+               ntype.is_broken = true
+               return null
+       end
+
+       # Print an error and suggest hints when the class identified by `qid` in `mmodule` is not found.
+       #
+       # This just print error messages.
+       fun class_not_found(qid: AQclassid, mmodule: MModule)
+       do
+               var name = qid.n_id.text
+               var qname = qid.full_name
 
                var all_classes = model.get_mclasses_by_name(name)
+               var hints = new Array[String]
+
+               # Look for conflicting classes.
+               if all_classes != null then for c in all_classes do
+                       if not mmodule.is_visible(c.intro_mmodule, c.visibility) then continue
+                       if not qid.accept(c) then continue
+                       hints.add "`{c.full_name}`"
+               end
+               if hints.length > 1 then
+                       error(qid, "Error: ambiguous class name `{qname}` in module `{mmodule}`. Conflicts are between {hints.join(",", " and ")}.")
+                       return
+               end
+               hints.clear
 
                # Look for imported but invisible classes.
                if all_classes != null then for c in all_classes do
                        if not mmodule.in_importation <= c.intro_mmodule then continue
-                       error(ntype, "Error: class `{c.full_name}` not visible in module `{mmodule}`.")
-                       return null
+                       if mmodule.is_visible(c.intro_mmodule, c.visibility) then continue
+                       if not qid.accept(c) then continue
+                       error(qid, "Error: class `{c.full_name}` not visible in module `{mmodule}`.")
+                       return
                end
 
                # Look for not imported but known classes from importable modules
-               var hints = new Array[String]
                if all_classes != null then for c in all_classes do
+                       if mmodule.in_importation <= c.intro_mmodule then continue
                        if c.intro_mmodule.in_importation <= mmodule then continue
                        if c.visibility <= private_visibility then continue
+                       if not qid.accept(c) then continue
                        hints.add "`{c.intro_mmodule.full_name}`"
                end
                if hints.not_empty then
-                       error(ntype, "Error: class `{name}` not found in module `{mmodule}`. Maybe import {hints.join(",", " or ")}?")
-                       return null
+                       error(qid, "Error: class `{qname}` not found in module `{mmodule}`. Maybe import {hints.join(",", " or ")}?")
+                       return
                end
 
                # Look for classes with an approximative name.
@@ -338,16 +396,15 @@ class ModelBuilder
                                        hints.clear
                                        bestd = d
                                end
-                               hints.add "`{c.name}`"
+                               hints.add "`{c.full_name}`"
                        end
                end
                if hints.not_empty then
-                       error(ntype, "Error: class `{name}` not found in module `{mmodule}`. Did you mean {hints.join(",", " or ")}?")
-                       return null
+                       error(qid, "Error: class `{qname}` not found in module `{mmodule}`. Did you mean {hints.join(",", " or ")}?")
+                       return
                end
 
-               error(ntype, "Error: class `{name}` not found in module `{mmodule}`.")
-               return null
+               error(qid, "Error: class `{name}` not found in module `{mmodule}`.")
        end
 
        # Return the static type associated to the node `ntype`.
@@ -472,3 +529,53 @@ redef class ADoc
                return res
        end
 end
+
+redef class AQclassid
+       # The name of the package part, if any
+       fun mpackname: nullable String do
+               var nqualified = n_qualified
+               if nqualified == null then return null
+               var nids = nqualified.n_id
+               if nids.length <= 0 then return null
+               return nids[0].text
+       end
+
+       # The name of the module part, if any
+       fun mmodname: nullable String do
+               var nqualified = n_qualified
+               if nqualified == null then return null
+               var nids = nqualified.n_id
+               if nids.length <= 1 then return null
+               return nids[1].text
+       end
+
+       # Does `mclass` match the full qualified name?
+       fun accept(mclass: MClass): Bool
+       do
+               if mclass.name != n_id.text then return false
+               var mpackname = self.mpackname
+               if mpackname != null then
+                       var mpackage = mclass.intro_mmodule.mpackage
+                       if mpackage == null then return false
+                       if mpackage.name != mpackname then return false
+                       var mmodname = self.mmodname
+                       if mmodname != null and mclass.intro_mmodule.name != mmodname then return false
+               end
+               return true
+       end
+
+       # The pretty name represented by self.
+       fun full_name: String
+       do
+               var res = n_id.text
+               var nqualified = n_qualified
+               if nqualified == null then return res
+               var ncid = nqualified.n_classid
+               if ncid != null then res = ncid.text + "::" + res
+               var nids = nqualified.n_id
+               if nids.not_empty then for n in nids.reverse_iterator do
+                       res = n.text + "::" + res
+               end
+               return res
+       end
+end
index 3897abc..e020b50 100644 (file)
@@ -46,8 +46,11 @@ redef class ModelBuilder
                var mvisibility: nullable MVisibility
                var arity = 0
                var names = new Array[String]
+               var mclass
                if nclassdef isa AStdClassdef then
-                       name = nclassdef.n_qid.n_id.text
+                       var qid = nclassdef.n_qid
+                       assert qid != null
+                       name = qid.n_id.text
                        nkind = nclassdef.n_classkind
                        mkind = nkind.mkind
                        nvisibility = nclassdef.n_visibility
@@ -74,6 +77,12 @@ redef class ModelBuilder
                                end
                                names.add(ptname)
                        end
+                       mclass = try_get_mclass_by_qid(qid, mmodule)
+                       if mclass == null and (qid.n_qualified != null or nclassdef.n_kwredef != null) then
+                               class_not_found(qid, mmodule)
+                               nclassdef.is_broken = true
+                               return
+                       end
 
                else if nclassdef isa ATopClassdef and nclassdef.n_propdefs.first.as(AMethPropdef).n_methid.collect_text == "sys" then
                        # Special case to keep `sys` in object.
@@ -84,15 +93,16 @@ redef class ModelBuilder
                        mkind = interface_kind
                        nvisibility = null
                        mvisibility = public_visibility
+                       mclass = try_get_mclass_by_name(nclassdef, mmodule, name)
                else
                        name = "Sys"
                        nkind = null
                        mkind = concrete_kind
                        nvisibility = null
                        mvisibility = public_visibility
+                       mclass = try_get_mclass_by_name(nclassdef, mmodule, name)
                end
 
-               var mclass = try_get_mclass_by_name(nclassdef, mmodule, name)
                if mclass == null then
                        if nclassdef isa AStdClassdef and nclassdef.n_kwredef != null then
                                error(nclassdef, "Redef Error: no imported class `{name}` to refine.")
diff --git a/tests/base_name_conflict.nit b/tests/base_name_conflict.nit
new file mode 100644 (file)
index 0000000..245ff36
--- /dev/null
@@ -0,0 +1,40 @@
+# 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 module_1
+import module_1b
+
+redef class module_1::A
+       fun foo do print(100)
+end
+
+redef class module_1b::A
+       fun foob do print(110)
+end
+
+#alt1#redef class A
+#alt1#end
+
+#alt2#redef class fail::A
+#alt2#end
+
+var a = new module_1::A
+a.a1
+a.foo
+#alt3#a.foob
+
+var b = new module_1b::A
+b.a1
+b.foob
+#alt3#b.foo
diff --git a/tests/error_names.nit b/tests/error_names.nit
new file mode 100644 (file)
index 0000000..a2eb360
--- /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.
+
+intrude import names::n0
+intrude import names::n1
+intrude import names::n2
+intrude import names::n3
+intrude import names1
+
+var a
+
+a = new A1
+a = new names::A1
+a = new names::n0::A1
+a = new names::n1::A1
+a = new names::n2::A1
+a = new names1::A1
+a = new names1::names1::A1
+
+a = new P1
+a = new names::P1
+a = new names::n0::P1
+a = new names::n1::P1
+a = new names::n2::P1
+a = new names1::P1
+a = new names1::names1::P1
index 77f46db..43ff426 100644 (file)
 import module_0
 
 class A # class 1
-   fun a1 
-   do 
-          print(1)
-          print(1)
-   end
-   fun a12 
-   do
-          print(12)
-          print(1)
-   end
-   fun a13
-   do
-          print(13) 
-          print(1)
-   end
-   fun a123 
-   do
-          print(123)
-          print(1)
-   end
+       fun a1
+       do
+               print(1)
+               print(1)
+       end
+       fun a12
+       do
+               print(12)
+               print(1)
+       end
+       fun a13
+       do
+               print(13)
+               print(1)
+       end
+       fun a123
+       do
+               print(123)
+               print(1)
+       end
 end
 
 class B # class 2
        super A
-   redef fun a12 
-   do
-          print(12)
-          print(2)
-   end
-   redef fun a123
-   do
-          print(123)
-          print(2)
-   end
-   fun all2
-   do
-          a1
-          a12
-          a13
-          a123
-   end
-   fun all25
-   do
-          print(250)
-          print(2)
-          a1
-          a12
-          a13
-          a123
-   end
+       redef fun a12
+       do
+               print(12)
+               print(2)
+       end
+       redef fun a123
+       do
+               print(123)
+               print(2)
+       end
+       fun all2
+       do
+               a1
+               a12
+               a13
+               a123
+       end
+       fun all25
+       do
+               print(250)
+               print(2)
+               a1
+               a12
+               a13
+               a123
+       end
 end
 
 var a = new A
diff --git a/tests/module_1b.nit b/tests/module_1b.nit
new file mode 100644 (file)
index 0000000..9bb9788
--- /dev/null
@@ -0,0 +1,39 @@
+# 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 module_0
+
+# Same code than `module_1`. Is used to cause name conflicts
+class A # class 1
+       fun a1
+       do
+               print(1)
+               print(10)
+       end
+       fun a12
+       do
+               print(12)
+               print(10)
+       end
+       fun a13
+       do
+               print(13)
+               print(10)
+       end
+       fun a123
+       do
+               print(123)
+               print(10)
+       end
+end
diff --git a/tests/names1.nit b/tests/names1.nit
new file mode 100644 (file)
index 0000000..f141a9b
--- /dev/null
@@ -0,0 +1,90 @@
+# 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.
+
+# An alternative second module in a distinct package
+module names1
+
+intrude import names::n0
+
+# A refinement of a class
+redef class A
+       # A refinement in the same class
+       redef fun a do end
+
+       # A refinement in the same class
+       redef fun z do end
+
+       # A public method introduced in a refinement
+       fun b do end
+end
+
+# A refinement of a subclass
+redef class A0
+       # A refinement+redefinition
+       redef fun a do end
+
+       # A refinement+redefinition
+       redef fun z do end
+
+       # A refinement+redefinition
+       redef fun p do end
+end
+
+# A subclass introduced in a submodule
+class A1
+       super A
+       super P
+
+       # A redefinition in a subclass from a different module
+       redef fun a do end
+
+       # A redefinition in a subclass from a different module
+       redef fun z do end
+
+       # A redefinition in a subclass from a different module
+       redef fun p do end
+end
+
+# A refinement of a class
+redef class P
+       # A refinement in the same class
+       redef fun p do end
+end
+
+# A refinement of a subclass
+redef class P0
+       # A refinement+redefinition
+       redef fun a do end
+
+       # A refinement+redefinition
+       redef fun z do end
+
+       # A refinement+redefinition
+       redef fun p do end
+end
+
+# A private subclass introduced in a different module
+private class P1
+       super A
+       super P
+
+       # A redefinition in a subclass from a different module
+       redef fun a do end
+
+       # A redefinition in a subclass from a different module
+       redef fun z do end
+
+       # A redefinition in a subclass from a different module
+       redef fun p do end
+end
diff --git a/tests/sav/base_name_conflict.res b/tests/sav/base_name_conflict.res
new file mode 100644 (file)
index 0000000..7099acd
--- /dev/null
@@ -0,0 +1,6 @@
+1
+1
+100
+1
+10
+110
diff --git a/tests/sav/base_name_conflict_alt1.res b/tests/sav/base_name_conflict_alt1.res
new file mode 100644 (file)
index 0000000..65c4078
--- /dev/null
@@ -0,0 +1 @@
+alt/base_name_conflict_alt1.nit:26,13: Error: ambiguous class name `A` in module `base_name_conflict_alt1`. Conflicts are between `module_1::A` and `module_1b::A`.
diff --git a/tests/sav/base_name_conflict_alt2.res b/tests/sav/base_name_conflict_alt2.res
new file mode 100644 (file)
index 0000000..a8c9d92
--- /dev/null
@@ -0,0 +1 @@
+alt/base_name_conflict_alt2.nit:29,13--19: Error: class `fail::A` not found in module `base_name_conflict_alt2`. Did you mean `module_1::A` or `module_1b::A`?
diff --git a/tests/sav/base_name_conflict_alt3.res b/tests/sav/base_name_conflict_alt3.res
new file mode 100644 (file)
index 0000000..d091756
--- /dev/null
@@ -0,0 +1,2 @@
+alt/base_name_conflict_alt3.nit:35,3--6: Error: method `foob` does not exists in `A`.
+alt/base_name_conflict_alt3.nit:40,3--5: Error: method `foo` does not exists in `A`.
diff --git a/tests/sav/error_names.res b/tests/sav/error_names.res
new file mode 100644 (file)
index 0000000..22991dc
--- /dev/null
@@ -0,0 +1,6 @@
+error_names.nit:23,9--10: Error: ambiguous class name `A1` in module `error_names`. Conflicts are between `names::A1` and `names1::A1`.
+error_names.nit:25,9--21: Error: class `names::n0::A1` not found in module `error_names`. Did you mean `names::A1` or `names1::A1`?
+error_names.nit:27,9--21: Error: class `names::n2::A1` not found in module `error_names`. Did you mean `names::A1` or `names1::A1`?
+error_names.nit:31,9--10: Error: ambiguous class name `P1` in module `error_names`. Conflicts are between `names::n1::P1` and `names1::names1::P1`.
+error_names.nit:33,9--21: Error: class `names::n0::P1` not found in module `error_names`. Did you mean `names::n1::P1` or `names1::names1::P1`?
+error_names.nit:35,9--21: Error: class `names::n2::P1` not found in module `error_names`. Did you mean `names::n1::P1` or `names1::names1::P1`?
index fdd119e..4ea4483 100644 (file)
@@ -1 +1 @@
-error_redef_class.nit:17,13--16: Redef Error: no imported class `Fail` to refine.
+error_redef_class.nit:17,13--16: Error: class `Fail` not found in module `error_redef_class`.
index 9794efd..82da2a7 100644 (file)
@@ -1,5 +1,5 @@
 error_type_not_ok5.nit:23,8--11: Error: class `Fail` not found in module `error_type_not_ok5`.
-error_type_not_ok5.nit:25,9--21: Error: class `Fail` not found in module `error_type_not_ok5`.
+error_type_not_ok5.nit:25,18--21: Error: class `Fail` not found in module `error_type_not_ok5`.
 error_type_not_ok5.nit:28,14--17: Error: class `Fail` not found in module `error_type_not_ok5`.
 error_type_not_ok5.nit:28,7--17: Type Error: expected `Char`, got `Bool`.
 error_type_not_ok5.nit:29,11--14: Error: class `Fail` not found in module `error_type_not_ok5`.
index ab9e44c..c9d481f 100644 (file)
@@ -1,2 +1,2 @@
 alt/error_type_unk_alt2.nit:9,8--11: Error: class `Fail` not found in module `error_type_unk_alt2`.
-alt/error_type_unk_alt2.nit:11,8--14: Error: class `Fail` not found in module `error_type_unk_alt2`.
+alt/error_type_unk_alt2.nit:11,8--11: Error: class `Fail` not found in module `error_type_unk_alt2`.
index 13326c8..451d363 100644 (file)
@@ -1,4 +1,4 @@
 error_unk_class.nit:16,9--12: Error: class `Fail` not found in module `error_unk_class`.
-error_unk_class.nit:17,9--15: Error: class `Boolean` not found in module `error_unk_class`. Did you mean `Bool`?
+error_unk_class.nit:17,9--15: Error: class `Boolean` not found in module `error_unk_class`. Did you mean `core::Bool`?
 error_unk_class.nit:18,9--16: Error: class `core::list::ListNode` not visible in module `error_unk_class`.
-error_unk_class.nit:19,9--13: Error: class `POSet` not found in module `error_unk_class`. Did you mean `Set`?
+error_unk_class.nit:19,9--13: Error: class `POSet` not found in module `error_unk_class`. Did you mean `core::Set`?
index 668ab56..a44ef6e 100644 (file)
@@ -1,4 +1,4 @@
 error_unk_class.nit:16,9--12: Error: class `Fail` not found in module `error_unk_class`.
-error_unk_class.nit:17,9--15: Error: class `Boolean` not found in module `error_unk_class`. Did you mean `Bool`?
+error_unk_class.nit:17,9--15: Error: class `Boolean` not found in module `error_unk_class`. Did you mean `core::Bool`?
 error_unk_class.nit:18,9--16: Error: class `core::list::ListNode` not visible in module `error_unk_class`.
 error_unk_class.nit:19,9--13: Error: class `POSet` not found in module `error_unk_class`. Maybe import `poset::poset`?
diff --git a/tests/sav/module_1b.res b/tests/sav/module_1b.res
new file mode 100644 (file)
index 0000000..573541a
--- /dev/null
@@ -0,0 +1 @@
+0
index 46ed3c4..2dd778a 100644 (file)
@@ -1,48 +1,48 @@
 All entities, including fictive ones:
  list:
-  MMethodDef: 33 (46.47%)
-  MClassDef: 15 (21.12%)
-  MMethod: 8 (11.26%)
-  MClass: 8 (11.26%)
-  MModule: 4 (5.63%)
-  MGroup: 1 (1.40%)
-  MPackage: 1 (1.40%)
-  Model: 1 (1.40%)
+  MMethodDef: 49 (49.49%)
+  MClassDef: 21 (21.21%)
+  MClass: 10 (10.10%)
+  MMethod: 9 (9.09%)
+  MModule: 5 (5.05%)
+  MGroup: 2 (2.02%)
+  MPackage: 2 (2.02%)
+  Model: 1 (1.01%)
 All entities:
  list:
-  MMethodDef: 33 (46.47%)
-  MClassDef: 15 (21.12%)
-  MMethod: 8 (11.26%)
-  MClass: 8 (11.26%)
-  MModule: 4 (5.63%)
-  MGroup: 1 (1.40%)
-  MPackage: 1 (1.40%)
-  Model: 1 (1.40%)
+  MMethodDef: 49 (49.49%)
+  MClassDef: 21 (21.21%)
+  MClass: 10 (10.10%)
+  MMethod: 9 (9.09%)
+  MModule: 5 (5.05%)
+  MGroup: 2 (2.02%)
+  MPackage: 2 (2.02%)
+  Model: 1 (1.01%)
 
 All non-private entities:
  list:
-  MMethodDef: 10 (29.41%)
-  MClassDef: 8 (23.52%)
-  MMethod: 5 (14.70%)
-  MClass: 4 (11.76%)
-  MModule: 4 (11.76%)
-  MGroup: 1 (2.94%)
-  MPackage: 1 (2.94%)
-  Model: 1 (2.94%)
+  MMethodDef: 14 (30.43%)
+  MClassDef: 11 (23.91%)
+  MMethod: 6 (13.04%)
+  MClass: 5 (10.86%)
+  MModule: 5 (10.86%)
+  MGroup: 2 (4.34%)
+  MPackage: 2 (4.34%)
+  Model: 1 (2.17%)
 
 All documented non-private entities:
  list:
 
 All public entities:
  list:
-  MMethodDef: 10 (29.41%)
-  MClassDef: 8 (23.52%)
-  MMethod: 5 (14.70%)
-  MClass: 4 (11.76%)
-  MModule: 4 (11.76%)
-  MGroup: 1 (2.94%)
-  MPackage: 1 (2.94%)
-  Model: 1 (2.94%)
+  MMethodDef: 14 (30.43%)
+  MClassDef: 11 (23.91%)
+  MMethod: 6 (13.04%)
+  MClass: 5 (10.86%)
+  MModule: 5 (10.86%)
+  MGroup: 2 (4.34%)
+  MPackage: 2 (4.34%)
+  Model: 1 (2.17%)
 
 All documented public entities:
  list:
@@ -51,58 +51,59 @@ Names:
 
 # Classes of entities
  population: 7
- minimum value: 1
- maximum value: 33
- total value: 70
- average value: 10.00
+ minimum value: 2
+ maximum value: 49
+ total value: 98
+ average value: 14.00
  distribution:
-  <=1: sub-population=2 (28.57%); cumulated value=2 (2.85%)
-  <=4: sub-population=1 (14.28%); cumulated value=4 (5.71%)
-  <=8: sub-population=2 (28.57%); cumulated value=16 (22.85%)
-  <=16: sub-population=1 (14.28%); cumulated value=15 (21.42%)
-  <=64: sub-population=1 (14.28%); cumulated value=33 (47.14%)
+  <=2: sub-population=2 (28.57%); cumulated value=4 (4.08%)
+  <=8: sub-population=1 (14.28%); cumulated value=5 (5.10%)
+  <=16: sub-population=2 (28.57%); cumulated value=19 (19.38%)
+  <=32: sub-population=1 (14.28%); cumulated value=21 (21.42%)
+  <=64: sub-population=1 (14.28%); cumulated value=49 (50.00%)
  list:
-  MMethodDef: 33 (47.14%)
-  MClassDef: 15 (21.42%)
-  MMethod: 8 (11.42%)
-  MClass: 8 (11.42%)
-  MModule: 4 (5.71%)
-  MGroup: 1 (1.42%)
-  MPackage: 1 (1.42%)
+  MMethodDef: 49 (50.00%)
+  MClassDef: 21 (21.42%)
+  MClass: 10 (10.20%)
+  MMethod: 9 (9.18%)
+  MModule: 5 (5.10%)
+  MGroup: 2 (2.04%)
+  MPackage: 2 (2.04%)
 
 # Name length of entities
- population: 70
+ population: 98
  minimum value: 5
- maximum value: 29
- total value: 1045
- average value: 14.92
+ maximum value: 44
+ total value: 1762
+ average value: 17.97
  distribution:
-  <=5: sub-population=1 (1.42%); cumulated value=5 (0.47%)
-  <=10: sub-population=13 (18.57%); cumulated value=109 (10.43%)
-  <=20: sub-population=44 (62.85%); cumulated value=637 (60.95%)
-  <=40: sub-population=12 (17.14%); cumulated value=294 (28.13%)
+  <=5: sub-population=1 (1.02%); cumulated value=5 (0.28%)
+  <=10: sub-population=17 (17.34%); cumulated value=141 (8.00%)
+  <=20: sub-population=48 (48.97%); cumulated value=706 (40.06%)
+  <=40: sub-population=30 (30.61%); cumulated value=822 (46.65%)
+  <=80: sub-population=2 (2.04%); cumulated value=88 (4.99%)
  list:
-  names::n3$::n1::P1$::n0::P::p: 29 (2.77%)
-  names::n1$::n0::P0$::n0::A::z: 29 (2.77%)
-  names::n1$::n0::P0$::n0::P::p: 29 (2.77%)
-  names::n3$::n1::P1$A::a: 23 (2.20%)
-  names::n1$A0$::n0::A::z: 23 (2.20%)
-  names::n1$A0$::n0::P::p: 23 (2.20%)
-  names::n0$P0$::n0::A::z: 23 (2.20%)
-  names::n0$P0$::n0::P::p: 23 (2.20%)
-  names::n3$A1$::n0::P::p: 23 (2.20%)
-  names::n1$::n0::P0$A::a: 23 (2.20%)
+  names1::names1$names::n0::P0$names::n0::P::p: 44 (2.49%)
+  names1::names1$names::n0::P0$names::n0::A::z: 44 (2.49%)
+  names1::names1$names::A0$names::n0::A::z: 40 (2.27%)
+  names1::names1$names::A0$names::n0::P::p: 40 (2.27%)
+  names1::names1$names::n0::P0$names::A::a: 40 (2.27%)
+  names1::names1$names::A0$names::A::a: 36 (2.04%)
+  names1::names1$P1$names::n0::P::p: 33 (1.87%)
+  names1::names1$P1$names::n0::A::z: 33 (1.87%)
+  names::n1$::n0::P0$::n0::A::z: 29 (1.64%)
+  names1::names1$P1$names::A::a: 29 (1.64%)
   ...
-  names::n0: 9 (0.86%)
-  names$A$z: 9 (0.86%)
-  names::A0: 9 (0.86%)
-  names::n3: 9 (0.86%)
-  names::A: 8 (0.76%)
-  names$A0: 8 (0.76%)
-  names$A1: 8 (0.76%)
-  names$A: 7 (0.66%)
-  names>: 6 (0.57%)
-  names: 5 (0.47%)
+  names::n3: 9 (0.51%)
+  names::n0: 9 (0.51%)
+  names::A: 8 (0.45%)
+  names$A0: 8 (0.45%)
+  names$A1: 8 (0.45%)
+  names$A: 7 (0.39%)
+  names1>: 7 (0.39%)
+  names1: 6 (0.34%)
+  names>: 6 (0.34%)
+  names: 5 (0.28%)
 
 # All entities
 names  MPackage        Group of modules used to test various full_name configurations and conflicts.
@@ -175,3 +176,31 @@ names::n2::P       MClass
 names::n2$P    MClassDef       Name conflict? A second private class
 names::n2::P::p        MMethod 
 names::n2$P$p  MMethodDef      Name conflict? A private method in an homonym class.
+names1 MPackage        An alternative second module in a distinct package
+names1>        MGroup  An alternative second module in a distinct package
+names1::names1 MModule An alternative second module in a distinct package
+names1::names1$names::A        MClassDef       A refinement of a class
+names1::names1$names::A$a      MMethodDef      A refinement in the same class
+names1::names1$names::A$z      MMethodDef      A refinement in the same class
+names1::names1::A::b   MMethod 
+names1::names1$names::A$b      MMethodDef      A public method introduced in a refinement
+names1::names1$names::A0       MClassDef       A refinement of a subclass
+names1::names1$names::A0$names::A::a   MMethodDef      A refinement+redefinition
+names1::names1$names::A0$names::n0::A::z       MMethodDef      A refinement+redefinition
+names1::names1$names::A0$names::n0::P::p       MMethodDef      A refinement+redefinition
+names1::A1     MClass  
+names1$A1      MClassDef       A subclass introduced in a submodule
+names1$A1$names::A::a  MMethodDef      A redefinition in a subclass from a different module
+names1$A1$names::n0::A::z      MMethodDef      A redefinition in a subclass from a different module
+names1$A1$names::n0::P::p      MMethodDef      A redefinition in a subclass from a different module
+names1::names1$names::n0::P    MClassDef       A refinement of a class
+names1::names1$names::n0::P$p  MMethodDef      A refinement in the same class
+names1::names1$names::n0::P0   MClassDef       A refinement of a subclass
+names1::names1$names::n0::P0$names::A::a       MMethodDef      A refinement+redefinition
+names1::names1$names::n0::P0$names::n0::A::z   MMethodDef      A refinement+redefinition
+names1::names1$names::n0::P0$names::n0::P::p   MMethodDef      A refinement+redefinition
+names1::names1::P1     MClass  
+names1::names1$P1      MClassDef       A private subclass introduced in a different module
+names1::names1$P1$names::A::a  MMethodDef      A redefinition in a subclass from a different module
+names1::names1$P1$names::n0::A::z      MMethodDef      A redefinition in a subclass from a different module
+names1::names1$P1$names::n0::P::p      MMethodDef      A redefinition in a subclass from a different module
index 0d0a834..11a4b28 100644 (file)
@@ -1,2 +1,2 @@
 base_simple3.nit
-names/n3.nit
+names/n3.nit names1.nit -I .