From 1341c0df6ceec985f12061674bd8b61e7ce22170 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 3 Sep 2024 09:57:22 +0100 Subject: [PATCH] 0.9.9 - another generic fix --- .../MethodGenerationTests.cs | 5 ++++- .../AutoInterfaceGenerator.cs | 16 ++++------------ .../Speckle.InterfaceGenerator.csproj | 2 +- Speckle.InterfaceGenerator/SymbolExtensions.cs | 2 +- 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/Speckle.InterfaceGenerator.Tests/MethodGenerationTests.cs b/Speckle.InterfaceGenerator.Tests/MethodGenerationTests.cs index 263766b..a6521dd 100644 --- a/Speckle.InterfaceGenerator.Tests/MethodGenerationTests.cs +++ b/Speckle.InterfaceGenerator.Tests/MethodGenerationTests.cs @@ -379,4 +379,7 @@ internal class MethodsTestService : IMethodsTestService [GenerateAutoInterface] internal class MethodsTestServiceGeneric : IMethodsTestServiceGeneric - where T : class { } + where T : class +{ + public T? ResolveInstance(string strongName) => throw new NotImplementedException(); +} diff --git a/Speckle.InterfaceGenerator/AutoInterfaceGenerator.cs b/Speckle.InterfaceGenerator/AutoInterfaceGenerator.cs index 2fc3394..65db113 100644 --- a/Speckle.InterfaceGenerator/AutoInterfaceGenerator.cs +++ b/Speckle.InterfaceGenerator/AutoInterfaceGenerator.cs @@ -230,15 +230,11 @@ public class AutoInterfaceGenerator : ISourceGenerator continue; } - GenerateInterfaceMemberDefinition(writer, implTypeSymbol, member); + GenerateInterfaceMemberDefinition(writer, member); } } - private static void GenerateInterfaceMemberDefinition( - TextWriter writer, - INamedTypeSymbol owner, - ISymbol member - ) + private static void GenerateInterfaceMemberDefinition(TextWriter writer, ISymbol member) { switch (member) { @@ -246,7 +242,7 @@ public class AutoInterfaceGenerator : ISourceGenerator GeneratePropertyDefinition(writer, propertySymbol); break; case IMethodSymbol methodSymbol: - GenerateMethodDefinition(writer, owner, methodSymbol); + GenerateMethodDefinition(writer, methodSymbol); break; } } @@ -343,11 +339,7 @@ public class AutoInterfaceGenerator : ISourceGenerator writer.WriteLine("}"); } - private static void GenerateMethodDefinition( - TextWriter writer, - INamedTypeSymbol owner, - IMethodSymbol methodSymbol - ) + private static void GenerateMethodDefinition(TextWriter writer, IMethodSymbol methodSymbol) { if (methodSymbol.MethodKind != MethodKind.Ordinary || methodSymbol.IsStatic) { diff --git a/Speckle.InterfaceGenerator/Speckle.InterfaceGenerator.csproj b/Speckle.InterfaceGenerator/Speckle.InterfaceGenerator.csproj index 9577c28..dfcb1d1 100644 --- a/Speckle.InterfaceGenerator/Speckle.InterfaceGenerator.csproj +++ b/Speckle.InterfaceGenerator/Speckle.InterfaceGenerator.csproj @@ -3,7 +3,7 @@ netstandard2.0 Latest enable - 0.9.8 + 0.9.9 true false false diff --git a/Speckle.InterfaceGenerator/SymbolExtensions.cs b/Speckle.InterfaceGenerator/SymbolExtensions.cs index 7e1fbba..916afca 100644 --- a/Speckle.InterfaceGenerator/SymbolExtensions.cs +++ b/Speckle.InterfaceGenerator/SymbolExtensions.cs @@ -12,7 +12,7 @@ internal static class SymbolExtensions { if (typeSymbol is ITypeParameterSymbol t) { - return t.Name; + return t.ToString(); } if (typeSymbol.SpecialType != SpecialType.None)