From: Jean Privat Date: Mon, 17 Nov 2014 22:55:25 +0000 (-0500) Subject: Merge: Force standard as public X-Git-Tag: v0.6.11~31 X-Git-Url: http://nitlanguage.org?hp=0dd740f6e5003f9c9e5a197fe9ccc9feda260853 Merge: Force standard as public Standard me become privately imported when importing only modules privately. Thus, some sub-modules cannot see standard. This PR force standard to be always public if it is imported. Close #909 Pull-Request: #913 Reviewed-by: Lucas Bajolet Reviewed-by: Alexandre Terrasa --- diff --git a/src/modelbuilder.nit b/src/modelbuilder.nit index 83f5e0e..1ae7e45 100644 --- a/src/modelbuilder.nit +++ b/src/modelbuilder.nit @@ -705,6 +705,13 @@ class ModelBuilder self.toolcontext.info("{mmodule} imports {imported_modules.join(", ")}", 3) mmodule.set_imported_mmodules(imported_modules) + # Force standard to be public if imported + for sup in mmodule.in_importation.greaters do + if sup.name == "standard" then + mmodule.set_visibility_for(sup, public_visibility) + end + end + # TODO: Correctly check for useless importation # It is even doable? var directs = mmodule.in_importation.direct_greaters diff --git a/tests/base_import_standard.nit b/tests/base_import_standard.nit new file mode 100644 index 0000000..2e76488 --- /dev/null +++ b/tests/base_import_standard.nit @@ -0,0 +1,17 @@ +# 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. + +private import template + +print 1 diff --git a/tests/base_import_standard2.nit b/tests/base_import_standard2.nit new file mode 100644 index 0000000..da5111e --- /dev/null +++ b/tests/base_import_standard2.nit @@ -0,0 +1,17 @@ +# 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_import_standard + +print 2 diff --git a/tests/sav/base_import_standard.res b/tests/sav/base_import_standard.res new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/tests/sav/base_import_standard.res @@ -0,0 +1 @@ +1 diff --git a/tests/sav/base_import_standard2.res b/tests/sav/base_import_standard2.res new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/tests/sav/base_import_standard2.res @@ -0,0 +1 @@ +2