Tcl Source Code

Check-in [cfe546af5b]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:amend to fix with test-cases covering correct behavior by tailcall with direct break/return into loop, regardless up-scope (proc or top-level body)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | sebres-bug-723a2f4ac3
Files: files | file ages | folders
SHA3-256: cfe546af5bb893c1a3f384e12af05c977b8a2bef7ce9588f145b9c9b14067341
User & Date: sebres 2018-08-02 17:09:47
Context
2018-08-02
17:30
amend with fix (init of counter "i") and same tests for coro check-in: 085cbe212c user: sebres tags: sebres-bug-723a2f4ac3
17:09
amend to fix with test-cases covering correct behavior by tailcall with direct break/return into loo... check-in: cfe546af5b user: sebres tags: sebres-bug-723a2f4ac3
16:37
experimental: try to fix [723a2f4ac3] - avoid to generate exception handlers in tailcall (because th... check-in: 3950bbd3d0 user: sebres tags: sebres-bug-723a2f4ac3
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tests/tailcall.test.

703
704
705
706
707
708
709



























710
711
712
713
714
715
716
	proc p args {
	    tailcall [namespace current] {*}$args
	}
	namespace delete [namespace current]
	p
    }
} -returnCodes 1 -result {namespace "::ns" not found}




























# cleanup
::tcltest::cleanupTests

# Local Variables:
# mode: tcl
# End:






>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
	proc p args {
	    tailcall [namespace current] {*}$args
	}
	namespace delete [namespace current]
	p
    }
} -returnCodes 1 -result {namespace "::ns" not found}

# following tests cover tailcall as direct break/return from proc into proc
# or top-level upscope loop, in case of "infinite" loop the result is 10 
# (expected 1 for break and "" for return)
test tailcall-15.1a {as direct return from proc: break into proc upscope loop} -setup {
    proc p {} {tailcall break}
} -body {
    proc t {} {while {[incr i] < 10} p; set i}
    t
} -result 1
test tailcall-15.1b {as direct return from proc: break into top-level upscope loop} -setup {
    proc p {} {tailcall break}
} -body {
    while {[incr i] < 10} p; set i
} -result 1

test tailcall-15.2a {as direct return from proc: return into proc upscope loop} -setup {
    proc p {} {tailcall return}
} -body {
    proc t {} {while {[incr i] < 10} p; set i}
    t
} -result ""
test tailcall-15.2b {as direct return from proc: return into top-level upscope loop} -setup {
    proc p {} {tailcall return}
} -body {
    while {[incr i] < 10} p; set i
} -result ""

# cleanup
::tcltest::cleanupTests

# Local Variables:
# mode: tcl
# End: