Fully qualify references to generated interfaces
This addresses an issue where, when a class references a generated interface, those references are not fully qualified, resulting in an interface that doesn't compile. See #87.
The change is to precalculate the list of interface names that will be generated, and, during symbol string generation, replace unrecognised symbols with generated names where a single unambiguous match can be made between the symbol and the list of interfaces being generated.
For the example provided in #87, the code will now generate this output:
//--------------------------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
// </auto-generated>
//--------------------------------------------------------------------------------------------------
namespace Test
{
[global::System.CodeDom.Compiler.GeneratedCode("AutomaticInterface", "")]
public partial interface ITest1
{
/// <inheritdoc cref="Test.Test1.Get(ITest2)" />
void Get(global::Test.Tests.ITest2 test);
}
}
//--------------------------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
// </auto-generated>
//--------------------------------------------------------------------------------------------------
namespace Test.Tests
{
[global::System.CodeDom.Compiler.GeneratedCode("AutomaticInterface", "")]
public partial interface ITest2
{
}
}
This is ready for review again - I just had a last minute refactoring idea :)
Could you be so kind and merge master into this? Than I will merge it as 6.x I think because it's potentially breaking
Not a problem @ChristianSauer. I hope to get this done next week.
Hi @ChristianSauer,
I've rebased the branch on master, but happy to get the other PR merged first, then I can rebase and refactor again, as I think I should probably move the other PR's changes into the RoslynExtensions class. Whatever suits you, of course :)
@simonmckenzie I merged the other PR first :)
Hi @ChristianSauer,
I've rebased again and refactored the changes from #85 into the RoslynExtensions (9148e56675769c355fba27c65c6afca83419745e).