dotnet/roslyn
Unclear error message for pointer types in pattern matching
Aperta
#43.339 aperta il 14 apr 2020
Area-CompilersConcept-Diagnostic ClarityFeature - Pattern Matchinghelp wanted
Metriche repository
- Star
- (20.414 stelle)
- Metriche merge PR
- (Merge medio 6g 17h) (256 PR mergiate in 30 g)
Descrizione
unsafe class C
{
static void Main()
{
int* ptr = null;
_ = ptr is var (x); // error CS8521: Pattern-matching is not permitted for pointer types.
_ = ptr is var y; // valid code
}
}
The error message shown above doesn't mention anything about parenthesized patterns, despite the fact that that's the only difference between those two lines. We can make this clearer.