What is the behavior to be expected when using switch expressions with or and a default guard with a condition? I'd expect that anything that qualifies for one of the or statements or for the default guard would enter that case, but apparently this is not how this works.
Consider the following example
var types = new HashSet<string>();
types.Add("a");
types.Add("b");
types.Add("c");
var input = "d";
var result = input switch {
"d" or _ when types.Contains(input) => "1",
_ => "2",
};
Console.WriteLine(result); //I'd expect "1" but I get "2"