Module.PredefinedAttributes.Dynamic.EmitAttribute (FieldBuilder, member_type, Location);
}
+ if (member_type.HasNamedTupleElement) {
+ Module.PredefinedAttributes.TupleElementNames.EmitAttribute (FieldBuilder, member_type, Location);
+ }
+
if ((ModFlags & Modifiers.COMPILER_GENERATED) != 0 && !Parent.IsCompilerGenerated)
Module.PredefinedAttributes.CompilerGenerated.EmitAttribute (FieldBuilder);
if ((ModFlags & Modifiers.DEBUGGER_HIDDEN) != 0)
Report.Error (625, Location, "`{0}': Instance field types marked with StructLayout(LayoutKind.Explicit) must have a FieldOffset attribute", GetSignatureForError ());
}
- ConstraintChecker.Check (this, member_type, type_expr.Location);
+ if (!IsCompilerGenerated)
+ ConstraintChecker.Check (this, member_type, type_expr.Location);
base.Emit ();
}
}
}
-#endregion
+ #endregion
public FieldInfo GetMetaInfo ()
{
return true;
}
+ protected override void DoMemberTypeIndependentChecks ()
+ {
+ if ((Parent.PartialContainer.ModFlags & Modifiers.READONLY) != 0 && (ModFlags & (Modifiers.READONLY | Modifiers.STATIC)) == 0) {
+ Report.Error (8340, Location, "`{0}': Instance fields in readonly structs must be readonly",
+ GetSignatureForError ());
+ }
+
+ base.DoMemberTypeIndependentChecks ();
+ }
+
protected override void DoMemberTypeDependentChecks ()
{
if ((ModFlags & Modifiers.BACKING_FIELD) != 0)