-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mcs] Fix null coalescing operator on cast of source expression resol…
…ved to implicit user operator conversion. Fixes #36161
- Loading branch information
1 parent
8327116
commit f958af3
Showing
3 changed files
with
42 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System; | ||
|
||
class MainClass | ||
{ | ||
public static implicit operator string (MainClass src) | ||
{ | ||
return null; | ||
} | ||
|
||
public static int Main () | ||
{ | ||
var obj = new MainClass (); | ||
var s = "x"; | ||
var res = (string) obj ?? s; | ||
if (res != "x") | ||
return 1; | ||
|
||
return 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters