From: Jean Privat Date: Wed, 20 Dec 2017 14:20:23 +0000 (-0500) Subject: niti: fix constructors with an empty return X-Git-Url: http://nitlanguage.org niti: fix constructors with an empty return fixes #2546 Signed-off-by: Jean Privat --- diff --git a/src/interpreter/naive_interpreter.nit b/src/interpreter/naive_interpreter.nit index 5ccc8da..6c86223 100644 --- a/src/interpreter/naive_interpreter.nit +++ b/src/interpreter/naive_interpreter.nit @@ -1702,6 +1702,8 @@ redef class AEscapeExpr var i = v.expr(ne) if i == null then return v.escapevalue = i + else + v.escapevalue = null end v.escapemark = self.escapemark end diff --git a/tests/base_init_ret.nit b/tests/base_init_ret.nit new file mode 100644 index 0000000..cdfb88e --- /dev/null +++ b/tests/base_init_ret.nit @@ -0,0 +1,23 @@ +# 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 core::kernel + +class A + init + do + return + end +end +(new A).output_class_name diff --git a/tests/sav/base_init_ret.res b/tests/sav/base_init_ret.res new file mode 100644 index 0000000..f70f10e --- /dev/null +++ b/tests/sav/base_init_ret.res @@ -0,0 +1 @@ +A