Skip to content

Commit

Permalink
Types does not have to be in same compile unit..
Browse files Browse the repository at this point in the history
  • Loading branch information
beakona committed Jul 28, 2021
1 parent 45d899c commit fb4e57a
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 19 deletions.
6 changes: 6 additions & 0 deletions AutoInterface.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoInterfaceSample", "Auto
{FF7DF2CF-FA1C-4655-B451-B6FD1E374E3A} = {FF7DF2CF-FA1C-4655-B451-B6FD1E374E3A}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestInterfaces", "TestInterfaces\TestInterfaces.csproj", "{E271DF85-2B8E-48C4-8EB0-37FBF60A2E15}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -28,6 +30,10 @@ Global
{D80AD027-6463-4CBB-91B5-4952AE0204B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D80AD027-6463-4CBB-91B5-4952AE0204B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D80AD027-6463-4CBB-91B5-4952AE0204B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E271DF85-2B8E-48C4-8EB0-37FBF60A2E15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E271DF85-2B8E-48C4-8EB0-37FBF60A2E15}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E271DF85-2B8E-48C4-8EB0-37FBF60A2E15}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E271DF85-2B8E-48C4-8EB0-37FBF60A2E15}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
4 changes: 4 additions & 0 deletions AutoInterfaceSample/AutoInterfaceSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@
<Analyzer Include="..\BeaKona.AutoInterfaceGenerator\bin\Debug\netstandard2.0\BeaKona.AutoInterfaceGenerator.dll" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\TestInterfaces\TestInterfaces.csproj" />
</ItemGroup>

</Project>
22 changes: 3 additions & 19 deletions AutoInterfaceSample/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace AutoInterfaceSample
using TestInterfaces;

namespace AutoInterfaceSample
{
public class Program
{
Expand All @@ -10,24 +12,6 @@ public static void Main()
}
}

public interface ITestable
{
void PrintTest();
}

public interface IPrintable<T> : ITestable
{
int Length { get; }
int Count { get; }
void Print1();
void Print2();
}

public interface IPrintable2
{
void Print3();
}

public class PrinterV1 : IPrintable<int>, IPrintable2
{
public int Length => 100;
Expand Down
5 changes: 5 additions & 0 deletions BeaKona.AutoInterfaceGenerator/CSharpCodeTextWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,11 @@ private string GetSourceIdentifier(ISymbol symbol)
}
}

if (symbol.DeclaringSyntaxReferences.Length == 0)
{
return symbol.Name;
}

throw new NotSupportedException();
}
}
Expand Down
22 changes: 22 additions & 0 deletions TestInterfaces/Interfaces.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;

namespace TestInterfaces
{
public interface ITestable
{
void PrintTest();
}

public interface IPrintable<T> : ITestable
{
int Length { get; }
int Count { get; }
void Print1();
void Print2();
}

public interface IPrintable2
{
void Print3();
}
}
7 changes: 7 additions & 0 deletions TestInterfaces/TestInterfaces.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

</Project>

0 comments on commit fb4e57a

Please sign in to comment.