From 4d08a75865ad15d706fe42cf45670c9fcaaffdca Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20MOTTELET?= Date: Wed, 19 Jun 2019 17:03:57 +0200 Subject: [PATCH] * Bug 16122 fixed: now concat polynomials with <> var raises an error http://bugzilla.scilab.org/show_bug.cgi?id=16122 Raises the same error (missing overload) as when trying to do some algebra with polymials having different var. Change-Id: I86de5fdce36b04aea55429172eadfa0fb85894af --- scilab/CHANGES.md | 3 ++- scilab/modules/ast/src/cpp/ast/visitor_common.cpp | 5 +++++ .../modules/ast/tests/nonreg_tests/bug_16122.tst | 21 ++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 scilab/modules/ast/tests/nonreg_tests/bug_16122.tst diff --git a/scilab/CHANGES.md b/scilab/CHANGES.md index a8d211d..2f3fb16 100644 --- a/scilab/CHANGES.md +++ b/scilab/CHANGES.md @@ -276,6 +276,7 @@ Bug Fixes * [#15839](https://bugzilla.scilab.org/15839): `gsort`: the only sparse possible input were real or complex vectors, and only with the `g` method. * [#15842](https://bugzilla.scilab.org/15842): `unique` could not process 2D sparse matrices. * [#16106](https://bugzilla.scilab.org/16106): Xcos sciblk4 user-defined blocks did not handle opar and odstate/oz correctly. +* [#16122](https://bugzilla.scilab.org/16122): concat polynomials with <> var did not raise an error. * [#16274](https://bugzilla.scilab.org/16274): assert_checkequal() did not considered equal matching Nan or void elements in (nested) containers. * [#16337](https://bugzilla.scilab.org/16337): The 3rd output of `[U,km,ku] = unique(..)` was not implemented. * [#16342](https://bugzilla.scilab.org/16342): `strcat()` was much slower in Scilab 6.0.2. @@ -551,4 +552,4 @@ Bug Fixes * [#16373](https://bugzilla.scilab.org/16373): Scilab Crashed or showing wrong output when running on Arm processor * [#16459](https://bugzilla.scilab.org/16459): The display of one column hypermatrix was wrong. * [#16463](https://bugzilla.scilab.org/16463): `matrix(sparse([]),[0 0])` yielded `[]` instead of `sparse([])`. -* [#16483](https://bugzilla.scilab.org/16483): substraction of complex polynomial matrices was broken (Scilab 6 regression). \ No newline at end of file +* [#16483](https://bugzilla.scilab.org/16483): substraction of complex polynomial matrices was broken (Scilab 6 regression). diff --git a/scilab/modules/ast/src/cpp/ast/visitor_common.cpp b/scilab/modules/ast/src/cpp/ast/visitor_common.cpp index 3e3ead4..e5a924d 100644 --- a/scilab/modules/ast/src/cpp/ast/visitor_common.cpp +++ b/scilab/modules/ast/src/cpp/ast/visitor_common.cpp @@ -486,6 +486,11 @@ types::InternalType* AddElementToVariable(types::InternalType* _poDest, types::I poResult->getAs()->append(iCurRow, iCurCol, _poSource); break; case types::InternalType::ScilabPolynom: + if (poResult->getAs()->getVariableName() != _poSource->getAs()->getVariableName()) + { + // call overload + return NULL; + } poResult->getAs()->append(iCurRow, iCurCol, _poSource); break; case types::InternalType::ScilabBool: diff --git a/scilab/modules/ast/tests/nonreg_tests/bug_16122.tst b/scilab/modules/ast/tests/nonreg_tests/bug_16122.tst new file mode 100644 index 0000000..33b2ff9 --- /dev/null +++ b/scilab/modules/ast/tests/nonreg_tests/bug_16122.tst @@ -0,0 +1,21 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2019 - Stéphane MOTTELET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// <-- NO CHECK REF --> +// +// <-- Non-regression test for bug 16122 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/16122 +// +// <-- Short Description --> +// polynomials with different variables are concatenated without error + +message = [ msprintf(gettext("Undefined operation for the given operands.\n")) + msprintf(gettext("check or define function %s for overloading.\n"),"%p_c_p")]; +assert_checkerror("[%s,%z]",message) \ No newline at end of file -- 1.7.9.5