Skip to content

Commit

Permalink
Fully qualify type names to prevent types with the same name from bei…
Browse files Browse the repository at this point in the history
…ng seen as identical

A test can't yet be written for this, as the generator can't currently handle same-named types
Also updated the test to show that nested generics work correctly
  • Loading branch information
simonmckenzie committed Aug 15, 2024
1 parent f2ee876 commit eee257a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion AutomaticInterface/AutomaticInterface/Builder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public static class Builder
genericsOptions: SymbolDisplayGenericsOptions.IncludeTypeParameters,
memberOptions: SymbolDisplayMemberOptions.IncludeParameters,
parameterOptions: SymbolDisplayParameterOptions.IncludeType
| SymbolDisplayParameterOptions.IncludeParamsRefOut
| SymbolDisplayParameterOptions.IncludeParamsRefOut,
typeQualificationStyle: SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces
);

public static string BuildInterfaceFor(ITypeSymbol typeSymbol)
Expand Down
8 changes: 4 additions & 4 deletions AutomaticInterface/Tests/GeneratorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2043,9 +2043,9 @@ namespace AutomaticInterfaceExample;
[GenerateAutomaticInterface]
public class DemoClass
{
public void AMethod(Func<int> getValue) {}
public void AMethod(Func<Task<int>> getValue) {}
public void AMethod(Func<float> getValue) {}
public void AMethod(Func<Task<float>> getValue) {}
}
""";
Expand All @@ -2068,10 +2068,10 @@ namespace AutomaticInterfaceExample
public partial interface IDemoClass
{
/// <inheritdoc />
void AMethod(Func<int> getValue);
void AMethod(Func<Task<int>> getValue);
/// <inheritdoc />
void AMethod(Func<float> getValue);
void AMethod(Func<Task<float>> getValue);
}
}
Expand Down

0 comments on commit eee257a

Please sign in to comment.