-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Copy link
Labels
Area-CompilersCode Gen QualityRoom for improvement in the quality of the compiler's generated codeRoom for improvement in the quality of the compiler's generated code
Milestone
Description
class C {
string Worst(object i) {
// uses a boolean flag for the result and a conditional jump
return i is 1 or C(2) ? "aaa" : "bbb";
}
string Switch(object i) {
// falls back to switch arms when possible; this info isn't available for `is` expressions
return i switch { 1 or C(2) => "aaa", _ => "bbb" };
}
string Best(object i) {
// ideally it should be lowered as `||` - still "linear" without using a flag
return i is 1 || i is C(2) ? "aaa" : "bbb";
}
void Deconstruct(out int i) => throw null;
}Relates to #45679
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area-CompilersCode Gen QualityRoom for improvement in the quality of the compiler's generated codeRoom for improvement in the quality of the compiler's generated code