From 8dad1b8281811bab0d71588b3c59a7fa1d163642 Mon Sep 17 00:00:00 2001 From: dkf Date: Fri, 16 Sep 2011 13:13:11 +0000 Subject: [Bug 3408830]: Use the _right_ fix for [Bug 3400658]! --- ChangeLog | 10 ++++------ generic/tclOOMethod.c | 2 +- generic/tclProc.c | 2 ++ tests/oo.test | 10 ++++++++++ 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4bb5097..99b891b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2011-09-16 Donal K. Fellows + * generic/tclProc.c (ProcWrongNumArgs): [Bugs 3400658,3408830]: + Ensemble-like rewriting of error messages is complex, and TclOO (in + combination with iTcl) hits the most tricky cases. + * library/http/http.tcl (http::geturl): [Bug 3391977]: Ensure that the -headers option overrides the -type option (important because -type has a default that is not always appropriate, and the header must not @@ -33,12 +37,6 @@ Thread package use in socket_*-13.1. Eliminates a memory leak in `make valgrind`. -2011-09-10 Donal K. Fellows - - * generic/tclOOMethod.c (InitEnsembleRewrite): [Bug 3400658]: Set the - ensemble-like rewriting up correctly for forwarded methods so that - computed error messages are correct. - 2011-09-09 Don Porter * tests/chanio.test: [Bug 3389733]: Convert [testthread] use to diff --git a/generic/tclOOMethod.c b/generic/tclOOMethod.c index 708295a..4e7edb8 100644 --- a/generic/tclOOMethod.c +++ b/generic/tclOOMethod.c @@ -1595,7 +1595,7 @@ InitEnsembleRewrite( if (isRootEnsemble) { iPtr->ensembleRewrite.sourceObjs = objv; iPtr->ensembleRewrite.numRemovedObjs = toRewrite; - iPtr->ensembleRewrite.numInsertedObjs = rewriteLength - 1; + iPtr->ensembleRewrite.numInsertedObjs = rewriteLength; } else { int numIns = iPtr->ensembleRewrite.numInsertedObjs; diff --git a/generic/tclProc.c b/generic/tclProc.c index 50cf0f7..d008217 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -1120,6 +1120,8 @@ ProcWrongNumArgs( if (framePtr->isProcCallFrame & FRAME_IS_LAMBDA) { desiredObjs[0] = Tcl_NewStringObj("lambdaExpr", -1); } else { + ((Interp *) interp)->ensembleRewrite.numInsertedObjs -= skip - 1; + #ifdef AVOID_HACKS_FOR_ITCL desiredObjs[0] = framePtr->objv[skip-1]; #else diff --git a/tests/oo.test b/tests/oo.test index 5ec5d2f..171ccc7 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -880,6 +880,16 @@ test oo-6.17 {Bug 3400658: forwarding and wrongargs rewriting - via ensemble} -s } -returnCodes error -cleanup { fooClass destroy } -result {wrong # args: should be "foo test c d"} +test oo-6.18 {Bug 3408830: more forwarding cases} -setup { + oo::class create fooClass +} -body { + oo::define fooClass { + forward len string length + } + [fooClass create foo] len a b +} -returnCodes error -cleanup { + fooClass destroy +} -result {wrong # args: should be "::foo len string"} test oo-7.1 {OO: inheritance 101} -setup { oo::class create superClass -- cgit v0.12