diff --git a/src/Shared/Helpers/GeneratorUtilities.cs b/src/Shared/Helpers/GeneratorUtilities.cs index 9108ab1..affe823 100644 --- a/src/Shared/Helpers/GeneratorUtilities.cs +++ b/src/Shared/Helpers/GeneratorUtilities.cs @@ -43,7 +43,8 @@ public static EquatableList GetTypeDeclarations(ITypeSymbol type) { IsRecord: true, IsValueType: true } => "record struct", { IsRecord: true, IsValueType: false } => "record", { IsRecord: false, IsValueType: true } => "struct", - { IsRecord: false, IsValueType: false } => "class", + { IsRecord: false, IsValueType: false, TypeKind: TypeKind.Class } => "class", + { IsRecord: false, IsValueType: false, TypeKind: TypeKind.Interface } => "interface", _ => string.Empty }; diff --git a/src/Tests/Examples/Issue536.cs b/src/Tests/Examples/Issue536.cs new file mode 100644 index 0000000..3e59a0d --- /dev/null +++ b/src/Tests/Examples/Issue536.cs @@ -0,0 +1,8 @@ +public partial interface IInterface +{ + [AutoCtor.AutoConstruct] + public partial class NestedClass + { + public IInterface Item { get; } + } +} diff --git a/src/Tests/Examples/Issue536.cs#IInterface.NestedClass.g.verified.cs b/src/Tests/Examples/Issue536.cs#IInterface.NestedClass.g.verified.cs new file mode 100644 index 0000000..385eba8 --- /dev/null +++ b/src/Tests/Examples/Issue536.cs#IInterface.NestedClass.g.verified.cs @@ -0,0 +1,21 @@ +//HintName: IInterface.NestedClass.g.cs +//------------------------------------------------------------------------------ +// +// This code was generated by https://github.com/distantcam/AutoCtor +// +//------------------------------------------------------------------------------ + +partial interface IInterface +{ + partial class NestedClass + { + [global::System.Runtime.CompilerServices.CompilerGenerated] + [global::System.CodeDom.Compiler.GeneratedCode("AutoCtor", "0.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCode] + [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + public NestedClass(global::IInterface item) + { + this.Item = item; + } + } +}