ThatInheritFrom - fails on multiple types
Closed this issue · 6 comments
dszryan commented
i think the fix would be
file: src/Testura.Code/Builders/Base/TypeBuilderBase.cs
line: 183
syntaxNodeOrToken[n] = SyntaxFactory.SimpleBaseType(TypeGenerator.Create(_inheritance[n / 2]));
if (n + 1 < (_inheritance.Count * 2) - 1)
MilleBo commented
Oh thanks I will check it out and make a fix.
dszryan commented
LINQ approach - should give the same result
protected BaseListSyntax CreateBaseList() =>
_inheritance.Any()
? SyntaxFactory.BaseList(
SyntaxFactory.SeparatedList<BaseTypeSyntax>(
_inheritance.Select(i => SyntaxFactory.SimpleBaseType(TypeGenerator.Create(i))),
Enumerable.Range(0, _inheritance.Count - 1).Select(_ => SyntaxFactory.Token(SyntaxKind.CommaToken))))
: null!;
MilleBo commented
Cool I had totally missed the built in seperator list. Thanks! It should now be fixed in the 0.17.0 version,
dszryan commented
slight issue. there is an extra comma at the end
MilleBo commented
Oh damn, I did a unit test but used "contains" to assert the string and forgot to manually check so totally missed the extra comma. I will fix it later today.
MilleBo commented
This is now fixed and will come in next release.