dotnet/roslyn

Unclear error message for pointer types in pattern matching

開放

#43,339 建立於 2020年4月14日

 (0 則留言) (0 個反應) (0 位負責人)C# (4,257 個分叉)batch import
Area-CompilersConcept-Diagnostic ClarityFeature - Pattern Matchinghelp wanted

倉庫指標

星標
 (20,414 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

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.

貢獻者指南