fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5.  
  6. class R { }
  7. class A : R { }
  8. class B : R { }
  9.  
  10. static void pituh(A x, R y){
  11. Console.WriteLine("A R");
  12. }
  13.  
  14. static void pituh(R x, B y){
  15. Console.WriteLine("R B");
  16. }
  17.  
  18. static void pituh(R x, R y){
  19. Console.WriteLine("R R");
  20. }
  21.  
  22.  
  23.  
  24.  
  25. static void d(R x, R y)
  26. {
  27. dynamic a = x;
  28. dynamic b = y;
  29. pituh(a, b);
  30. }
  31.  
  32. public static void Main(string[] args)
  33. {
  34. d(new A(),new R());
  35. d(new A(),new B());
  36. d(new A(),new B());
  37. d(new B(),new A());
  38.  
  39. }
  40. }
  41.  
Runtime error #stdin #stdout #stderr 0.23s 32260KB
stdin
Standard input is empty
stdout
A R
stderr
Unhandled Exception:
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: The call is ambiguous between the following methods or properties: `Test.pituh(Test.A, Test.R)' and `Test.pituh(Test.R, Test.B)'
  at (wrapper dynamic-method) System.Object:CallSite.Target (System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,System.Type,object,object)
  at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid3[T0,T1,T2] (System.Runtime.CompilerServices.CallSite site, T0 arg0, T1 arg1, T2 arg2) [0x00133] in <63992662b765477a898ef49cdcc99ee2>:0 
  at (wrapper dynamic-method) System.Object:CallSite.Target (System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,System.Type,object,object)
  at Test.d (Test+R x, Test+R y) [0x00057] in <29ffafb763be4ca0a1aedf18c25cedb8>:0 
  at Test.Main (System.String[] args) [0x00019] in <29ffafb763be4ca0a1aedf18c25cedb8>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: The call is ambiguous between the following methods or properties: `Test.pituh(Test.A, Test.R)' and `Test.pituh(Test.R, Test.B)'
  at (wrapper dynamic-method) System.Object:CallSite.Target (System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,System.Type,object,object)
  at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid3[T0,T1,T2] (System.Runtime.CompilerServices.CallSite site, T0 arg0, T1 arg1, T2 arg2) [0x00133] in <63992662b765477a898ef49cdcc99ee2>:0 
  at (wrapper dynamic-method) System.Object:CallSite.Target (System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,System.Type,object,object)
  at Test.d (Test+R x, Test+R y) [0x00057] in <29ffafb763be4ca0a1aedf18c25cedb8>:0 
  at Test.Main (System.String[] args) [0x00019] in <29ffafb763be4ca0a1aedf18c25cedb8>:0