Created
July 2, 2013 04:36
-
-
Save davidfowl/5906798 to your computer and use it in GitHub Desktop.
Compiler bug with dynamic and interface inheritance
This file contains hidden or 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
| namespace CompilerBug | |
| { | |
| public interface IFoo : IBar | |
| { | |
| } | |
| public interface IBar | |
| { | |
| void Bar(string name); | |
| } | |
| public class Foo : IFoo | |
| { | |
| public void Bar(string name) | |
| { | |
| Console.WriteLine("Hello World"); | |
| } | |
| } | |
| private static void WorkingDynamic() | |
| { | |
| Foo foo = new Foo(); | |
| dynamic d = "test"; | |
| foo.Bar(d); | |
| } | |
| private static void BrokenDynamic() | |
| { | |
| IFoo foo = new Foo(); | |
| dynamic d = "test"; | |
| foo.Bar(d); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment