Priority
Major
Type
Bug 
State
Fixed 
Assignee
Andrey Simanovsky 
Subsystem
No subsystem 
Affected versions
Fixed in
Fixed in build
Next build 
Build
440
  • Submitted by   Vladimir Reshetnikov
    2 years ago (28 May 2007 15:35)
  • Updated by Vladimir Reshetnikov
    2 years ago (09 Jul 2007 18:41)
  • Jira: RSRP-41585
    (history, comments)

RSRP-41585

'Convert to conditional operator' breaks code

0
delegate int F();

class Program
{
    static void Foo(bool b)
    {
        F f;
        if (b) f = delegate { return 0; };
        else f = delegate { return 1; };
    }
}


After refactoring:

        // error CS0173: Type of conditional expression cannot be determined because there is no implicit conversion between 'anonymous method' and 'anonymous method'
        f = b ? delegate { return 0; } : delegate { return 1; };


Expected:

        f = b ? (F) delegate { return 0; } : delegate { return 1; };



Issue was closed
Comments (0)
 
History (0)
 
Links
 
Issue has no comments