Skip to content

Commit

Permalink
Add parameter names to synthesized record members (#46069)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcouv authored Jul 20, 2020
1 parent 2a69ac3 commit 41fa23e
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected override (TypeWithAnnotations ReturnType, ImmutableArray<ParameterSymb
Parameters: ImmutableArray.Create<ParameterSymbol>(
new SourceSimpleParameterSymbol(owner: this,
TypeWithAnnotations.Create(ContainingType.BaseTypeNoUseSiteDiagnostics, NullableAnnotation.Annotated),
ordinal: 0, RefKind.None, "", isDiscard: false, Locations)),
ordinal: 0, RefKind.None, "other", isDiscard: false, Locations)),
IsVararg: false,
DeclaredConstraintsForOverrideOrImplementation: ImmutableArray<TypeParameterConstraintClause>.Empty);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public SynthesizedRecordCopyCtor(
isNullableEnabled: true,
ContainingType),
ordinal: 0,
RefKind.None));
RefKind.None,
"original"));
}

public override ImmutableArray<ParameterSymbol> Parameters { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected override (TypeWithAnnotations ReturnType, ImmutableArray<ParameterSymb
Parameters: ImmutableArray.Create<ParameterSymbol>(
new SourceSimpleParameterSymbol(owner: this,
TypeWithAnnotations.Create(ContainingType, NullableAnnotation.Annotated),
ordinal: 0, RefKind.None, "", isDiscard: false, Locations)),
ordinal: 0, RefKind.None, "other", isDiscard: false, Locations)),
IsVararg: false,
DeclaredConstraintsForOverrideOrImplementation: ImmutableArray<TypeParameterConstraintClause>.Empty);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2184,8 +2184,8 @@ void M() { }
"void C.M()",
"System.Int32 C.GetHashCode()",
"System.Boolean C.Equals(System.Object? obj)",
"System.Boolean C.Equals(C? )",
"C..ctor(C )",
"System.Boolean C.Equals(C? other)",
"C..ctor(C original)",
"void C.Deconstruct(out System.Int32 i)",
}, cMembers.ToTestDisplayStrings());

