Skip to content

Commit

Permalink
Fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
k94ll13nn3 committed May 27, 2024
1 parent 119cebf commit dfb16b6
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ private static void AnalyzeSymbol(SymbolAnalysisContext context)
&& attr.GetBoolParameterValue("addParameterless");
if (addParameterless)
{
(IMethodSymbol? constructor, _) = symbol.GetPreferedBaseConstructorOrBaseType();
(IMethodSymbol? constructor, _) = symbol.GetPreferredBaseConstructorOrBaseType();
if (constructor?.Parameters.Length > 0)
{
SyntaxReference? propertyTypeIdentifier = attr.ApplicationSyntaxReference;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private static bool SymbolHasFields(INamedTypeSymbol symbol)

private static bool ParentHasFields(Compilation compilation, INamedTypeSymbol symbol)
{
(IMethodSymbol? constructor, INamedTypeSymbol? baseType) = symbol.GetPreferedBaseConstructorOrBaseType();
(IMethodSymbol? constructor, INamedTypeSymbol? baseType) = symbol.GetPreferredBaseConstructorOrBaseType();
if (constructor is not null)
{
return constructor.Parameters.Length > 0;
Expand Down
4 changes: 2 additions & 2 deletions src/AutoConstructor.Generator/AutoConstructorGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
{
if (item.result.ReportedDiagnostic is ReportedDiagnostic diagnostic)
{
context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.MistmatchTypesRule, Location.Create(diagnostic.FilePath, diagnostic.TextSpan, diagnostic.LineSpan)));
context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.MismatchTypesRule, Location.Create(diagnostic.FilePath, diagnostic.TextSpan, diagnostic.LineSpan)));
}
else if (item.result.Symbol is not null)
{
Expand Down Expand Up @@ -437,7 +437,7 @@ private static FieldInfo GetFieldInfo(IFieldSymbol fieldSymbol)

private static void ExtractFieldsFromParent(INamedTypeSymbol symbol, List<FieldInfo> concatenatedFields)
{
(IMethodSymbol? constructor, INamedTypeSymbol? baseType) = symbol.GetPreferedBaseConstructorOrBaseType();
(IMethodSymbol? constructor, INamedTypeSymbol? baseType) = symbol.GetPreferredBaseConstructorOrBaseType();
if (constructor is not null)
{
ExtractFieldsFromConstructedParent(concatenatedFields, constructor);
Expand Down
2 changes: 1 addition & 1 deletion src/AutoConstructor.Generator/DiagnosticDescriptors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public static class DiagnosticDescriptors
$"https://github.com/k94ll13nn3/AutoConstructor#{IgnoreOrInjectAttributeOnTypeWithoutAttributeDiagnosticId}",
WellKnownDiagnosticTags.Unnecessary);

public static readonly DiagnosticDescriptor MistmatchTypesRule = new(
public static readonly DiagnosticDescriptor MismatchTypesRule = new(
MismatchTypesDiagnosticId,
"Couldn't generate constructor",
"One or more parameter have mismatching types",
Expand Down
10 changes: 5 additions & 5 deletions src/AutoConstructor.Generator/Extensions/SymbolExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,18 @@ public static string GenerateFilename(this INamedTypeSymbol symbol)
return filename;
}

public static (IMethodSymbol? constructor, INamedTypeSymbol? baseType) GetPreferedBaseConstructorOrBaseType(this INamedTypeSymbol symbol)
public static (IMethodSymbol? constructor, INamedTypeSymbol? baseType) GetPreferredBaseConstructorOrBaseType(this INamedTypeSymbol symbol)
{
INamedTypeSymbol? baseType = symbol.BaseType;

// Check if base type is not object (ie. its base type is null)
if (baseType?.BaseType is not null)
{
// Check if there is a defined preferedBaseConstructor
IMethodSymbol? preferedBaseConstructor = baseType.Constructors.FirstOrDefault(d => d.HasAttribute(Source.DefaultBaseAttributeFullName));
if (preferedBaseConstructor is not null)
// Check if there is a defined preferredBaseConstructor
IMethodSymbol? preferredBaseConstructor = baseType.Constructors.FirstOrDefault(d => d.HasAttribute(Source.DefaultBaseAttributeFullName));
if (preferredBaseConstructor is not null)
{
return (preferedBaseConstructor, null);
return (preferredBaseConstructor, null);
}
// If symbol is in same assembly, the generated constructor is not visible as it might not be yet generated.
// If not is the same assembly, is does not matter if the constructor was generated or not.
Expand Down

0 comments on commit dfb16b6

Please sign in to comment.