diff options
-rw-r--r-- | mcs/mcs/codegen.cs | 5 | ||||
-rw-r--r-- | mcs/tests/test-async-90.cs | 35 | ||||
-rw-r--r-- | mcs/tests/ver-il-net_4_x.xml | 38 |
3 files changed, 77 insertions, 1 deletions
diff --git a/mcs/mcs/codegen.cs b/mcs/mcs/codegen.cs index d5ba75c1281..c580a8a7291 100644 --- a/mcs/mcs/codegen.cs +++ b/mcs/mcs/codegen.cs @@ -1070,7 +1070,10 @@ namespace Mono.CSharp var ie = new InstanceEmitter (instance_copy, IsAddressCall (instance_copy, call_op, method.DeclaringType)); if (Arguments == null) { - ie.EmitLoad (ec, true); + if (ConditionalAccess) + ie.Emit (ec, true); + else + ie.EmitLoad (ec, true); } } else if (!InstanceExpressionOnStack) { var ie = new InstanceEmitter (InstanceExpression, IsAddressCall (InstanceExpression, call_op, method.DeclaringType)); diff --git a/mcs/tests/test-async-90.cs b/mcs/tests/test-async-90.cs new file mode 100644 index 00000000000..8b1adc66e42 --- /dev/null +++ b/mcs/tests/test-async-90.cs @@ -0,0 +1,35 @@ +using System.Threading.Tasks; + +static class Y +{ + public static string ExCall (this X x) + { + return null; + } +} + +class X +{ + static X Test (object o) + { + return null; + } + + X Prop { get; set;} + + X Call () + { + return null; + } + + public static void Main () + { + var x = new X (); + x.Test ().Wait (); + } + + async Task Test () + { + var x = X.Test (await Task.FromResult (1))?.Prop?.ExCall (); + } +}
\ No newline at end of file diff --git a/mcs/tests/ver-il-net_4_x.xml b/mcs/tests/ver-il-net_4_x.xml index 294239f325b..97e730296b7 100644 --- a/mcs/tests/ver-il-net_4_x.xml +++ b/mcs/tests/ver-il-net_4_x.xml @@ -66574,6 +66574,44 @@ </method> </type> </test> + <test name="test-async-90.cs"> + <type name="Y"> + <method name="System.String ExCall(X)" attrs="150"> + <size>10</size> + </method> + </type> + <type name="X"> + <method name="X Test(System.Object)" attrs="145"> + <size>10</size> + </method> + <method name="X get_Prop()" attrs="2177"> + <size>14</size> + </method> + <method name="Void set_Prop(X)" attrs="2177"> + <size>8</size> + </method> + <method name="X Call()" attrs="129"> + <size>10</size> + </method> + <method name="Void Main()" attrs="150"> + <size>19</size> + </method> + <method name="System.Threading.Tasks.Task Test()" attrs="129"> + <size>33</size> + </method> + <method name="Void .ctor()" attrs="6278"> + <size>7</size> + </method> + </type> + <type name="X+<Test>c__async0"> + <method name="Void MoveNext()" attrs="486"> + <size>290</size> + </method> + <method name="Void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine)" attrs="486"> + <size>13</size> + </method> + </type> + </test> <test name="test-cls-00.cs"> <type name="CLSCLass_6"> <method name="Void add_Disposed(Delegate)" attrs="2182"> |