Skip to content

Instantly share code, notes, and snippets.

@svick
Created March 9, 2016 23:01
Show Gist options
  • Select an option

  • Save svick/a1e8c0aeedf6e31aa956 to your computer and use it in GitHub Desktop.

Select an option

Save svick/a1e8c0aeedf6e31aa956 to your computer and use it in GitHub Desktop.
Why roslyn#9606 would be ambiguous
void Main()
{
var a = new C();
// var x = a? +a? +a : a;
var x = (a != null) +a? +a : a;
var y = a? (+a != null) +a : a;
}
class C
{
public static C operator+(C c)
{
return c;
}
public static C operator+(C c1, C c2)
{
return c1;
}
public static C operator+(bool b, C c2)
{
return c2;
}
public static implicit operator bool(C c)
{
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment