Artifacts Associated With Ticket 5d5b105228
Ticket change [b205f203ff] (rid 247945) by juliannoble2 on 2025-11-10 08:02:44:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-plain"
- comment initialized to:
For a nested switch statement such as the one below, The reported line for a frame of type eval during an execution enterstep trace does not match the line in the matched script, for the first 1, 2 or 3 pattern scripts. This is not related to the source file lines - as the situation arises when the proc has been loaded by some means such that source file line numbers are not available. (see test script switch_test.tcl attached) It is also probably not related to line-continuations - another source of apparent mismatches, as those have not been used in this test. This issue occurs when patterns and scripts are passed as a single block - it does not seem to occur when the separated pattern script arguments are used. Depending on the number of options used on the nested switch - different results will occur. Usually the first 2 script blocks will have misreported line numbers in all 'eval' callbacks. The switch statements in the test script are all of the basic form as shown in the script below, the only difference being the options passed before the string argument. In the case below, the line number for the return arms aa and ab are misreported as 4 The subsequent arms ac and ad report 2 correctly, and when extended to more pattern/scripts there are no further bad line numbers (even if script blocks are modified to have comments, empty lines, and more code) The largest number of incorrect results I have seen is 3, in the 5 argument case (switch -exact -nocase -- $string $patternblock) The fact that subsequent arms after the first 2 or 3 can always correctly report line numbers relative to the start of each sub script, and that the error does not occur at all in the 2 argument case (switch $string $patternblock) suggests to me that there probably shouldn't fundamentally be a reason why the first arms can't report line numbers correctly. #3arg: one switch + matchstring + single patternscript body proc switch_nested_3arg {s} { set ch1 [::tcl::string::index $s 0] switch $ch1 { a { set ch2 [::tcl::string::index $s 1] switch -- $ch2 { a { return aa } b { return ab } c { return ac } d { return ad } } } default { return _ } } } - foundin initialized to: "8.6+"
- is_private initialized to: "0"
- login: "juliannoble2"
- priority initialized to: "5 Medium"
- private_contact initialized to: "957fdfcd8744611e3fe1f4896c7538b1d9bf47b2"
- resolution initialized to: "None"
- severity initialized to: "Important"
- status initialized to: "Open"
- submitter initialized to: "juliannoble2"
- subsystem initialized to: "18. Commands M-Z"
- title initialized to:
execution trace on nested switch - inconsistent line depending on options
- type initialized to: "Bug"
Add attachment "switch_test.tcl" [9eda8fcae4] (rid 247947) by juliannoble2 on 2025-11-10 08:04:31.
Ticket change [139fc6f275] (rid 254889) by juliannoble2 on 2026-07-14 05:58:59:
- icomment:
Fable 5 pure tcl repro http://paste.tclers.tk/6227
- login: "juliannoble2"
- mimetype: "text/plain"
- icomment: