--- /dev/null
+// CS0545: `B.Prop': cannot override because `A.Prop' does not have accessible get accessor
+// Line: 13
+
+public class A
+{
+ public virtual string Prop {
+ set; private get;
+ }
+}
+
+public class B : A
+{
+ sealed override public string Prop {
+ set { }
+ }
+}
\ No newline at end of file
--- /dev/null
+// CS0546: `B.Prop': cannot override because `A.Prop' does not have accessible set accessor
+// Line: 13
+
+public class A
+{
+ public virtual string Prop {
+ get; private set;
+ }
+}
+
+public class B : A
+{
+ sealed override public string Prop {
+ get { return ""; }
+ }
+}
\ No newline at end of file
// Check base property accessors conflict
//
var base_prop = (PropertySpec) base_member;
- if (Get != null) {
+ if (Get == null) {
+ if ((ModFlags & Modifiers.SEALED) != 0 && base_prop.HasGet && !base_prop.Get.IsAccessible (this)) {
+ // TODO: Should be different error code but csc uses for some reason same
+ Report.SymbolRelatedToPreviousError (base_prop);
+ Report.Error (545, Location,
+ "`{0}': cannot override because `{1}' does not have accessible get accessor",
+ GetSignatureForError (), base_prop.GetSignatureForError ());
+ ok = false;
+ }
+ } else {
if (!base_prop.HasGet) {
if (ok) {
Report.SymbolRelatedToPreviousError (base_prop);
}
}
- if (Set != null) {
+ if (Set == null) {
+ if ((ModFlags & Modifiers.SEALED) != 0 && base_prop.HasSet && !base_prop.Set.IsAccessible (this)) {
+ // TODO: Should be different error code but csc uses for some reason same
+ Report.SymbolRelatedToPreviousError (base_prop);
+ Report.Error (546, Location,
+ "`{0}': cannot override because `{1}' does not have accessible set accessor",
+ GetSignatureForError (), base_prop.GetSignatureForError ());
+ ok = false;
+ }
+ } else {
if (!base_prop.HasSet) {
if (ok) {
Report.SymbolRelatedToPreviousError (base_prop);