diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2016-07-09 13:26:46 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2016-07-09 13:26:46 (GMT) |
commit | 11dc688b81fc6d55eb42fd23e063a5310569d71d (patch) | |
tree | f238002964c201b4b41854ef92cd6c96f870eeb6 /tests | |
parent | 673b7ecc2109080c1d8ab85bede83600d5dfff1e (diff) | |
parent | 38f4a53699309fdec415cf81e5c2ba6137ff8cf4 (diff) | |
download | tcl-11dc688b81fc6d55eb42fd23e063a5310569d71d.zip tcl-11dc688b81fc6d55eb42fd23e063a5310569d71d.tar.gz tcl-11dc688b81fc6d55eb42fd23e063a5310569d71d.tar.bz2 |
[1493a43044] Make [namespace upvar] ignore variable resolvers; the previous situation was completely unintuitive.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/oo.test | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/oo.test b/tests/oo.test index 48e093a..2601c37 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -3424,6 +3424,38 @@ test oo-27.22 {variables declaration uniqueifies: Bug 3396896} -setup { } -cleanup { foo destroy } -result {v t} +test oo-27.23 {variable resolver leakage: Bug 1493a43044} -setup { + oo::class create Super + oo::class create Master { + superclass Super + variable member1 member2 + constructor {} { + set member1 master1 + set member2 master2 + } + method getChild {} { + Child new [self] + } + } + oo::class create Child { + superclass Super + variable member1 result + constructor {m} { + set [namespace current]::member1 child1 + set ns [info object namespace $m] + namespace upvar $ns member1 l1 member2 l2 + upvar 1 member1 l3 member2 l4 + [format namespace] upvar $ns member1 l5 member2 l6 + [format upvar] 1 member1 l7 member2 l8 + set result [list $l1 $l2 $l3 $l4 $l5 $l6 $l7 $l8] + } + method result {} {return $result} + } +} -body { + [[Master new] getChild] result +} -cleanup { + Super destroy +} -result {master1 master2 master1 master2 master1 master2 master1 master2} # A feature that's not supported because the mechanism may change without # warning, but is supposed to work... |