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>2014-11-13 19:18:01 +0300
committerMarek Safar <marek.safar@gmail.com>2014-11-13 19:19:04 +0300
commit4697ef6e7790380227e79b2b128fd7227c712647 (patch)
treef0b914d1657e30693b60aa2e6b2ced708d6c1f2b
parenta32054ece952bd9d3dd436dddb57d096a11ed4ee (diff)
[mcs] More updates to auto-properties v6 implementation
-rw-r--r--mcs/errors/cs0170.cs5
-rw-r--r--mcs/errors/cs0200-4.cs15
-rw-r--r--mcs/errors/cs0200-5.cs12
-rw-r--r--mcs/errors/cs0200-6.cs12
-rw-r--r--mcs/errors/cs0843-2.cs12
-rw-r--r--mcs/errors/cs0843-3.cs16
-rw-r--r--mcs/errors/cs8051.cs8
-rw-r--r--mcs/errors/cs8052.cs6
-rw-r--r--mcs/errors/cs8053.cs7
-rw-r--r--mcs/errors/cs8079.cs14
-rw-r--r--mcs/mcs/assign.cs14
-rw-r--r--mcs/mcs/decl.cs2
-rw-r--r--mcs/mcs/ecore.cs136
-rw-r--r--mcs/mcs/flowanalysis.cs2
-rw-r--r--mcs/mcs/property.cs35
-rw-r--r--mcs/tests/gtest-autoproperty-11.cs30
-rw-r--r--mcs/tests/gtest-autoproperty-12.cs48
-rw-r--r--mcs/tests/gtest-autoproperty-13.cs22
-rw-r--r--mcs/tests/gtest-autoproperty-14.cs14
-rw-r--r--mcs/tests/test-909.cs (renamed from mcs/errors/cs0188-9.cs)7
-rw-r--r--mcs/tests/ver-il-net_4_5.xml104
21 files changed, 418 insertions, 103 deletions
diff --git a/mcs/errors/cs0170.cs b/mcs/errors/cs0170.cs
index f388a037ece..366b485d184 100644
--- a/mcs/errors/cs0170.cs
+++ b/mcs/errors/cs0170.cs
@@ -1,7 +1,5 @@
// CS0170: Use of possibly unassigned field `a'
-// Line: 23
-
-using System;
+// Line: 21
namespace CS0170
{
@@ -21,7 +19,6 @@ namespace CS0170
Foo f;
Bar b = new Bar();
b.Inc (f.a);
- Console.WriteLine (f.a);
}
}
}
diff --git a/mcs/errors/cs0200-4.cs b/mcs/errors/cs0200-4.cs
new file mode 100644
index 00000000000..bf2cbff0741
--- /dev/null
+++ b/mcs/errors/cs0200-4.cs
@@ -0,0 +1,15 @@
+// CS0200: Property or indexer `A.X' cannot be assigned to (it is read-only)
+// Line: 13
+
+public class A
+{
+ public int X { get; }
+}
+
+public class B : A
+{
+ public B ()
+ {
+ base.X = 1;
+ }
+} \ No newline at end of file
diff --git a/mcs/errors/cs0200-5.cs b/mcs/errors/cs0200-5.cs
new file mode 100644
index 00000000000..4657362f829
--- /dev/null
+++ b/mcs/errors/cs0200-5.cs
@@ -0,0 +1,12 @@
+// CS0200: Property or indexer `C.S' cannot be assigned to (it is read-only)
+// Line: 10
+
+class C
+{
+ public static int S { get; }
+
+ public C ()
+ {
+ S = 3;
+ }
+}
diff --git a/mcs/errors/cs0200-6.cs b/mcs/errors/cs0200-6.cs
new file mode 100644
index 00000000000..dcfe2d21572
--- /dev/null
+++ b/mcs/errors/cs0200-6.cs
@@ -0,0 +1,12 @@
+// CS0200: Property or indexer `C.P' cannot be assigned to (it is read-only)
+// Line: 10
+
+class C
+{
+ public int P { get; }
+
+ public void Foo ()
+ {
+ P = 10;
+ }
+}
diff --git a/mcs/errors/cs0843-2.cs b/mcs/errors/cs0843-2.cs
deleted file mode 100644
index eb900556677..00000000000
--- a/mcs/errors/cs0843-2.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-// CS0843: An automatically implemented property `S.A' must be fully assigned before control leaves the constructor. Consider calling the default struct contructor from a constructor initializer
-// Line: 8
-
-public struct S
-{
- public int A { get; set;}
-
- public S (int a)
- {
- this.A = a;
- }
-}
diff --git a/mcs/errors/cs0843-3.cs b/mcs/errors/cs0843-3.cs
deleted file mode 100644
index 696ef162f19..00000000000
--- a/mcs/errors/cs0843-3.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-// CS0843: An automatically implemented property `S.A' must be fully assigned before control leaves the constructor. Consider calling the default struct contructor from a constructor initializer
-// Line: 11
-
-using System;
-
-public struct S
-{
- public int A { get; set;}
- event EventHandler eh;
-
- public S (int a)
- {
- this.eh = null;
- A = a;
- }
-}
diff --git a/mcs/errors/cs8051.cs b/mcs/errors/cs8051.cs
index 7935efbe608..1bd716c4b82 100644
--- a/mcs/errors/cs8051.cs
+++ b/mcs/errors/cs8051.cs
@@ -1,7 +1,7 @@
-// CS8051: Auto-implemented property `Test.Property' must have set accessor or initializer
+// CS8051: Auto-implemented property `V.P' must have get accessor
// Line: 6
-public abstract class Test
+class V
{
- public string Property { get; }
-}
+ public object P { set; } = 1;
+} \ No newline at end of file
diff --git a/mcs/errors/cs8052.cs b/mcs/errors/cs8052.cs
index bccf0157faf..d3f6a219653 100644
--- a/mcs/errors/cs8052.cs
+++ b/mcs/errors/cs8052.cs
@@ -1,7 +1,7 @@
-// CS8052: Auto-implemented property `V.P' must have get accessor
+// CS8052: `I.P': Properties inside interfaces cannot have initializers
// Line: 6
-class V
+interface I
{
- public object P { set; } = 1;
+ int P { get; } = 4;
} \ No newline at end of file
diff --git a/mcs/errors/cs8053.cs b/mcs/errors/cs8053.cs
deleted file mode 100644
index 319835ff09f..00000000000
--- a/mcs/errors/cs8053.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-// CS8053: `I.P': Properties inside interfaces cannot have initializers
-// Line: 6
-
-interface I
-{
- int P { get; } = 4;
-} \ No newline at end of file
diff --git a/mcs/errors/cs8079.cs b/mcs/errors/cs8079.cs
new file mode 100644
index 00000000000..18a78105942
--- /dev/null
+++ b/mcs/errors/cs8079.cs
@@ -0,0 +1,14 @@
+// CS8079: Use of possibly unassigned auto-implemented property `X'
+// Line: 11
+
+public struct S
+{
+ public int X { get; set; }
+ public int Y;
+
+ public S ()
+ {
+ Y = X;
+ X = 0;
+ }
+} \ No newline at end of file
diff --git a/mcs/mcs/assign.cs b/mcs/mcs/assign.cs
index 472a393739f..5650d054c2b 100644
--- a/mcs/mcs/assign.cs
+++ b/mcs/mcs/assign.cs
@@ -421,7 +421,13 @@ namespace Mono.CSharp {
{
source.FlowAnalysis (fc);
- if (target is ArrayAccess || target is IndexerExpr || target is PropertyExpr)
+ if (target is ArrayAccess || target is IndexerExpr) {
+ target.FlowAnalysis (fc);
+ return;
+ }
+
+ var pe = target as PropertyExpr;
+ if (pe != null && !pe.IsAutoPropertyAccess)
target.FlowAnalysis (fc);
}
@@ -491,6 +497,12 @@ namespace Mono.CSharp {
fe.SetFieldAssigned (fc);
return;
}
+
+ var pe = target as PropertyExpr;
+ if (pe != null) {
+ pe.SetBackingFieldAssigned (fc);
+ return;
+ }
}
public override void MarkReachable (Reachability rc)
diff --git a/mcs/mcs/decl.cs b/mcs/mcs/decl.cs
index 302c21a2c7a..99476d291c7 100644
--- a/mcs/mcs/decl.cs
+++ b/mcs/mcs/decl.cs
@@ -1125,7 +1125,7 @@ namespace Mono.CSharp {
public virtual string GetSignatureForError ()
{
- var bf = MemberDefinition as Property.BackingField;
+ var bf = MemberDefinition as Property.BackingFieldDeclaration;
string name;
if (bf == null) {
name = Name;
diff --git a/mcs/mcs/ecore.cs b/mcs/mcs/ecore.cs
index 49a56e78f67..387bac8617f 100644
--- a/mcs/mcs/ecore.cs
+++ b/mcs/mcs/ecore.cs
@@ -6589,6 +6589,7 @@ namespace Mono.CSharp {
sealed class PropertyExpr : PropertyOrIndexerExpr<PropertySpec>
{
Arguments arguments;
+ FieldExpr backing_field;
public PropertyExpr (PropertySpec spec, Location l)
: base (l)
@@ -6620,6 +6621,13 @@ namespace Mono.CSharp {
}
}
+ public bool IsAutoPropertyAccess {
+ get {
+ var prop = best_candidate.MemberDefinition as Property;
+ return prop != null && prop.BackingField != null;
+ }
+ }
+
public override bool IsInstance {
get {
return !IsStatic;
@@ -6761,6 +6769,11 @@ namespace Mono.CSharp {
public override void EmitAssign (EmitContext ec, Expression source, bool leave_copy, bool isCompound)
{
+ if (backing_field != null) {
+ backing_field.EmitAssign (ec, source, false, false);
+ return;
+ }
+
Arguments args;
LocalTemporary await_source_arg = null;
@@ -6830,6 +6843,21 @@ namespace Mono.CSharp {
public override void FlowAnalysis (FlowAnalysisContext fc)
{
+ var prop = best_candidate.MemberDefinition as Property;
+ if (prop != null && prop.BackingField != null) {
+ var var = InstanceExpression as IVariableReference;
+ if (var != null) {
+ var vi = var.VariableInfo;
+ if (vi != null && !fc.IsStructFieldDefinitelyAssigned (vi, prop.BackingField.Name)) {
+ fc.Report.Error (8079, loc, "Use of possibly unassigned auto-implemented property `{0}'", Name);
+ return;
+ }
+
+ if (TypeSpec.IsValueType (InstanceExpression.Type) && InstanceExpression is VariableReference)
+ return;
+ }
+ }
+
base.FlowAnalysis (fc);
if (conditional_access_receiver)
@@ -6874,6 +6902,52 @@ namespace Mono.CSharp {
return this;
}
+ 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;
+
+ var spec = prop.BackingField;
+ if (spec == null)
+ return false;
+
+ if (rc.IsStatic != spec.IsStatic)
+ return false;
+
+ if (!spec.IsStatic && (!(InstanceExpression is This) || InstanceExpression is BaseThis))
+ return false;
+
+ backing_field = new FieldExpr (prop.BackingField, loc);
+ backing_field.ResolveLValue (rc, rhs);
+ return true;
+ }
+
+ public void SetBackingFieldAssigned (FlowAnalysisContext fc)
+ {
+ if (backing_field != null) {
+ backing_field.SetFieldAssigned (fc);
+ return;
+ }
+
+ if (!IsAutoPropertyAccess)
+ return;
+
+ var prop = best_candidate.MemberDefinition as Property;
+ if (prop != null && prop.BackingField != null) {
+ bool lvalue_instance = best_candidate.DeclaringType.IsStruct;
+ if (lvalue_instance) {
+ var var = InstanceExpression as IVariableReference;
+ if (var != null && var.VariableInfo != null) {
+ fc.SetStructFieldAssigned (var.VariableInfo, prop.BackingField.Name);
+ }
+ }
+ }
+ }
+
public override void SetTypeArguments (ResolveContext ec, TypeArguments ta)
{
Error_TypeArgumentsCannotBeUsed (ec, "property", GetSignatureForError (), loc);
@@ -6943,7 +7017,7 @@ namespace Mono.CSharp {
return this;
}
- public override Expression DoResolveLValue (ResolveContext ec, Expression right_side)
+ public override Expression DoResolveLValue (ResolveContext rc, Expression right_side)
{
if (ConditionalAccess)
throw new NotSupportedException ("null propagating operator assignment");
@@ -6951,29 +7025,50 @@ namespace Mono.CSharp {
if (right_side == EmptyExpression.OutAccess) {
// TODO: best_candidate can be null at this point
INamedBlockVariable variable = null;
- if (best_candidate != null && ec.CurrentBlock.ParametersBlock.TopBlock.GetLocalName (best_candidate.Name, ec.CurrentBlock, ref variable) && variable is Linq.RangeVariable) {
- ec.Report.Error (1939, loc, "A range variable `{0}' may not be passes as `ref' or `out' parameter",
+ if (best_candidate != null && rc.CurrentBlock.ParametersBlock.TopBlock.GetLocalName (best_candidate.Name, rc.CurrentBlock, ref variable) && variable is Linq.RangeVariable) {
+ rc.Report.Error (1939, loc, "A range variable `{0}' may not be passes as `ref' or `out' parameter",
best_candidate.Name);
} else {
- right_side.DoResolveLValue (ec, this);
+ right_side.DoResolveLValue (rc, this);
}
return null;
}
if (eclass == ExprClass.Unresolved) {
- var expr = OverloadResolve (ec, right_side);
+ var expr = OverloadResolve (rc, right_side);
if (expr == null)
return null;
if (expr != this)
- return expr.ResolveLValue (ec, right_side);
+ return expr.ResolveLValue (rc, right_side);
} else {
- ResolveInstanceExpression (ec, right_side);
+ ResolveInstanceExpression (rc, right_side);
}
- if (!ResolveSetter (ec))
+ if (!best_candidate.HasSet) {
+ if (ResolveAutopropertyAssignment (rc, right_side))
+ return this;
+
+ rc.Report.Error (200, loc, "Property or indexer `{0}' cannot be assigned to (it is read-only)",
+ GetSignatureForError ());
return null;
+ }
+ if (!best_candidate.Set.IsAccessible (rc) || !best_candidate.Set.DeclaringType.IsAccessible (rc)) {
+ if (best_candidate.HasDifferentAccessibility) {
+ rc.Report.SymbolRelatedToPreviousError (best_candidate.Set);
+ rc.Report.Error (272, loc, "The property or indexer `{0}' cannot be used in this context because the set accessor is inaccessible",
+ GetSignatureForError ());
+ } else {
+ rc.Report.SymbolRelatedToPreviousError (best_candidate.Set);
+ ErrorIsInaccesible (rc, best_candidate.GetSignatureForError (), loc);
+ }
+ }
+
+ if (best_candidate.HasDifferentAccessibility)
+ CheckProtectedMemberAccess (rc, best_candidate.Set);
+
+ setter = CandidateToBaseOverride (rc, best_candidate.Set);
return this;
}
@@ -7063,30 +7158,9 @@ namespace Mono.CSharp {
return true;
}
- bool ResolveSetter (ResolveContext rc)
+ protected virtual bool ResolveAutopropertyAssignment (ResolveContext rc, Expression rhs)
{
- if (!best_candidate.HasSet) {
- rc.Report.Error (200, loc, "Property or indexer `{0}' cannot be assigned to (it is read-only)",
- GetSignatureForError ());
- return false;
- }
-
- if (!best_candidate.Set.IsAccessible (rc) || !best_candidate.Set.DeclaringType.IsAccessible (rc)) {
- if (best_candidate.HasDifferentAccessibility) {
- rc.Report.SymbolRelatedToPreviousError (best_candidate.Set);
- rc.Report.Error (272, loc, "The property or indexer `{0}' cannot be used in this context because the set accessor is inaccessible",
- GetSignatureForError ());
- } else {
- rc.Report.SymbolRelatedToPreviousError (best_candidate.Set);
- ErrorIsInaccesible (rc, best_candidate.GetSignatureForError (), loc);
- }
- }
-
- if (best_candidate.HasDifferentAccessibility)
- CheckProtectedMemberAccess (rc, best_candidate.Set);
-
- setter = CandidateToBaseOverride (rc, best_candidate.Set);
- return true;
+ return false;
}
}
diff --git a/mcs/mcs/flowanalysis.cs b/mcs/mcs/flowanalysis.cs
index dbb74a7515a..a28434d6bc2 100644
--- a/mcs/mcs/flowanalysis.cs
+++ b/mcs/mcs/flowanalysis.cs
@@ -139,7 +139,7 @@ namespace Mono.CSharp
var field = struct_info.Fields[i];
if (!fc.IsStructFieldDefinitelyAssigned (vi, field.Name)) {
- var bf = field.MemberDefinition as Property.BackingField;
+ var bf = field.MemberDefinition as Property.BackingFieldDeclaration;
if (bf != null) {
if (bf.Initializer != null)
continue;
diff --git a/mcs/mcs/property.cs b/mcs/mcs/property.cs
index ebe8aca2ea9..35f4cd74a03 100644
--- a/mcs/mcs/property.cs
+++ b/mcs/mcs/property.cs
@@ -728,12 +728,12 @@ namespace Mono.CSharp
public class Property : PropertyBase
{
- public sealed class BackingField : Field
+ public sealed class BackingFieldDeclaration : Field
{
readonly Property property;
const Modifiers DefaultModifiers = Modifiers.BACKING_FIELD | Modifiers.COMPILER_GENERATED | Modifiers.PRIVATE | Modifiers.DEBUGGER_HIDDEN;
- public BackingField (Property p, bool readOnly)
+ public BackingFieldDeclaration (Property p, bool readOnly)
: base (p.Parent, p.type_expr, DefaultModifiers | (p.ModFlags & (Modifiers.STATIC | Modifiers.UNSAFE)),
new MemberName ("<" + p.GetFullName (p.MemberName) + ">k__BackingField", p.Location), null)
{
@@ -756,8 +756,6 @@ namespace Mono.CSharp
static readonly string[] attribute_target_auto = new string[] { "property", "field" };
- Field backing_field;
-
public Property (TypeDefinition parent, FullNamedExpression type, Modifiers mod,
MemberName name, Attributes attrs)
: base (parent, type, mod,
@@ -768,6 +766,8 @@ namespace Mono.CSharp
{
}
+ public BackingFieldDeclaration BackingField { get; private set; }
+
public Expression Initializer { get; set; }
public override void Accept (StructuralVisitor visitor)
@@ -778,7 +778,7 @@ namespace Mono.CSharp
public override void ApplyAttributeBuilder (Attribute a, MethodSpec ctor, byte[] cdata, PredefinedAttributes pa)
{
if (a.Target == AttributeTargets.Field) {
- backing_field.ApplyAttributeBuilder (a, ctor, cdata, pa);
+ BackingField.ApplyAttributeBuilder (a, ctor, cdata, pa);
return;
}
@@ -788,20 +788,20 @@ namespace Mono.CSharp
void CreateAutomaticProperty ()
{
// Create backing field
- backing_field = new BackingField (this, Initializer != null && Set == null);
- if (!backing_field.Define ())
+ BackingField = new BackingFieldDeclaration (this, Initializer == null && Set == null);
+ if (!BackingField.Define ())
return;
if (Initializer != null) {
- backing_field.Initializer = Initializer;
- Parent.RegisterFieldForInitialization (backing_field, new FieldInitializer (backing_field, Initializer, Location));
- backing_field.ModFlags |= Modifiers.READONLY;
+ BackingField.Initializer = Initializer;
+ Parent.RegisterFieldForInitialization (BackingField, new FieldInitializer (BackingField, Initializer, Location));
+ BackingField.ModFlags |= Modifiers.READONLY;
}
- Parent.PartialContainer.Members.Add (backing_field);
+ Parent.PartialContainer.Members.Add (BackingField);
- FieldExpr fe = new FieldExpr (backing_field, Location);
- if ((backing_field.ModFlags & Modifiers.STATIC) == 0)
+ FieldExpr fe = new FieldExpr (BackingField, Location);
+ if ((BackingField.ModFlags & Modifiers.STATIC) == 0)
fe.InstanceExpression = new CompilerGeneratedThis (Parent.CurrentType, Location);
//
@@ -839,7 +839,7 @@ namespace Mono.CSharp
GetSignatureForError ());
if (IsInterface)
- Report.Error (8053, Location, "`{0}': Properties inside interfaces cannot have initializers",
+ Report.Error (8052, Location, "`{0}': Properties inside interfaces cannot have initializers",
GetSignatureForError ());
if (Compiler.Settings.Version < LanguageVersion.V_6)
@@ -848,16 +848,11 @@ namespace Mono.CSharp
if (auto) {
if (Get == null) {
- Report.Error (8052, Location, "Auto-implemented property `{0}' must have get accessor",
+ Report.Error (8051, Location, "Auto-implemented property `{0}' must have get accessor",
GetSignatureForError ());
return false;
}
- if (Initializer == null && AccessorSecond == null) {
- Report.Error (8051, Location, "Auto-implemented property `{0}' must have set accessor or initializer",
- GetSignatureForError ());
- }
-
if (Compiler.Settings.Version < LanguageVersion.V_3 && Initializer == null)
Report.FeatureIsNotAvailable (Compiler, Location, "auto-implemented properties");
diff --git a/mcs/tests/gtest-autoproperty-11.cs b/mcs/tests/gtest-autoproperty-11.cs
new file mode 100644
index 00000000000..dae2ebecbde
--- /dev/null
+++ b/mcs/tests/gtest-autoproperty-11.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Reflection;
+
+public class Test
+{
+ public string Property1 { get; }
+
+ public int Property2 { get; }
+
+ public static int Main ()
+ {
+ var t = new Test ();
+ if (t.Property1 != null)
+ return 1;
+
+ if (t.Property2 != 0)
+ return 2;
+
+ var fields = typeof (Test).GetFields(BindingFlags.NonPublic | BindingFlags.Instance);
+ if (fields.Length != 2)
+ return 3;
+
+ foreach (var fi in fields) {
+ if ((fi.Attributes & FieldAttributes.InitOnly) == 0)
+ return 4;
+ }
+
+ return 0;
+ }
+}
diff --git a/mcs/tests/gtest-autoproperty-12.cs b/mcs/tests/gtest-autoproperty-12.cs
new file mode 100644
index 00000000000..c738c3914c5
--- /dev/null
+++ b/mcs/tests/gtest-autoproperty-12.cs
@@ -0,0 +1,48 @@
+using System;
+
+public class A
+{
+ public int X { get; }
+ public virtual int Y { get; }
+
+ public A ()
+ {
+ X = 4;
+ X++;
+
+ Y = 2;
+ Y++;
+ }
+}
+
+class B : A
+{
+ int i_get;
+
+ public override int Y { get { ++i_get; return base.Y; } }
+
+ public static int Main ()
+ {
+ var a = new A ();
+ if (a.X != 5)
+ return 1;
+
+ if (a.Y != 3)
+ return 2;
+
+ var b = new B ();
+ if (b.X != 5)
+ return 3;
+
+ if (b.i_get != 1)
+ return 4;
+
+ if (b.Y != 3)
+ return 5;
+
+ if (b.i_get != 2)
+ return 6;
+
+ return 0;
+ }
+}
diff --git a/mcs/tests/gtest-autoproperty-13.cs b/mcs/tests/gtest-autoproperty-13.cs
new file mode 100644
index 00000000000..b6d84be28da
--- /dev/null
+++ b/mcs/tests/gtest-autoproperty-13.cs
@@ -0,0 +1,22 @@
+using System;
+
+public struct S
+{
+ public int X { get; }
+ public int Y { get; }
+
+ public S ()
+ {
+ X = 4;
+ Y = X;
+ }
+
+ public static int Main()
+ {
+ var s = new S ();
+ if (s.Y != 4)
+ return 1;
+
+ return 0;
+ }
+}
diff --git a/mcs/tests/gtest-autoproperty-14.cs b/mcs/tests/gtest-autoproperty-14.cs
new file mode 100644
index 00000000000..8b250de1df3
--- /dev/null
+++ b/mcs/tests/gtest-autoproperty-14.cs
@@ -0,0 +1,14 @@
+public struct S
+{
+ public int A { get; set;}
+
+ public S (int a)
+ {
+ this.A = a;
+ }
+
+ public static void Main ()
+ {
+
+ }
+} \ No newline at end of file
diff --git a/mcs/errors/cs0188-9.cs b/mcs/tests/test-909.cs
index fc0d3adb461..8527bb951eb 100644
--- a/mcs/errors/cs0188-9.cs
+++ b/mcs/tests/test-909.cs
@@ -1,6 +1,3 @@
-// CS0188: The `this' object cannot be used before all of its fields are assigned to
-// Line: 11
-
using System;
public struct S
@@ -13,4 +10,8 @@ public struct S
this.eh = null;
A = a;
}
+
+ public static void Main ()
+ {
+ }
}
diff --git a/mcs/tests/ver-il-net_4_5.xml b/mcs/tests/ver-il-net_4_5.xml
index 5532c77c4b7..cd8b13f82e0 100644
--- a/mcs/tests/ver-il-net_4_5.xml
+++ b/mcs/tests/ver-il-net_4_5.xml
@@ -20333,6 +20333,78 @@
</method>
</type>
</test>
+ <test name="gtest-autoproperty-11.cs">
+ <type name="Test">
+ <method name="System.String get_Property1()" attrs="2182">
+ <size>14</size>
+ </method>
+ <method name="Int32 get_Property2()" attrs="2182">
+ <size>14</size>
+ </method>
+ <method name="Int32 Main()" attrs="150">
+ <size>144</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
+ <test name="gtest-autoproperty-12.cs">
+ <type name="A">
+ <method name="Int32 get_X()" attrs="2182">
+ <size>14</size>
+ </method>
+ <method name="Int32 get_Y()" attrs="2502">
+ <size>14</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>50</size>
+ </method>
+ </type>
+ <type name="B">
+ <method name="Int32 get_Y()" attrs="2246">
+ <size>29</size>
+ </method>
+ <method name="Int32 Main()" attrs="150">
+ <size>136</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
+ <test name="gtest-autoproperty-13.cs">
+ <type name="S">
+ <method name="Int32 get_X()" attrs="2182">
+ <size>14</size>
+ </method>
+ <method name="Int32 get_Y()" attrs="2182">
+ <size>14</size>
+ </method>
+ <method name="Int32 Main()" attrs="150">
+ <size>37</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>21</size>
+ </method>
+ </type>
+ </test>
+ <test name="gtest-autoproperty-14.cs">
+ <type name="S">
+ <method name="Int32 get_A()" attrs="2182">
+ <size>14</size>
+ </method>
+ <method name="Void set_A(Int32)" attrs="2182">
+ <size>8</size>
+ </method>
+ <method name="Void Main()" attrs="150">
+ <size>2</size>
+ </method>
+ <method name="Void .ctor(Int32)" attrs="6278">
+ <size>9</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">
@@ -50859,6 +50931,38 @@
</method>
</type>
</test>
+ <test name="test-908.cs">
+ <type name="Test">
+ <method name="Void Main()" attrs="150">
+ <size>2</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
+ <test name="test-909.cs">
+ <type name="S">
+ <method name="Int32 get_A()" attrs="2182">
+ <size>14</size>
+ </method>
+ <method name="Void set_A(Int32)" attrs="2177">
+ <size>8</size>
+ </method>
+ <method name="Void add_eh(System.EventHandler)" attrs="2182">
+ <size>42</size>
+ </method>
+ <method name="Void remove_eh(System.EventHandler)" attrs="2182">
+ <size>42</size>
+ </method>
+ <method name="Void Main()" attrs="150">
+ <size>2</size>
+ </method>
+ <method name="Void .ctor(Int32)" attrs="6278">
+ <size>16</size>
+ </method>
+ </type>
+ </test>
<test name="test-91.cs">
<type name="Abstract">
<method name="Void .ctor()" attrs="6276">