summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2014-09-10 08:24:59 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2014-09-10 08:24:59 (GMT)
commit893b3f3b6945cbed2de0e75bf3b0ce06ceaf391c (patch)
treedd2cb87a1afb416ea575ca2e1208ddd2b672ea6e
parente19c2ce585d7fe309059bb96044b08dbfa850a6b (diff)
parent186cc4a17e82ce9bd90edccc45ab943c63b40c30 (diff)
downloadtcl-893b3f3b6945cbed2de0e75bf3b0ce06ceaf391c.zip
tcl-893b3f3b6945cbed2de0e75bf3b0ce06ceaf391c.tar.gz
tcl-893b3f3b6945cbed2de0e75bf3b0ce06ceaf391c.tar.bz2
[2486824] Improve error message; not all that upvars is an upvar.
-rw-r--r--generic/tclVar.c9
-rw-r--r--tests/upvar.test3
-rw-r--r--tests/var.test2
3 files changed, 6 insertions, 8 deletions
diff --git a/generic/tclVar.c b/generic/tclVar.c
index 5e3157e..ec4c13c 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -4405,8 +4405,8 @@ ObjMakeUpvar(
|| !HasLocalVars(varFramePtr)
|| (strstr(TclGetString(myNamePtr), "::") != NULL))) {
Tcl_SetObjResult((Tcl_Interp *) iPtr, Tcl_ObjPrintf(
- "bad variable name \"%s\": upvar won't create "
- "namespace variable that refers to procedure variable",
+ "bad variable name \"%s\": can't create namespace "
+ "variable that refers to procedure variable",
TclGetString(myNamePtr)));
Tcl_SetErrorCode(interp, "TCL", "UPVAR", "INVERTED", NULL);
return TCL_ERROR;
@@ -4506,9 +4506,8 @@ TclPtrObjMakeUpvar(
*/
Tcl_SetObjResult((Tcl_Interp *) iPtr, Tcl_ObjPrintf(
- "bad variable name \"%s\": upvar won't create a"
- " scalar variable that looks like an array element",
- myName));
+ "bad variable name \"%s\": can't create a scalar "
+ "variable that looks like an array element", myName));
Tcl_SetErrorCode(interp, "TCL", "UPVAR", "LOCAL_ELEMENT",
NULL);
return TCL_ERROR;
diff --git a/tests/upvar.test b/tests/upvar.test
index e93f58a..5ea870d 100644
--- a/tests/upvar.test
+++ b/tests/upvar.test
@@ -339,7 +339,7 @@ test upvar-8.9 {upvar won't create namespace variable that refers to procedure v
unset ::test_ns_1::a
}
MakeLink 1
-} -result {bad variable name "a": upvar won't create namespace variable that refers to procedure variable}
+} -result {bad variable name "a": can't create namespace variable that refers to procedure variable}
test upvar-8.10 {upvar will create element alias for new array element} -setup {
catch {unset upvarArray}
} -body {
@@ -578,7 +578,6 @@ test upvar-NS-3.3 {CompileWord OBOE} -setup {
} -cleanup {
rename linenumber {}
} -result 1
-
# cleanup
::tcltest::cleanupTests
diff --git a/tests/var.test b/tests/var.test
index 208b361..8e862f7 100644
--- a/tests/var.test
+++ b/tests/var.test
@@ -289,7 +289,7 @@ test var-3.11 {MakeUpvar, my var looks like array elem} -setup {
} -returnCodes error -body {
set aaaaa 789789
upvar #0 aaaaa foo(bar)
-} -result {bad variable name "foo(bar)": upvar won't create a scalar variable that looks like an array element}
+} -result {bad variable name "foo(bar)": can't create a scalar variable that looks like an array element}
test var-4.1 {Tcl_GetVariableName, global variable} testgetvarfullname {
catch {unset a}