From df5a817e0476f761263e6731e70f275f965bc192 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Mottelet?= Date: Mon, 8 Oct 2018 17:31:35 +0200 Subject: [PATCH] * Bug 15497 fixed: now after s.a=list(1), type(s("a")) is 15 http://bugzilla.scilab.org/show_bug.cgi?id=15497 Change-Id: I0ddc1d09c7216817bc3f9d5b566e8e13577731af --- scilab/CHANGES.md | 1 + scilab/modules/ast/src/cpp/types/struct.cpp | 10 +------- .../modules/ast/tests/nonreg_tests/bug_15497.tst | 26 ++++++++++++++++++++ 3 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 scilab/modules/ast/tests/nonreg_tests/bug_15497.tst diff --git a/scilab/CHANGES.md b/scilab/CHANGES.md index a3bcf42..80e235c 100644 --- a/scilab/CHANGES.md +++ b/scilab/CHANGES.md @@ -536,6 +536,7 @@ Known issues * [#15489](http://bugzilla.scilab.org/show_bug.cgi?id=15489): Help pages of `covStart`, `covStop`, `covWrite` and `covMerge` were not built for the fr, ja, pt and ru languages, and were unreachable from a session in non `en_US` language. * [#15495](http://bugzilla.scilab.org/show_bug.cgi?id=15495): SampleCLK simple demo failed to simulate. * [#15496](http://bugzilla.scilab.org/show_bug.cgi?id=15496): Scinotes `File > Open recent` menu was not updated when it should. +* [#15497](http://bugzilla.scilab.org/show_bug.cgi?id=15497): After `s.a=list(1)`, `type(s("a"))` was `1`. * [#15499](http://bugzilla.scilab.org/show_bug.cgi?id=15499): Scinotes menus were inactive after session restore under OSX. * [#15501](http://bugzilla.scilab.org/show_bug.cgi?id=15501): listvarinfile() crashes Scilab when listing a cell array (regression). * [#15502](http://bugzilla.scilab.org/show_bug.cgi?id=15502): listvarinfile() misses listing arrays of struct, and then locks the file. diff --git a/scilab/modules/ast/src/cpp/types/struct.cpp b/scilab/modules/ast/src/cpp/types/struct.cpp index 8675326..e810390 100644 --- a/scilab/modules/ast/src/cpp/types/struct.cpp +++ b/scilab/modules/ast/src/cpp/types/struct.cpp @@ -175,6 +175,7 @@ bool Struct::extract(const std::wstring & name, InternalType *& out) bool Struct::invoke(typed_list & in, optional_list & opt, int _iRetCount, typed_list & out, const ast::Exp & e) { + if (in.size() == 0) { out.push_back(this); @@ -204,15 +205,6 @@ bool Struct::invoke(typed_list & in, optional_list & opt, int _iRetCount, typed_ } _out = extractFields(wstFields); - if (_out.size() == 1) - { - InternalType * pIT = _out[0]; - if (pIT->isList() && pIT->getAs()->getSize() == 1) - { - out.push_back(pIT->getAs()->get(0)); - return true; - } - } out.swap(_out); return true; diff --git a/scilab/modules/ast/tests/nonreg_tests/bug_15497.tst b/scilab/modules/ast/tests/nonreg_tests/bug_15497.tst new file mode 100644 index 0000000..515514b --- /dev/null +++ b/scilab/modules/ast/tests/nonreg_tests/bug_15497.tst @@ -0,0 +1,26 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2018 - Clement DAVID +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// <-- NO CHECK REF --> +// +// <-- Non-regression test for bug 15497 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/15497 +// +// <-- Short Description --> +// Structures containing lists with 1 element : wrong type with syntax: structure("field") + +s.a = list(3.1415); +assert_checkequal(type(s), 17); +assert_checkequal(type(s.a), 15); +assert_checkequal(type(s.a(1)), 1); + +assert_checkequal(type(s), 17); +assert_checkequal(type(s("a")), 15); +assert_checkequal(type(s("a")(1)), 1); -- 1.7.9.5