diff options
author | Marek Safar <marek.safar@gmail.com> | 2013-07-12 17:13:42 +0400 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2013-07-12 18:32:51 +0400 |
commit | 007e8165924f0d3b9c43176b29dafbadb7ed98ed (patch) | |
tree | 5ff07b483970343328988cfcb30fadb0d569f0b7 /mcs | |
parent | 5d38f94238db72b76d2beb13b4618b45b797f95c (diff) |
Allow async for explicitly implemented interface methods. Fixes #13197
Diffstat (limited to 'mcs')
-rw-r--r-- | mcs/mcs/class.cs | 6 | ||||
-rw-r--r-- | mcs/tests/test-async-22.cs | 12 | ||||
-rw-r--r-- | mcs/tests/ver-il-net_4_5.xml | 51 |
3 files changed, 45 insertions, 24 deletions
diff --git a/mcs/mcs/class.cs b/mcs/mcs/class.cs index 8343e82f2c7..b4ec8bd2e5a 100644 --- a/mcs/mcs/class.cs +++ b/mcs/mcs/class.cs @@ -3330,7 +3330,11 @@ namespace Mono.CSharp Parent.PartialContainer.VerifyImplements (this); } - ModifiersExtensions.Check (Modifiers.AllowedExplicitImplFlags, explicit_mod_flags, 0, Location, Report); + Modifiers allowed_explicit = Modifiers.AllowedExplicitImplFlags; + if (this is Method) + allowed_explicit |= Modifiers.ASYNC; + + ModifiersExtensions.Check (allowed_explicit, explicit_mod_flags, 0, Location, Report); } return base.Define (); diff --git a/mcs/tests/test-async-22.cs b/mcs/tests/test-async-22.cs index e2a361403c7..3e0350012b9 100644 --- a/mcs/tests/test-async-22.cs +++ b/mcs/tests/test-async-22.cs @@ -2,8 +2,7 @@ using System; using System.Threading.Tasks; // contextual async, parser tests - -class A +class A : Iasync { async Task<int> async () { @@ -21,6 +20,10 @@ class A var res = (int) await async (); var res2 = (Int32) await async (); } + + async void Iasync.async () + { + } public static int Main () { @@ -28,6 +31,11 @@ class A } } +interface Iasync +{ + void async (); +} + class B { class async diff --git a/mcs/tests/ver-il-net_4_5.xml b/mcs/tests/ver-il-net_4_5.xml index a317e7489b5..c6e83d0d85f 100644 --- a/mcs/tests/ver-il-net_4_5.xml +++ b/mcs/tests/ver-il-net_4_5.xml @@ -57827,14 +57827,9 @@ <size>0</size>
</method>
</type>
- <type name="A+<async>c__async0">
- <method name="Void MoveNext()" attrs="486">
- <size>38</size>
- </method>
- </type>
<type name="A+<async>c__async1">
<method name="Void MoveNext()" attrs="486">
- <size>37</size>
+ <size>38</size>
</method>
</type>
<type name="A">
@@ -57842,26 +57837,11 @@ <size>35</size>
</method>
</type>
- <type name="A+<CastTest>c__async2">
- <method name="Void MoveNext()" attrs="486">
- <size>285</size>
- </method>
- </type>
- <type name="A+<async>c__async0">
- <method name="Void SetStateMachine(IAsyncStateMachine)" attrs="486">
- <size>13</size>
- </method>
- </type>
<type name="A+<async>c__async1">
<method name="Void SetStateMachine(IAsyncStateMachine)" attrs="486">
<size>13</size>
</method>
</type>
- <type name="A+<CastTest>c__async2">
- <method name="Void SetStateMachine(IAsyncStateMachine)" attrs="486">
- <size>13</size>
- </method>
- </type>
<type name="C">
<method name="Void Test(Boolean)" attrs="145">
<size>20</size>
@@ -57974,6 +57954,35 @@ <size>14</size>
</method>
</type>
+ <type name="A">
+ <method name="Void Iasync.async()" attrs="481">
+ <size>27</size>
+ </method>
+ </type>
+ <type name="A+<async>c__async2">
+ <method name="Void MoveNext()" attrs="486">
+ <size>37</size>
+ </method>
+ <method name="Void SetStateMachine(IAsyncStateMachine)" attrs="486">
+ <size>13</size>
+ </method>
+ </type>
+ <type name="A+<CastTest>c__async3">
+ <method name="Void MoveNext()" attrs="486">
+ <size>285</size>
+ </method>
+ <method name="Void SetStateMachine(IAsyncStateMachine)" attrs="486">
+ <size>13</size>
+ </method>
+ </type>
+ <type name="A+async>c__async0">
+ <method name="Void MoveNext()" attrs="486">
+ <size>31</size>
+ </method>
+ <method name="Void SetStateMachine(IAsyncStateMachine)" attrs="486">
+ <size>13</size>
+ </method>
+ </type>
</test>
<test name="test-async-23.cs">
<type name="MyContext">
|