Created
October 13, 2012 02:14
-
-
Save dherman/3882943 to your computer and use it in GitHub Desktop.
imperative control-flow and type-checking
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DoFail { | |
public int f() { | |
do { | |
if (false) break; | |
return 0; | |
} while (true); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DoPass { | |
public int f() { | |
do { | |
return 0; | |
} while (true); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ForFail { | |
public int f() { | |
for (int x = 0; x < 10; x++) { | |
return x; | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SwitchDefaultFail { | |
public int f(int x) { | |
switch (x) { | |
case 0: | |
if (false) break; | |
default: | |
return x; | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SwitchDefaultPass { | |
public int f(int x) { | |
switch (x) { | |
case 0: | |
default: | |
return x; | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SwitchNoDefaultFail { | |
public int f(int x) { | |
switch (x) { | |
case 0: | |
return x; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment