Browse Source

Fixed an issue where the copy constructor of type `DerivedGeneric` in unit tests was not recognized as compiler-generated code after the commit "`Fixed the issue where the DefaultParameters type in https://github.com/restsharp/RestSharp/blob/dev/src/RestSharp/Parameters/DefaultParameters.cs was incorrectly judged as to whether the primary constructor was used due to incorrect initialization logic of isStruct and isInheritedRecord in the constructor of the RecordDecompiler class.`".

pull/3598/head
sonyps5201314 2 months ago
parent
commit
439ceef2a2
  1. 2
      ICSharpCode.Decompiler/CSharp/RecordDecompiler.cs

2
ICSharpCode.Decompiler/CSharp/RecordDecompiler.cs

@ -55,7 +55,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -55,7 +55,7 @@ namespace ICSharpCode.Decompiler.CSharp
this.cancellationToken = cancellationToken;
this.baseClass = recordTypeDef.DirectBaseTypes.FirstOrDefault(b => b.Kind == TypeKind.Class);
this.isStruct = recordTypeDef.Kind == TypeKind.Struct;
var baseClassTypeDef = baseClass as ITypeDefinition;
var baseClassTypeDef = (baseClass is ITypeDefinition def) ? def : (baseClass is ParameterizedType paramT) ? paramT.GenericType as ITypeDefinition : null;
this.isInheritedRecord = !isStruct && (baseClassTypeDef?.IsRecord ?? false);
this.isSealed = recordTypeDef.IsSealed;
DetectAutomaticProperties();

Loading…
Cancel
Save