Skip to content

Commit

Permalink
Fix test failures in features/semi-auto-props (#61344)
Browse files Browse the repository at this point in the history
The merge from `main` included a change that removed extra unused diagnostic arguments. But CI run in the merge PR didn't include these tests.
  • Loading branch information
Youssef1313 authored May 16, 2022
1 parent 550635e commit d04d096
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public class Derived4 : Base
Diagnostic(ErrorCode.ERR_AutoPropertyMustOverrideSet, "P2").WithLocation(17, 25),
// (25,30): error CS8051: Auto-implemented properties must have get accessors.
// public override int P1 { set; }
Diagnostic(ErrorCode.ERR_AutoPropertyMustHaveGetAccessor, "set").WithArguments("Derived3.P1.set").WithLocation(25, 30)
Diagnostic(ErrorCode.ERR_AutoPropertyMustHaveGetAccessor, "set").WithLocation(25, 30)
);
Assert.Equal(callGetFieldsToEmit ? 5 : 0, accessorBindingData.NumberOfPerformedAccessorBinding);
}
Expand Down Expand Up @@ -215,13 +215,13 @@ public interface I
Diagnostic(ErrorCode.ERR_InterfacesCantContainFields, "field").WithLocation(8, 61),
// (10,16): error CS8053: Instance properties in interfaces cannot have initializers.
// public int P4 { get => field; } = 0;
Diagnostic(ErrorCode.ERR_InstancePropertyInitializerInInterface, "P4").WithArguments("I.P4").WithLocation(10, 16),
Diagnostic(ErrorCode.ERR_InstancePropertyInitializerInInterface, "P4").WithLocation(10, 16),
// (10,28): error CS0525: Interfaces cannot contain instance fields
// public int P4 { get => field; } = 0;
Diagnostic(ErrorCode.ERR_InterfacesCantContainFields, "field").WithLocation(10, 28),
// (12,16): error CS8053: Instance properties in interfaces cannot have initializers.
// public int P5 { get => field; set => field = value; } = 0;
Diagnostic(ErrorCode.ERR_InstancePropertyInitializerInInterface, "P5").WithArguments("I.P5").WithLocation(12, 16),
Diagnostic(ErrorCode.ERR_InstancePropertyInitializerInInterface, "P5").WithLocation(12, 16),
// (12,28): error CS0525: Interfaces cannot contain instance fields
// public int P5 { get => field; set => field = value; } = 0;
Diagnostic(ErrorCode.ERR_InterfacesCantContainFields, "field").WithLocation(12, 28),
Expand All @@ -230,7 +230,7 @@ public interface I
Diagnostic(ErrorCode.ERR_InterfacesCantContainFields, "field").WithLocation(12, 42),
// (14,16): error CS8053: Instance properties in interfaces cannot have initializers.
// public int P6 { get { _ = field; return field; } set => field = value; } = 0;
Diagnostic(ErrorCode.ERR_InstancePropertyInitializerInInterface, "P6").WithArguments("I.P6").WithLocation(14, 16),
Diagnostic(ErrorCode.ERR_InstancePropertyInitializerInInterface, "P6").WithLocation(14, 16),
// (14,31): error CS0525: Interfaces cannot contain instance fields
// public int P6 { get { _ = field; return field; } set => field = value; } = 0;
Diagnostic(ErrorCode.ERR_InterfacesCantContainFields, "field").WithLocation(14, 31),
Expand Down Expand Up @@ -3024,7 +3024,7 @@ class C
comp.VerifyDiagnostics(
// (4,21): error CS8051: Auto-implemented properties must have get accessors.
// public int P1 { set; }
Diagnostic(ErrorCode.ERR_AutoPropertyMustHaveGetAccessor, "set").WithArguments("C.P1.set").WithLocation(4, 21)
Diagnostic(ErrorCode.ERR_AutoPropertyMustHaveGetAccessor, "set").WithLocation(4, 21)
);
Assert.Equal(0, accessorBindingData.NumberOfPerformedAccessorBinding);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2633,7 +2633,7 @@ public C()
Diagnostic(ErrorCode.ERR_PropertyWithNoAccessors, "P").WithArguments("C.P").WithLocation(5, 19),
// (7,19): error CS8050: Only auto-implemented properties can have initializers.
// public string P3 { } = string.Empty;
Diagnostic(ErrorCode.ERR_InitializerOnNonAutoProperty, "P3").WithArguments("C.P3").WithLocation(7, 19),
Diagnostic(ErrorCode.ERR_InitializerOnNonAutoProperty, "P3").WithLocation(7, 19),
// (7,19): error CS0548: 'C.P3': property or indexer must have at least one accessor
// public string P3 { } = string.Empty;
Diagnostic(ErrorCode.ERR_PropertyWithNoAccessors, "P3").WithArguments("C.P3").WithLocation(7, 19),
Expand Down

0 comments on commit d04d096

Please sign in to comment.