Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Safar <marek.safar@gmail.com>2015-10-26 18:40:48 +0300
committerMarek Safar <marek.safar@gmail.com>2015-10-29 10:52:10 +0300
commit7c0dc31b21f725b0fc5ad53306a9d093ff59e022 (patch)
treebdc51934de70b9346b756c1b80f014e3960f1eb8
parentd41309c59d911e9769469a68dadedc94f707dc8e (diff)
[mcs] Support auto-property with private setter with member definition from external assembly. Fixes #35236
-rw-r--r--mcs/mcs/ecore.cs11
-rw-r--r--mcs/tests/gtest-autoproperty-21-lib.cs6
-rw-r--r--mcs/tests/gtest-autoproperty-21.cs16
-rw-r--r--mcs/tests/ver-il-net_4_5.xml13
4 files changed, 39 insertions, 7 deletions
diff --git a/mcs/mcs/ecore.cs b/mcs/mcs/ecore.cs
index 4225b585eea..952a85f9aa4 100644
--- a/mcs/mcs/ecore.cs
+++ b/mcs/mcs/ecore.cs
@@ -7027,19 +7027,16 @@ namespace Mono.CSharp {
protected override bool ResolveAutopropertyAssignment (ResolveContext rc, Expression rhs)
{
- var prop = best_candidate.MemberDefinition as Property;
- if (prop == null)
- return false;
-
if (!rc.HasSet (ResolveContext.Options.ConstructorScope))
return false;
- if (prop.Parent.PartialContainer != rc.CurrentMemberDefinition.Parent.PartialContainer) {
- var ps = MemberCache.FindMember (rc.CurrentType, MemberFilter.Property (prop.ShortName, prop.MemberType), BindingRestriction.DeclaredOnly) as PropertySpec;
+ var prop = best_candidate.MemberDefinition as Property;
+ if (prop == null || prop.Parent.PartialContainer != rc.CurrentMemberDefinition.Parent.PartialContainer) {
+ var ps = MemberCache.FindMember (rc.CurrentType, MemberFilter.Property (best_candidate.Name, best_candidate.MemberType), BindingRestriction.DeclaredOnly) as PropertySpec;
if (ps == null)
return false;
- prop = (Property) ps.MemberDefinition;
+ prop = (Property)ps.MemberDefinition;
}
var spec = prop.BackingField;
diff --git a/mcs/tests/gtest-autoproperty-21-lib.cs b/mcs/tests/gtest-autoproperty-21-lib.cs
new file mode 100644
index 00000000000..15e9fa97b4f
--- /dev/null
+++ b/mcs/tests/gtest-autoproperty-21-lib.cs
@@ -0,0 +1,6 @@
+// Compiler options: -t:library
+
+public abstract class Base
+{
+ public abstract string Value { get; }
+}
diff --git a/mcs/tests/gtest-autoproperty-21.cs b/mcs/tests/gtest-autoproperty-21.cs
new file mode 100644
index 00000000000..4a900c8ca90
--- /dev/null
+++ b/mcs/tests/gtest-autoproperty-21.cs
@@ -0,0 +1,16 @@
+// Compiler options: -r:gtest-autoproperty-21-lib.dll
+
+public class Subclass : Base
+{
+ public override string Value { get; }
+
+ public Subclass ()
+ {
+ Value = "test";
+ }
+
+ public static void Main ()
+ {
+ new Subclass ();
+ }
+} \ No newline at end of file
diff --git a/mcs/tests/ver-il-net_4_5.xml b/mcs/tests/ver-il-net_4_5.xml
index 18c44fe3829..08b0ee8ce9d 100644
--- a/mcs/tests/ver-il-net_4_5.xml
+++ b/mcs/tests/ver-il-net_4_5.xml
@@ -20726,6 +20726,19 @@
</method>
</type>
</test>
+ <test name="gtest-autoproperty-21.cs">
+ <type name="Subclass">
+ <method name="System.String get_Value()" attrs="2246">
+ <size>14</size>
+ </method>
+ <method name="Void Main()" attrs="150">
+ <size>8</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>19</size>
+ </method>
+ </type>
+ </test>
<test name="gtest-collectioninit-01.cs">
<type name="Test">
<method name="Void TestList(System.Collections.Generic.List`1[System.Int32], Int32)" attrs="145">