[Swift-devel] [Bug 85] New: break statements in switch/case have no effect.

bugzilla-daemon at mcs.anl.gov bugzilla-daemon at mcs.anl.gov
Fri Jul 27 18:48:44 CDT 2007


http://bugzilla.mcs.anl.gov/swift/show_bug.cgi?id=85

           Summary: break statements in switch/case have no effect.
           Product: Swift
           Version: unspecified
          Platform: Macintosh
        OS/Version: Mac OS
            Status: NEW
          Severity: normal
          Priority: P2
         Component: SwiftScript language
        AssignedTo: benc at hawaga.org.uk
        ReportedBy: benc at hawaga.org.uk
                CC: swift-devel at ci.uchicago.edu


Break statements in case/switch have no effect - code behaves the same whether
there's a break or not, and executes only the code directly attached to any
particular case.

For example, the below code executes only the 8th case, rather than executing
the code associated with other case lower down too (which should then fail with
multiple assignment error).

Likely easiest course is to remove break; from the language.

type messagefile {}

(messagefile t) greeting(string m) { 
    app {
        echo m stdout=@filename(t);
    }
}

messagefile outfile <"092-case-duffs-device.out">;


string message;

switch(8) {
  case 3:
    message="first message";
  case 8:
    message="eighth message";
  default:
    message="no message at all...";
  case 57:
    message="last message";
}


-- 
Configure bugmail: http://bugzilla.mcs.anl.gov/swift/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



More information about the Swift-devel mailing list