[mcs] Implements expression bodied members
[mono.git] / mcs / mcs / flowanalysis.cs
index 89ab4f1425324be34983df1d501e2a97651306b8..dbb74a7515a0d930a37c4832521afe6acb04c247 100644 (file)
@@ -139,15 +139,22 @@ namespace Mono.CSharp
                                var field = struct_info.Fields[i];
 
                                if (!fc.IsStructFieldDefinitelyAssigned (vi, field.Name)) {
-                                       if (field.MemberDefinition is Property.BackingField) {
+                                       var bf = field.MemberDefinition as Property.BackingField;
+                                       if (bf != null) {
+                                               if (bf.Initializer != null)
+                                                       continue;
+
                                                fc.Report.Error (843, loc,
                                                        "An automatically implemented property `{0}' must be fully assigned before control leaves the constructor. Consider calling the default struct contructor from a constructor initializer",
                                                        field.GetSignatureForError ());
-                                       } else {
-                                               fc.Report.Error (171, loc,
-                                                       "Field `{0}' must be fully assigned before control leaves the constructor",
-                                                       field.GetSignatureForError ());
+
+                                               ok = false;
+                                               continue;
                                        }
+
+                                       fc.Report.Error (171, loc,
+                                               "Field `{0}' must be fully assigned before control leaves the constructor",
+                                               field.GetSignatureForError ());
                                        ok = false;
                                }
                        }
@@ -526,8 +533,12 @@ namespace Mono.CSharp
 
                public DefiniteAssignmentBitSet (DefiniteAssignmentBitSet source)
                {
-                       large_bits = source.large_bits;
-                       bits = source.bits | copy_on_write_flag;
+                       if (source.large_bits != null) {
+                               large_bits = source.large_bits;
+                               bits = source.bits | copy_on_write_flag;
+                       } else {
+                               bits = source.bits & ~copy_on_write_flag;
+                       }
                }
 
                public static DefiniteAssignmentBitSet operator & (DefiniteAssignmentBitSet a, DefiniteAssignmentBitSet b)
@@ -640,10 +651,7 @@ namespace Mono.CSharp
 
                void Clone ()
                {
-                       if (large_bits != null)
-                               large_bits = (int[]) large_bits.Clone ();
-
-                       bits &= ~copy_on_write_flag;
+                       large_bits = (int[]) large_bits.Clone ();
                }
 
                bool GetBit (int index)