Skip to content

Commit

Permalink
Use covariant return for synthesized record clone (#53404)
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef1313 authored Jul 11, 2021
1 parent 26cf667 commit 8eb425e
Show file tree
Hide file tree
Showing 2 changed files with 259 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ static bool modifiersAreValid(DeclarationModifiers modifiers)

protected override (TypeWithAnnotations ReturnType, ImmutableArray<ParameterSymbol> Parameters, bool IsVararg, ImmutableArray<TypeParameterConstraintClause> DeclaredConstraintsForOverrideOrImplementation) MakeParametersAndBindReturnType(BindingDiagnosticBag diagnostics)
{
return (ReturnType: VirtualCloneInBase() is { } baseClone ?
baseClone.ReturnTypeWithAnnotations : // Use covariant returns when available
return (ReturnType: !ContainingAssembly.RuntimeSupportsCovariantReturnsOfClasses && VirtualCloneInBase() is { } baseClone ?
baseClone.ReturnTypeWithAnnotations :
TypeWithAnnotations.Create(isNullableEnabled: true, ContainingType),
Parameters: ImmutableArray<ParameterSymbol>.Empty,
IsVararg: false,
Expand Down
Loading

0 comments on commit 8eb425e

Please sign in to comment.