Index: TODO =================================================================== diff -u -rc4db8ed59a42cf23cc9a7eac511e556d6b077f14 -r1b583476882fea7df04664f551cf87d99c8a0da0 --- TODO (.../TODO) (revision c4db8ed59a42cf23cc9a7eac511e556d6b077f14) +++ TODO (.../TODO) (revision 1b583476882fea7df04664f551cf87d99c8a0da0) @@ -1861,6 +1861,13 @@ - added functionality to use ":attribute contains:method,nosetter" - added regression test for contains and attributes of type method +- activated SKIP_LAMBDA in nsfCallstack. As a consequence, we + disallow resolving self/my ... from tcl-proc frames + (use uplevel if necessary, avoid "namespace eval") + +- improving error messages from argument parser +- test "namespace current" and "self" in "contains" and "slots" regression test + TODO: - add "nosetter" automatically, when attribute ...:method is used Index: generic/nsf.c =================================================================== diff -u -rdb2dcddd4328ce68ddf06905ffccda392fb1aa0f -r1b583476882fea7df04664f551cf87d99c8a0da0 --- generic/nsf.c (.../nsf.c) (revision db2dcddd4328ce68ddf06905ffccda392fb1aa0f) +++ generic/nsf.c (.../nsf.c) (revision 1b583476882fea7df04664f551cf87d99c8a0da0) @@ -11606,10 +11606,22 @@ * Handle missing or unexpected arguments for methods and cmds */ if (pcPtr->lastobjc < nrReq) { - return ArgumentError(interp, "not enough arguments:", paramPtr, NULL, procNameObj); + return ArgumentError(interp, "not enough arguments:", paramPtr, + object ? object->cmdName : NULL, + procNameObj); } if (!pcPtr->varArgs && objc-nrDashdash-1 > nrReq + nrOpt) { - return ArgumentError(interp, "too many arguments:", paramPtr, NULL, procNameObj); + Tcl_DString ds, *dsPtr = &ds; + DSTRING_INIT(dsPtr); + Tcl_DStringAppend(dsPtr, "Invalid argument '", -1); + Tcl_DStringAppend(dsPtr, ObjStr(objv[pcPtr->lastobjc]), -1); + Tcl_DStringAppend(dsPtr, "', maybe too many arguments;", -1); + fprintf(stderr, "processing %s\n",ObjStr(objv[pcPtr->lastobjc])); + return ArgumentError(interp, Tcl_DStringValue(dsPtr), paramPtr, + object ? object->cmdName : NULL, + procNameObj); + DSTRING_FREE(dsPtr); + return TCL_ERROR; } return ArgumentDefaults(pcPtr, interp, paramPtr, nrParams); Index: library/xotcl/tests/slottest.xotcl =================================================================== diff -u -rf69e0909fcb180e1cbcdd316f0a20de1b254af3d -r1b583476882fea7df04664f551cf87d99c8a0da0 --- library/xotcl/tests/slottest.xotcl (.../slottest.xotcl) (revision f69e0909fcb180e1cbcdd316f0a20de1b254af3d) +++ library/xotcl/tests/slottest.xotcl (.../slottest.xotcl) (revision 1b583476882fea7df04664f551cf87d99c8a0da0) @@ -46,9 +46,23 @@ ? {c1 set x} 1 ? {set ::hu} 1 +proc ?? {cmd expected {msg ""}} { + #puts "??? $cmd" + set r [uplevel $cmd] + if {$msg eq ""} {set msg $cmd} + if {$r ne $expected} { + puts stderr "ERROR $msg returned '$r' ne '$expected'" + error "FAILED $msg returned '$r' ne '$expected'" + } else { + puts stderr "OK $msg" + } +} + Class D -slots { Attribute create x -defaultcmd {set x 2} Attribute create z -defaultcmd {my trace add variable z read T2} + ?? self ::D + ?? {namespace current} ::D::slot } -superclass C D create c1 ? {c1 set x} 2 Index: library/xotcl/tests/testx.xotcl =================================================================== diff -u -r18d4d9c1a99310c3fb9b2f2bed03e9d59fb30d30 -r1b583476882fea7df04664f551cf87d99c8a0da0 --- library/xotcl/tests/testx.xotcl (.../testx.xotcl) (revision 18d4d9c1a99310c3fb9b2f2bed03e9d59fb30d30) +++ library/xotcl/tests/testx.xotcl (.../testx.xotcl) (revision 1b583476882fea7df04664f551cf87d99c8a0da0) @@ -3996,15 +3996,20 @@ catch { o y 4 56 5 } m - errorCheck $m {too many arguments: should be "y ?-x value? ?-a value? a b"} "wrong \# check 1" + errorCheck $m \ + {Invalid argument '56', maybe too many arguments; should be "::o y ?-x value? ?-a value? a b"} \ + "wrong \# check 1" + catch { o y } m - errorCheck $m {not enough arguments: should be "y ?-x value? ?-a value? a b"} "wrong \# check 2" + errorCheck $m {not enough arguments: should be "::o y ?-x value? ?-a value? a b"} "wrong \# check 2" + catch { o y -x 1 } m errorCheck $m {::o y: required argument 'a' is missing} "wrong \# check 3" + catch { o z1 a 1 2 3 } m Index: tests/contains.test =================================================================== diff -u -rc4db8ed59a42cf23cc9a7eac511e556d6b077f14 -r1b583476882fea7df04664f551cf87d99c8a0da0 --- tests/contains.test (.../contains.test) (revision c4db8ed59a42cf23cc9a7eac511e556d6b077f14) +++ tests/contains.test (.../contains.test) (revision 1b583476882fea7df04664f551cf87d99c8a0da0) @@ -36,9 +36,11 @@ # set x [Tree create 1 -label 1 -contains { ? {self} ::1 + ? {namespace current} ::1 Tree create 1.1 -label 1.1 Tree create 1.2 -label 1.2 -contains { ? {self} ::1::1.2 + ? {namespace current} ::1::1.2 Tree create 1.2.1 -label 1.2.1 Tree create 1.2.2 -label 1.2.2 -contains { Tree create 1.2.2.1 -label 1.2.2.1