# HG changeset patch # User John W. Eaton # Date 1594314294 14400 # Node ID 605b9e811bf30eb08df8908ea707935e0e2da7e0 # Parent 1c0a4e1b973ede2060b8c40c75bcb0a4496bffb5# Parent 66397e171801d964a7bda61acdf1890fb554e05d maint: merge stable to default. diff -r 1c0a4e1b973e -r 605b9e811bf3 libgui/src/m-editor/octave-qscintilla.cc --- a/libgui/src/m-editor/octave-qscintilla.cc Wed Jul 08 08:15:27 2020 -0400 +++ b/libgui/src/m-editor/octave-qscintilla.cc Thu Jul 09 13:04:54 2020 -0400 @@ -810,7 +810,7 @@ // Take selected code and extend it by commands for echoing each // evaluated line and for adding the line to the history (use script) QString code = QString (); - QString hist = QString ("### Begin selected code\n"); + QString hist = QString (); // Split contents into single lines and complete commands QStringList lines = selectedText ().split (QRegExp ("[\r\n]"), @@ -840,7 +840,6 @@ hist += line_history + "\n"; } - hist += "### End selected code\n"; octave_stdout << hist.toStdString () << "\n"; // Create tmp file with the code to be executed by the interpreter diff -r 1c0a4e1b973e -r 605b9e811bf3 libinterp/octave-value/ov-struct.cc --- a/libinterp/octave-value/ov-struct.cc Wed Jul 08 08:15:27 2020 -0400 +++ b/libinterp/octave-value/ov-struct.cc Thu Jul 09 13:04:54 2020 -0400 @@ -146,6 +146,9 @@ const Cell t = tmp.index (idx.front ()); + // Avoid creating a comma-separated list if the result is a + // single element. + retval(0) = (t.numel () == 1) ? t(0) : octave_value (t, true); // We handled two index elements, so tell @@ -162,8 +165,10 @@ { const Cell t = dotref (idx.front ()); - if (! map.isempty ()) - retval(0) = (t.numel () == 1) ? t(0) : octave_value (t, true); + // Avoid creating a comma-separated list if the result is a + // single element. + + retval(0) = (t.numel () == 1) ? t(0) : octave_value (t, true); } break; @@ -207,6 +212,9 @@ const Cell t = tmp.index (idx.front (), auto_add); + // Avoid creating a comma-separated list if the result is a + // single element. + retval = (t.numel () == 1) ? t(0) : octave_value (t, true); // We handled two index elements, so tell @@ -225,6 +233,9 @@ { const Cell t = dotref (idx.front (), auto_add); + // Avoid creating a comma-separated list if the result is a + // single element. + retval = (t.numel () == 1) ? t(0) : octave_value (t, true); } } diff -r 1c0a4e1b973e -r 605b9e811bf3 libinterp/parse-tree/oct-parse.yy --- a/libinterp/parse-tree/oct-parse.yy Wed Jul 08 08:15:27 2020 -0400 +++ b/libinterp/parse-tree/oct-parse.yy Thu Jul 09 13:04:54 2020 -0400 @@ -3774,8 +3774,10 @@ { tree_function_def *retval = nullptr; - if (ret_list) - ret_list->mark_as_formal_parameters (); + if (! ret_list) + ret_list = new tree_parameter_list (tree_parameter_list::out); + + ret_list->mark_as_formal_parameters (); if (fcn) { @@ -4200,8 +4202,10 @@ tree_parameter_list *ret_list, comment_list *cl) { - if (ret_list) - fcn->define_ret_list (ret_list); + if (! ret_list) + ret_list = new tree_parameter_list (tree_parameter_list::out); + + fcn->define_ret_list (ret_list); if (cl) fcn->stash_leading_comment (cl); diff -r 1c0a4e1b973e -r 605b9e811bf3 libinterp/parse-tree/pt-tm-const.cc --- a/libinterp/parse-tree/pt-tm-const.cc Wed Jul 08 08:15:27 2020 -0400 +++ b/libinterp/parse-tree/pt-tm-const.cc Thu Jul 09 13:04:54 2020 -0400 @@ -171,7 +171,7 @@ octave_value tmp = elt->evaluate (tw); if (tmp.is_undefined ()) - continue; + error ("undefined element in matrix list"); if (tmp.is_cs_list ()) { @@ -935,18 +935,11 @@ %!shared es %! es = struct ("a", {}); %! -%!assert <58695> ([1, es.a, 3], [1, 3]) -%!assert <58695> ([1, my_undef(), 3], [1, 3]) -%! -%!assert <58695> ([es.a, es.a, 3], 3) -%!assert <58695> ([my_undef(), my_undef(), 3], 3) -%! %!assert <58695> ([1; es.a; 3], [1; 3]) -%!assert <58695> ([1; my_undef(), 3], [1; 3]) +%!test <58695> +%! fail ("undefined element in matrix list", "[1; my_undef(), 3]"); %! %!assert <58695> ([es.a; es.a; 3], 3) -%!assert <58695> ([my_undef(); my_undef(); 3], 3) -%! -%!assert <58695> ([es.a; es.a; 3], 3) -%!assert <58695> ([my_undef(); my_undef(); 3], 3) +%!test <58695> +%! fail ("undefined element in matrix list", "[my_undef(); my_undef(); 3]") */