Index: TODO =================================================================== diff -u -ra6e6e5de115f92c579b867bb88323a9916aec4d4 -r6a3cd1a111aa693839ec3d788262ce18be74bf91 --- TODO (.../TODO) (revision a6e6e5de115f92c579b867bb88323a9916aec4d4) +++ TODO (.../TODO) (revision 6a3cd1a111aa693839ec3d788262ce18be74bf91) @@ -3911,6 +3911,8 @@ refcounting on the value. - use Tcl's EXTERN macro instead of "extern" +- treating incompatible forwarding to slot vs. slot option noaccessor +- extended regression test ======================================================================== TODO: Index: library/nx/nx.tcl =================================================================== diff -u -r764405083cfd6152d6956674e54f3a77cf7e1dcd -r6a3cd1a111aa693839ec3d788262ce18be74bf91 --- library/nx/nx.tcl (.../nx.tcl) (revision 764405083cfd6152d6956674e54f3a77cf7e1dcd) +++ library/nx/nx.tcl (.../nx.tcl) (revision 6a3cd1a111aa693839ec3d788262ce18be74bf91) @@ -1560,6 +1560,9 @@ # In case the "assign method" has changed, forward variable # setting in configure (e.g. called during initialization of # object parameters) to the slot. + if {${:accessor} == 0} { + error "parameter ${:name}: option 'noaccessor' cannot be used together with required accessor (assign method)" + } lappend options slot=[::nsf::self] invokesetter } if {[info exists :arg]} {lappend options arg=${:arg}} Index: tests/parameters.test =================================================================== diff -u -r76454eeb255e395a6a19345d558e0e96a9c47159 -r6a3cd1a111aa693839ec3d788262ce18be74bf91 --- tests/parameters.test (.../parameters.test) (revision 76454eeb255e395a6a19345d558e0e96a9c47159) +++ tests/parameters.test (.../parameters.test) (revision 6a3cd1a111aa693839ec3d788262ce18be74bf91) @@ -2349,3 +2349,37 @@ ? [list $o baz] "test" } + + +# +# Test incompatible forwarding to slot vs. noaccessor +# +nx::Test case forward-to-assign { + ? {nx::Class create Foo { + :property bar:noaccessor { + :public method assign { object property value } { + incr ::slotcalls 1 + nsf::var::set $object $property $value + } + }} + } "::Foo" + + # call without default, without object parameter value + ? {Foo new} "parameter bar: option 'noaccessor' cannot be used together with required accessor (assign method)" + + # test cases for default + nx::Class create Foo { + :property {baz:noaccessor 1} { + :public method assign { object property value } { + incr ::slotcalls 1 + nsf::var::set $object $property $value + } + } + } + + # call with default, without object parameter value + ? {Foo new} "parameter baz: option 'noaccessor' cannot be used together with required accessor (assign method)" + + # call with default, with object parameter value + ? {Foo new -baz "test"} "parameter baz: option 'noaccessor' cannot be used together with required accessor (assign method)" +}