diff scripts/help/warning_ids.m @ 27517:85ad4689aa05

Add warning when non-scalar argument presented to ':' range operator. * NEWS: Announce new warning IDs Octave:colon-nonscalar-argument, Octave:colon-complex-argument. * basics.txi: Document that warning Octave:colon-nonscalar-argument is turned off when --traditional mode is used. * interpreter.cc (interpreter::maximum_braindamage): Disable Octave:colon-nonscalar-argument when --traditional used. * ov.cc (do_colon_op): Check that numel() == 1 for base, limit, and increment, or call warning_with_id. Change warning() to warning_with_id call for Octave:colon-complex-argument. * warning_ids.m: Document new warning IDs Octave:colon-nonscalar-argument, Octave:colon-complex-argument. * edit.m (default_user): Fix code that emitted a colon warning.
author Rik <rik@octave.org>
date Wed, 16 Oct 2019 13:49:19 -0700
parents 2fd1ee5574d7
children b442ec6dda5c
line wrap: on
line diff
--- a/scripts/help/warning_ids.m	Wed Oct 16 13:35:08 2019 -0400
+++ b/scripts/help/warning_ids.m	Wed Oct 16 13:49:19 2019 -0700
@@ -140,6 +140,20 @@
 ## By default, the @code{Octave:built-in-variable-assignment} warning is
 ## enabled.
 ##
+## @item Octave:colon-complex-argument
+## If the @code{Octave:colon-complex-argument} warning is enabled, a warning
+## is issued when one of the three arguments to the colon operator (base,
+## increment, limit) is a complex value.  For example, @code{1:3*i} will
+## cause a warning to be emitted.
+## By default, the @code{Octave:colon-complex-argument} warning is enabled.
+##
+## @item Octave:colon-nonscalar-argument
+## If the @code{Octave:colon-nonscalar-argument} warning is enabled, a warning
+## is issued when one of the three arguments to the colon operator (base,
+## increment, limit) is not a scalar.  For example, @code{1:[3, 5]} will
+## cause a warning to be emitted.
+## By default, the @code{Octave:colon-nonscalar-argument} warning is enabled.
+##
 ## @item Octave:data-file-in-path
 ## If the @code{Octave:data-file-in-path} warning is enabled, a warning is
 ## issued when Octave does not find the target of a file operation such as