Expand Down
56 changes: 28 additions & 28 deletions src/Compilers/CSharp/Test/Semantic/Semantics/LookupPositionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ record C(int x, int y)
"Microsoft",
"C"),
Add( // Members
"System.Boolean C.Equals(C? )",
"System.Boolean C.Equals(C? other)",
"System.Boolean C.Equals(System.Object? obj)",
"System.Boolean System.Object.Equals(System.Object obj)",
"System.Boolean System.Object.Equals(System.Object objA, System.Object objB)",
Expand Down Expand Up @@ -71,7 +71,7 @@ public void PositionalRecord2()
Add( // Members
"System.Int32 C<T>.x { get; init; }",
"T C<T>.t { get; init; }",
"System.Boolean C<T>.Equals(C<T>? )",
"System.Boolean C<T>.Equals(C<T>? other)",
"System.Boolean C<T>.Equals(System.Object? obj)",
"System.Boolean System.Object.Equals(System.Object obj)",
"System.Boolean System.Object.Equals(System.Object objA, System.Object objB)",
Expand Down Expand Up @@ -102,7 +102,7 @@ public void NominalRecord()
var members = new[] {
"System.Int32 C<T>.x { get; }",
"T C<T>.t { get; }",
"System.Boolean C<T>.Equals(C<T>? )",
"System.Boolean C<T>.Equals(C<T>? other)",
"System.Boolean C<T>.Equals(System.Object? obj)",
"System.Boolean System.Object.Equals(System.Object obj)",
"System.Boolean System.Object.Equals(System.Object objA, System.Object objB)",
Expand Down Expand Up @@ -1707,8 +1707,8 @@ record C(int X) : Base`(X`)
"Microsoft",
"C"),
Add( // Members + parameters
"System.Boolean C.Equals(Base? )",
"System.Boolean C.Equals(C? )",
"System.Boolean C.Equals(Base? other)",
"System.Boolean C.Equals(C? other)",
"System.Boolean C.Equals(System.Object? obj)",
"System.Boolean System.Object.Equals(System.Object obj)",
"System.Boolean System.Object.Equals(System.Object objA, System.Object objB)",
Expand All @@ -1724,8 +1724,8 @@ record C(int X) : Base`(X`)
"void System.Object.Finalize()"),
s_pop,
Add( // Members
"System.Boolean C.Equals(Base? )",
"System.Boolean C.Equals(C? )",
"System.Boolean C.Equals(Base? other)",
"System.Boolean C.Equals(C? other)",
"System.Boolean C.Equals(System.Object? obj)",
"System.Boolean System.Object.Equals(System.Object obj)",
"System.Boolean System.Object.Equals(System.Object objA, System.Object objB)",
Expand Down Expand Up @@ -1759,8 +1759,8 @@ record C : Base(X)
"Microsoft",
"C"),
Add( // Members
"System.Boolean C.Equals(Base? )",
"System.Boolean C.Equals(C? )",
"System.Boolean C.Equals(Base? other)",
"System.Boolean C.Equals(C? other)",
"System.Boolean C.Equals(System.Object? obj)",
"System.Boolean System.Object.Equals(System.Object obj)",
"System.Boolean System.Object.Equals(System.Object objA, System.Object objB)",
Expand Down Expand Up @@ -1796,8 +1796,8 @@ partial record C : Base(X, Y)
"Microsoft",
"C"),
Add( // Members
"System.Boolean C.Equals(Base? )",
"System.Boolean C.Equals(C? )",
"System.Boolean C.Equals(Base? other)",
"System.Boolean C.Equals(C? other)",
"System.Boolean C.Equals(System.Object? obj)",
"System.Boolean System.Object.Equals(System.Object obj)",
"System.Boolean System.Object.Equals(System.Object objA, System.Object objB)",
Expand All @@ -1813,8 +1813,8 @@ partial record C : Base(X, Y)
"void System.Object.Finalize()"),
s_pop,
Add( // Members
"System.Boolean C.Equals(Base? )",
"System.Boolean C.Equals(C? )",
"System.Boolean C.Equals(Base? other)",
"System.Boolean C.Equals(C? other)",
"System.Boolean C.Equals(System.Object? obj)",
"System.Boolean System.Object.Equals(System.Object obj)",
"System.Boolean System.Object.Equals(System.Object objA, System.Object objB)",
Expand Down Expand Up @@ -1853,8 +1853,8 @@ partial record C : Base(X)
"Microsoft",
"C"),
Add( // Members + parameters
"System.Boolean C.Equals(Base? )",
"System.Boolean C.Equals(C? )",
"System.Boolean C.Equals(Base? other)",
"System.Boolean C.Equals(C? other)",
"System.Boolean C.Equals(System.Object? obj)",
"System.Boolean System.Object.Equals(System.Object obj)",
"System.Boolean System.Object.Equals(System.Object objA, System.Object objB)",
Expand All @@ -1870,8 +1870,8 @@ partial record C : Base(X)
"void System.Object.Finalize()"),
s_pop,
Add( // Members
"System.Boolean C.Equals(Base? )",
"System.Boolean C.Equals(C? )",
"System.Boolean C.Equals(Base? other)",
"System.Boolean C.Equals(C? other)",
"System.Boolean C.Equals(System.Object? obj)",
"System.Boolean System.Object.Equals(System.Object obj)",
"System.Boolean System.Object.Equals(System.Object objA, System.Object objB)",
Expand All @@ -1887,8 +1887,8 @@ partial record C : Base(X)
"void System.Object.Finalize()"),
s_pop,
Add( // Members
"System.Boolean C.Equals(Base? )",
"System.Boolean C.Equals(C? )",
"System.Boolean C.Equals(Base? other)",
"System.Boolean C.Equals(C? other)",
"System.Boolean C.Equals(System.Object? obj)",
"System.Boolean System.Object.Equals(System.Object obj)",
"System.Boolean System.Object.Equals(System.Object objA, System.Object objB)",
Expand Down Expand Up @@ -1926,8 +1926,8 @@ partial record C(int X) : Base`(X`)
"Microsoft",
"C"),
Add( // Members
"System.Boolean C.Equals(Base? )",
"System.Boolean C.Equals(C? )",
"System.Boolean C.Equals(Base? other)",
"System.Boolean C.Equals(C? other)",
"System.Boolean C.Equals(System.Object? obj)",
"System.Boolean System.Object.Equals(System.Object obj)",
"System.Boolean System.Object.Equals(System.Object objA, System.Object objB)",
Expand All @@ -1943,8 +1943,8 @@ partial record C(int X) : Base`(X`)
"void System.Object.Finalize()"),
s_pop,
Add( // Members + parameters
"System.Boolean C.Equals(Base? )",
"System.Boolean C.Equals(C? )",
"System.Boolean C.Equals(Base? other)",
"System.Boolean C.Equals(C? other)",
"System.Boolean C.Equals(System.Object? obj)",
"System.Boolean System.Object.Equals(System.Object obj)",
"System.Boolean System.Object.Equals(System.Object objA, System.Object objB)",
Expand All @@ -1960,8 +1960,8 @@ partial record C(int X) : Base`(X`)
"void System.Object.Finalize()"),
s_pop,
Add( // Members
"System.Boolean C.Equals(Base? )",
"System.Boolean C.Equals(C? )",
"System.Boolean C.Equals(Base? other)",
"System.Boolean C.Equals(C? other)",
"System.Boolean C.Equals(System.Object? obj)",
"System.Boolean System.Object.Equals(System.Object obj)",
"System.Boolean System.Object.Equals(System.Object objA, System.Object objB)",
Expand Down Expand Up @@ -2081,7 +2081,7 @@ record C(int X)
"Microsoft",
"C"),
Add( // Members
"System.Boolean C.Equals(C? )",
"System.Boolean C.Equals(C? other)",
"System.Boolean C.Equals(System.Object? obj)",
"System.Boolean System.Object.Equals(System.Object obj)",
"System.Boolean System.Object.Equals(System.Object objA, System.Object objB)",
Expand Down Expand Up @@ -2122,7 +2122,7 @@ record C(int X)
"Microsoft",
"C"),
Add( // Members
"System.Boolean C.Equals(C? )",
"System.Boolean C.Equals(C? other)",
"System.Boolean C.Equals(System.Object? obj)",
"System.Boolean System.Object.Equals(System.Object obj)",
"System.Boolean System.Object.Equals(System.Object objA, System.Object objB)",
Expand Down Expand Up @@ -2158,7 +2158,7 @@ record C(int X)
"Microsoft",
"C"),
Add( // Members
"System.Boolean C.Equals(C? )",
"System.Boolean C.Equals(C? other)",
"System.Boolean C.Equals(System.Object? obj)",
"System.Boolean System.Object.Equals(System.Object obj)",
"System.Boolean System.Object.Equals(System.Object objA, System.Object objB)",
Expand Down
Loading

0 comments on commit 41fa23e

Please sign in to comment.