From: Jean Privat Date: Sat, 16 Aug 2014 01:09:21 +0000 (-0400) Subject: tests: add base_init_super_call3.nit and it does not stack-overflow X-Git-Tag: v0.6.8~15^2 X-Git-Url: http://nitlanguage.org?hp=-c tests: add base_init_super_call3.nit and it does not stack-overflow Signed-off-by: Jean Privat --- 801c36bd3184b9c5830d6a0cd7fba7659a7881ed diff --git a/tests/base_init_super_call3.nit b/tests/base_init_super_call3.nit new file mode 100644 index 0000000..430026d --- /dev/null +++ b/tests/base_init_super_call3.nit @@ -0,0 +1,101 @@ +# 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 + init(i: Int) do i.output +end + +class B + super A + init(i) + do + super + (i+1).output + end +end + +class C + super A + init(i) + do + (i+1).output + super + end +end + +class D + super A + init(i) + is + nosuper + do + (i+1).output + end +end + +class E + super A + init(i) + do + (i+1).output + end +end + +class F + super A + redef init(i) + do + super + (i+1).output + end +end + +class G + super A + redef init(i) + do + (i+1).output + super + end +end + +class H + super A + redef init(i) + is + nosuper + do + (i+1).output + end +end + +class I + super A + redef init(i) + do + (i+1).output + end +end + +var a = new A(10) +var b = new B(20) +var c = new C(30) +var d = new D(40) +var e = new E(50) +var f = new F(60) +var g = new G(70) +var h = new H(80) +var i = new I(90) diff --git a/tests/sav/base_init_super_call3.res b/tests/sav/base_init_super_call3.res new file mode 100644 index 0000000..aa7d0fd --- /dev/null +++ b/tests/sav/base_init_super_call3.res @@ -0,0 +1,15 @@ +10 +20 +21 +31 +30 +41 +50 +51 +60 +61 +71 +70 +81 +90 +91