Version Used: 17.0.0 RC
Steps to Reproduce:
static class C
{
public struct S1 : I { }
public struct S2 : I { }
public interface I { }
}
class Test<T>
{
public readonly T C;
bool P => C is C.S1 || C is C.S2; // IDE0078 false positive
}
IDE0078 suggests use of pattern matching. But code with pattern matching:
bool P => C is C.S1 or C.S2;
does not build with following error:
CS1061: 'T' does not contain a definition for 'S1' and no accessible extension method 'S1' accepting a first argument of type 'T' could be found (are you missing a using directive or an assembly reference?)
because C in pattern matching refers to instance field.
Version Used: 17.0.0 RC
Steps to Reproduce:
IDE0078 suggests use of pattern matching. But code with pattern matching:
does not build with following error:
CS1061: 'T' does not contain a definition for 'S1' and no accessible extension method 'S1' accepting a first argument of type 'T' could be found (are you missing a using directive or an assembly reference?)because
Cin pattern matching refers to instance field.