dotnet / dotnet/csharpstandard

10.4.4.29 [definite assignment for] ?? expressions

Open
#175 1 comment 0 reactions 0 assignees View on GitHub
type: bug
Dominant language
C#
Stars
815
Forks
99
Avg merge
1d 14h
Merged PRs (30d)
16

Description

The following test case should “pass” to match compilers:

``` cs
using System;
static class Program
{
    static void Main()
    {
        const string x = "pass";
        string y;
        string z = x ?? y;
        Console.WriteLine(z);
    }
}
```

However, this is not justified by the current language specification.  I recommend we modify the specification to allow this.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.