dotnet/roslyn

Unclear error message for pointer types in pattern matching

オープン

#43,339 opened on 2020/04/14

 (0 件のコメント) (0 件のリアクション) (0 人の担当者)C# (4,257 件のフォーク)batch import
Area-CompilersConcept-Diagnostic ClarityFeature - Pattern Matchinghelp wanted

Repository metrics

Stars
 (20,414 個のスター)
PR merge metrics
 (平均マージ 6d 17h) (30d で 256 merged PRs)

説明

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.

コントリビューターガイド