Generate structs for structs and fix struct out parameter if known (#8)

* Generate structs for structs and fix struct out parameter if known

* fmt
This commit is contained in:
Adam Hathcock
2024-06-17 17:04:52 +01:00
committed by GitHub
parent c6960c7370
commit a6b99abd13
28 changed files with 510 additions and 98 deletions
@@ -35,7 +35,11 @@ public class AkkaTests
AttributeToAddToInterface = new ExtraAttribute
{
Name = "Speckle.ProxyGenerator.Proxy",
ArgumentList = new [] {"typeof(Akka.Actor.LocalActorRefProvider)","ImplementationOptions.ProxyInterfaces"}
ArgumentList = new[]
{
"typeof(Akka.Actor.LocalActorRefProvider)",
"ImplementationOptions.ProxyInterfaces"
}
}
};
@@ -6,6 +6,7 @@ using ProxyInterfaceSourceGeneratorTests.Source.Disposable;
using Speckle.ProxyGenerator;
namespace ProxyInterfaceSourceGeneratorTests;
[Flags]
public enum ImplementationOptions
{
@@ -19,6 +20,7 @@ public enum ImplementationOptions
ProxyForBaseInterface = 8
}
public class InheritedInterfaceTests
{
private const string Namespace = "ProxyInterfaceSourceGeneratorTests.Source.Disposable";
@@ -36,7 +38,10 @@ public class InheritedInterfaceTests
[Theory]
[InlineData(ImplementationOptions.None, false)]
[InlineData(ImplementationOptions.ProxyBaseClasses | ImplementationOptions.ProxyInterfaces, true)]
[InlineData(
ImplementationOptions.ProxyBaseClasses | ImplementationOptions.ProxyInterfaces,
true
)]
public void GenerateFiles_InheritedInterface_InheritFromBaseClass(
ImplementationOptions options,
bool inheritBaseInterface
@@ -49,7 +54,7 @@ public class InheritedInterfaceTests
// Arrange
string[] fileNames = [$"{Namespace}.{interfaceName}.g.cs", $"{Namespace}.{proxyName}.g.cs"];
var path = $"./Source/Disposable/{interfaceName}.cs";
SourceFile sourceFile = CreateSourceFile(path, name,options);
SourceFile sourceFile = CreateSourceFile(path, name, options);
// Act
var result = _sut.Execute([sourceFile]);
@@ -82,7 +87,13 @@ public class InheritedInterfaceTests
string[] fileNames = [$"{Namespace}.{interfaceName}.g.cs", $"{Namespace}.{proxyName}.g.cs"];
var path = $"./Source/Disposable/{interfaceName}.cs";
SourceFile sourceFile = CreateSourceFile(path, name, ImplementationOptions.ProxyInterfaces | ImplementationOptions.ProxyBaseClasses | ImplementationOptions.UseExtendedInterfaces);
SourceFile sourceFile = CreateSourceFile(
path,
name,
ImplementationOptions.ProxyInterfaces
| ImplementationOptions.ProxyBaseClasses
| ImplementationOptions.UseExtendedInterfaces
);
// Act
var result = _sut.Execute([sourceFile]);
@@ -111,24 +122,39 @@ public class InheritedInterfaceTests
{
var className1 = "LocationPoint";
var interfaceName1 = "IRevitLocationPointProxy";
var proxyName1 = $"{className1}Proxy";
var proxyName1 = $"{className1}Proxy";
// Arrange
var path1 = $"./Source/Disposable/{interfaceName1}.cs";
var sourceFile1 = CreateSourceFile(path1, className1, ImplementationOptions.ProxyForBaseInterface | ImplementationOptions.UseExtendedInterfaces);
var sourceFile1 = CreateSourceFile(
path1,
className1,
ImplementationOptions.ProxyForBaseInterface
| ImplementationOptions.UseExtendedInterfaces
);
var className2 = "Location";
var interfaceName2 = "IRevitLocationProxy";
var proxyName2 = $"{className2}Proxy";
var proxyName2 = $"{className2}Proxy";
// Arrange
var path2 = $"./Source/Disposable/{interfaceName2}.cs";
var sourceFile2 = CreateSourceFile(path2, className2, ImplementationOptions.ProxyForBaseInterface | ImplementationOptions.UseExtendedInterfaces);
var sourceFile2 = CreateSourceFile(
path2,
className2,
ImplementationOptions.ProxyForBaseInterface
| ImplementationOptions.UseExtendedInterfaces
);
// Act
var result = _sut.Execute([sourceFile1, sourceFile2]);
string[] fileNames = [$"{Namespace}.{interfaceName1}.g.cs", $"{Namespace}.{proxyName1}.g.cs",
$"{Namespace}.{interfaceName2}.g.cs", $"{Namespace}.{proxyName2}.g.cs"];
string[] fileNames =
[
$"{Namespace}.{interfaceName1}.g.cs",
$"{Namespace}.{proxyName1}.g.cs",
$"{Namespace}.{interfaceName2}.g.cs",
$"{Namespace}.{proxyName2}.g.cs"
];
result.Valid.Should().BeTrue();
result.Files.Should().HaveCount(fileNames.Length + 1);
@@ -139,6 +165,7 @@ public class InheritedInterfaceTests
File.WriteAllText($"{OutputPath}{fileName.fileName}", builder.Text);
}
}
[Fact]
public void GenerateFiles_InheritedInterface_Should_Not_InheritExplicitImplementedInterfaces()
{
@@ -149,7 +176,11 @@ public class InheritedInterfaceTests
// Arrange
string[] fileNames = [$"{Namespace}.{interfaceName}.g.cs", $"{Namespace}.{proxyName}.g.cs"];
var path = $"./Source/Disposable/{interfaceName}.cs";
SourceFile sourceFile = CreateSourceFile(path, name, ImplementationOptions.UseExtendedInterfaces);
SourceFile sourceFile = CreateSourceFile(
path,
name,
ImplementationOptions.UseExtendedInterfaces
);
// Act
var result = _sut.Execute([sourceFile]);
@@ -173,7 +204,11 @@ public class InheritedInterfaceTests
Assert.True(noInterfaceImplementationFound);
}
private static SourceFile CreateSourceFile(string path, string name, ImplementationOptions options)
private static SourceFile CreateSourceFile(
string path,
string name,
ImplementationOptions options
)
{
var o = string.Empty;
foreach (var val in Enum.GetValues<ImplementationOptions>())
@@ -191,7 +226,7 @@ public class InheritedInterfaceTests
}
if (o.Length == 0)
{
o = "ImplementationOptions.None";
o = "ImplementationOptions.None";
}
return new SourceFile
{
@@ -216,4 +251,3 @@ public class InheritedInterfaceTests
}
}
}
@@ -45,7 +45,11 @@ public class PnPTests
AttributeToAddToInterface = new ExtraAttribute
{
Name = "Speckle.ProxyGenerator.Proxy",
ArgumentList = new [] { "typeof(Microsoft.SharePoint.Client.ClientObject)", "ImplementationOptions.UseExtendedInterfaces"}
ArgumentList = new[]
{
"typeof(Microsoft.SharePoint.Client.ClientObject)",
"ImplementationOptions.UseExtendedInterfaces"
}
}
};
@@ -57,7 +61,11 @@ public class PnPTests
AttributeToAddToInterface = new ExtraAttribute
{
Name = "Speckle.ProxyGenerator.Proxy",
ArgumentList =new [] { "typeof(SecurableObject)" , "ImplementationOptions.UseExtendedInterfaces"}// Only name, no namespace
ArgumentList = new[]
{
"typeof(SecurableObject)",
"ImplementationOptions.UseExtendedInterfaces"
} // Only name, no namespace
}
};
@@ -69,7 +77,11 @@ public class PnPTests
AttributeToAddToInterface = new ExtraAttribute
{
Name = "Speckle.ProxyGenerator.Proxy",
ArgumentList = new [] { "typeof(Web)", "ImplementationOptions.UseExtendedInterfaces"} // Only name, no namespace
ArgumentList = new[]
{
"typeof(Web)",
"ImplementationOptions.UseExtendedInterfaces"
} // Only name, no namespace
}
};
@@ -81,7 +93,11 @@ public class PnPTests
AttributeToAddToInterface = new ExtraAttribute
{
Name = "Speckle.ProxyGenerator.Proxy",
ArgumentList = new [] { "typeof(Microsoft.SharePoint.Client.ClientRuntimeContext)", "ImplementationOptions.UseExtendedInterfaces"}
ArgumentList = new[]
{
"typeof(Microsoft.SharePoint.Client.ClientRuntimeContext)",
"ImplementationOptions.UseExtendedInterfaces"
}
}
};
@@ -93,7 +109,11 @@ public class PnPTests
AttributeToAddToInterface = new ExtraAttribute
{
Name = "Speckle.ProxyGenerator.Proxy",
ArgumentList =new [] { "typeof(Microsoft.SharePoint.Client.ClientContext)", "ImplementationOptions.UseExtendedInterfaces"} // Only name, no namespace
ArgumentList = new[]
{
"typeof(Microsoft.SharePoint.Client.ClientContext)",
"ImplementationOptions.UseExtendedInterfaces"
} // Only name, no namespace
}
};
@@ -166,7 +166,6 @@ namespace Speckle.ProxyGenerator
}
private static void Add<T, TInterface, TProxy>(Func<T, TProxy> f)
where T : class
where TInterface : notnull
where TProxy : TInterface
{
@@ -174,7 +174,6 @@ namespace Speckle.ProxyGenerator
}
private static void Add<T, TInterface, TProxy>(Func<T, TProxy> f)
where T : class
where TInterface : notnull
where TProxy : TInterface
{
@@ -176,7 +176,6 @@ namespace Speckle.ProxyGenerator
}
private static void Add<T, TInterface, TProxy>(Func<T, TProxy> f)
where T : class
where TInterface : notnull
where TProxy : TInterface
{
@@ -227,7 +227,6 @@ Add<ProxyInterfaceSourceGeneratorTests.Source.Bar3, global::ProxyInterfaceSource
}
private static void Add<T, TInterface, TProxy>(Func<T, TProxy> f)
where T : class
where TInterface : notnull
where TProxy : TInterface
{
@@ -0,0 +1,286 @@
[
{
HintName: ProxyInterfaceSourceGeneratorTests.Source.IMyStruct.g.cs,
Source:
//----------------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by https://github.com/specklesystems/ProxyGenerator.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//----------------------------------------------------------------------------------------
#nullable enable
using System;
namespace ProxyInterfaceSourceGeneratorTests.Source
{
public partial interface IMyStruct
{
global::ProxyInterfaceSourceGeneratorTests.Source.MyStruct _Instance { get; }
int Id { get; set; }
bool TryGetMyStruct2(int i, out global::ProxyInterfaceSourceGeneratorTests.Source.MyStruct2 x, double z);
}
}
#nullable restore
},
{
HintName: ProxyInterfaceSourceGeneratorTests.Source.IMyStruct2.g.cs,
Source:
//----------------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by https://github.com/specklesystems/ProxyGenerator.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//----------------------------------------------------------------------------------------
#nullable enable
using System;
namespace ProxyInterfaceSourceGeneratorTests.Source
{
public partial interface IMyStruct2
{
global::ProxyInterfaceSourceGeneratorTests.Source.MyStruct2 _Instance { get; }
int Id { get; set; }
}
}
#nullable restore
},
{
HintName: ProxyInterfaceSourceGeneratorTests.Source.MyStructProxy.g.cs,
Source:
//----------------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by https://github.com/specklesystems/ProxyGenerator.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//----------------------------------------------------------------------------------------
#nullable enable
using System;
namespace ProxyInterfaceSourceGeneratorTests.Source
{
public partial struct MyStructProxy : global::ProxyInterfaceSourceGeneratorTests.Source.IMyStruct
{
public global::ProxyInterfaceSourceGeneratorTests.Source.MyStruct _Instance { get; }
public int Id { get => _Instance.Id; }
public bool TryGetMyStruct2(int i, out global::ProxyInterfaceSourceGeneratorTests.Source.IMyStruct2 x, double z)
{
int i_ = i;
global::ProxyInterfaceSourceGeneratorTests.Source.MyStruct2 x_;
double z_ = z;
var result_222455096 = _Instance.TryGetMyStruct2(i_, out x_, z_);
x = Mapster.TypeAdapter.Adapt<global::ProxyInterfaceSourceGeneratorTests.Source.IMyStruct2>(x_);
return result_222455096;
}
public MyStructProxy(global::ProxyInterfaceSourceGeneratorTests.Source.MyStruct instance)
{
_Instance = instance;
}
static MyStructProxy()
{
Mapster.TypeAdapterConfig<global::ProxyInterfaceSourceGeneratorTests.Source.MyStruct2, global::ProxyInterfaceSourceGeneratorTests.Source.IMyStruct2>.NewConfig().ConstructUsing(instance_1687574103 => new global::ProxyInterfaceSourceGeneratorTests.Source.MyStruct2Proxy(instance_1687574103));
Mapster.TypeAdapterConfig<global::ProxyInterfaceSourceGeneratorTests.Source.IMyStruct2, global::ProxyInterfaceSourceGeneratorTests.Source.MyStruct2>.NewConfig().MapWith(proxy_1070335295 => ((global::ProxyInterfaceSourceGeneratorTests.Source.MyStruct2Proxy) proxy_1070335295)._Instance);
}
}
}
#nullable restore
},
{
HintName: ProxyInterfaceSourceGeneratorTests.Source.MyStruct2Proxy.g.cs,
Source:
//----------------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by https://github.com/specklesystems/ProxyGenerator.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//----------------------------------------------------------------------------------------
#nullable enable
using System;
namespace ProxyInterfaceSourceGeneratorTests.Source
{
public partial struct MyStruct2Proxy : global::ProxyInterfaceSourceGeneratorTests.Source.IMyStruct2
{
public global::ProxyInterfaceSourceGeneratorTests.Source.MyStruct2 _Instance { get; }
public int Id { get => _Instance.Id; }
public MyStruct2Proxy(global::ProxyInterfaceSourceGeneratorTests.Source.MyStruct2 instance)
{
_Instance = instance;
}
static MyStruct2Proxy()
{
Mapster.TypeAdapterConfig<global::ProxyInterfaceSourceGeneratorTests.Source.MyStruct2, global::ProxyInterfaceSourceGeneratorTests.Source.IMyStruct2>.NewConfig().ConstructUsing(instance_1687574103 => new global::ProxyInterfaceSourceGeneratorTests.Source.MyStruct2Proxy(instance_1687574103));
Mapster.TypeAdapterConfig<global::ProxyInterfaceSourceGeneratorTests.Source.IMyStruct2, global::ProxyInterfaceSourceGeneratorTests.Source.MyStruct2>.NewConfig().MapWith(proxy_1070335295 => ((global::ProxyInterfaceSourceGeneratorTests.Source.MyStruct2Proxy) proxy_1070335295)._Instance);
}
}
}
#nullable restore
},
{
HintName: Speckle.ProxyGenerator.Extra.g.cs,
Source:
//----------------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by https://github.com/specklesystems/ProxyGenerator
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//----------------------------------------------------------------------------------------
#nullable enable
using System;
namespace Speckle.ProxyGenerator
{
[AttributeUsage(AttributeTargets.Interface)]
internal sealed class ProxyAttribute : Attribute
{
public Type Type { get; }
public ImplementationOptions Options { get; }
public ProxyClassAccessibility Accessibility { get; }
public string[]? MembersToIgnore { get; }
public ProxyAttribute(Type type) : this(type, ImplementationOptions.None, ProxyClassAccessibility.Public)
{
}
public ProxyAttribute(Type type, ImplementationOptions options) : this(type, options, ProxyClassAccessibility.Public)
{
}
public ProxyAttribute(Type type, ProxyClassAccessibility accessibility) : this(type, ImplementationOptions.None, accessibility)
{
}
public ProxyAttribute(Type type, ImplementationOptions options, ProxyClassAccessibility accessibility) : this(type, options, accessibility, null)
{
}
public ProxyAttribute(Type type, string[]? membersToIgnore) : this(type, ImplementationOptions.None, ProxyClassAccessibility.Public, null)
{
}
public ProxyAttribute(Type type, ImplementationOptions options, string[]? membersToIgnore) : this(type, options, ProxyClassAccessibility.Public, null)
{
}
public ProxyAttribute(Type type, ImplementationOptions options, ProxyClassAccessibility accessibility, string[]? membersToIgnore)
{
Type = type;
Options = options;
Accessibility = accessibility;
MembersToIgnore = membersToIgnore;
}
}
[Flags]
internal enum ProxyClassAccessibility
{
Public = 0,
Internal = 1
}
[Flags]
internal enum ImplementationOptions
{
None = 0,
ProxyBaseClasses = 1,
ProxyInterfaces = 2,
UseExtendedInterfaces = 4,
ProxyForBaseInterface = 8
}
public static class ProxyMap
{
private static readonly global::System.Collections.Concurrent.ConcurrentDictionary<Type, Type> s_revitToInterfaceMap = new();
private static readonly global::System.Collections.Concurrent.ConcurrentDictionary<Type, Type> s_proxyToInterfaceMap = new();
private static readonly global::System.Collections.Concurrent.ConcurrentDictionary<Type, Type> s_interfaceToRevit = new();
private static readonly global::System.Collections.Concurrent.ConcurrentDictionary<Type, Func<object, object>> s_proxyFactory = new();
static ProxyMap()
{
Add<ProxyInterfaceSourceGeneratorTests.Source.MyStruct, global::ProxyInterfaceSourceGeneratorTests.Source.IMyStruct, ProxyInterfaceSourceGeneratorTests.Source.MyStructProxy>(x => new ProxyInterfaceSourceGeneratorTests.Source.MyStructProxy(x));
Add<ProxyInterfaceSourceGeneratorTests.Source.MyStruct2, global::ProxyInterfaceSourceGeneratorTests.Source.IMyStruct2, ProxyInterfaceSourceGeneratorTests.Source.MyStruct2Proxy>(x => new ProxyInterfaceSourceGeneratorTests.Source.MyStruct2Proxy(x));
}
private static void Add<T, TInterface, TProxy>(Func<T, TProxy> f)
where TInterface : notnull
where TProxy : TInterface
{
s_revitToInterfaceMap.TryAdd(typeof(T), typeof(TInterface));
s_proxyToInterfaceMap.TryAdd(typeof(TProxy), typeof(TInterface));
s_proxyFactory.TryAdd(typeof(TInterface), w => f((T)w));
s_interfaceToRevit.TryAdd(typeof(TInterface), typeof(T));
}
public static Type? GetMappedTypeFromHostType(Type type)
{
if (s_revitToInterfaceMap.TryGetValue(type, out var t))
{
return t;
}
return null;
}
public static Type? GetMappedTypeFromProxyType(Type type)
{
if (s_proxyToInterfaceMap.TryGetValue(type, out var t))
{
return t;
}
return null;
}
public static Type? GetHostTypeFromMappedType(Type type)
{
if (s_interfaceToRevit.TryGetValue(type, out var t))
{
return t;
}
return null;
}
public static object CreateProxy(Type type, object toWrap) => s_proxyFactory[type](toWrap);
public static T CreateProxy<T>(object toWrap) => (T)CreateProxy(typeof(T), toWrap);
}
#nullable restore
}
}
]
@@ -26,9 +26,17 @@ public class ProxyInterfaceSourceGeneratorTest
}
[Fact]
public void GenerateFiles_ForStruct_Should_Not_GenerateProxyCode()
public Task GenerateFiles_ForStruct_Should_GenerateProxyCode()
{
// Arrange
var fileNames = new[]
{
"ProxyInterfaceSourceGeneratorTests.Source.IMyStruct.g.cs",
"ProxyInterfaceSourceGeneratorTests.Source.MyStructProxy.g.cs",
"ProxyInterfaceSourceGeneratorTests.Source.IMyStruct2.g.cs",
"ProxyInterfaceSourceGeneratorTests.Source.MyStruct2Proxy.g.cs"
};
var path = "./Source/IMyStruct.cs";
var sourceFile = new SourceFile
{
@@ -41,12 +49,28 @@ public class ProxyInterfaceSourceGeneratorTest
}
};
var path2 = "./Source/IMyStruct2.cs";
var sourceFile2 = new SourceFile
{
Path = path2,
Text = File.ReadAllText(path2),
AttributeToAddToInterface = new ExtraAttribute
{
Name = "Speckle.ProxyGenerator.Proxy",
ArgumentList = "typeof(ProxyInterfaceSourceGeneratorTests.Source.MyStruct2)"
}
};
// Act
var result = _sut.Execute(new[] { sourceFile });
var result = _sut.Execute(new[] { sourceFile, sourceFile2 });
// Assert
result.Valid.Should().BeTrue();
result.Files.Should().HaveCount(1);
result.Files.Should().HaveCount(fileNames.Length + 1);
// Verify
var results = result.GeneratorDriver.GetRunResult().Results.First().GeneratedSources;
return Verify(results);
}
[Fact]
@@ -123,7 +147,6 @@ public class ProxyInterfaceSourceGeneratorTest
return Verify(results);
}
[Fact]
public Task GenerateFiles_ForClassWith_BaseInterface()
{
@@ -145,7 +168,8 @@ public class ProxyInterfaceSourceGeneratorTest
ArgumentList = new[]
{
"typeof(ProxyInterfaceSourceGeneratorTests.Source.Foo2)",
"ImplementationOptions.UseExtendedInterfaces", "ProxyClassAccessibility.Public"
"ImplementationOptions.UseExtendedInterfaces",
"ProxyClassAccessibility.Public"
}
}
};
@@ -328,7 +352,7 @@ public class ProxyInterfaceSourceGeneratorTest
foreach (var fileName in fileNames.Select((fileName, index) => new { fileName, index }))
{
var builder = result.Files[fileName.index ]; // attribute is last
var builder = result.Files[fileName.index]; // attribute is last
builder.Path.Should().EndWith(fileName.fileName);
if (Write)
@@ -72,6 +72,9 @@
<Compile Update="Source\Disposable\IRevitLocationPointProxy.cs">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Compile>
<Compile Update="Source\IMyStruct2.cs">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Compile>
</ItemGroup>
<ItemGroup>
@@ -1,10 +1,6 @@
namespace ProxyInterfaceSourceGeneratorTests.Source.Disposable;
public interface IRevitLocationPoint : IRevitLocation
{
}
public interface IRevitLocationPoint : IRevitLocation { }
public interface IRevitLocationCurve : IRevitLocation
{
@@ -15,12 +11,15 @@ public class LocationPoint : Location
{
public XYZ Point => throw new NotImplementedException();
}
public class Location : APIObject { }
public class APIObject { }
public class XYZ { }
public interface IRevitLocation
{
}
public interface IRevitLocation { }
public interface IRevitCurve
{
double Length { get; }
@@ -10,6 +10,4 @@ public class Foo3
}
}
public class Bar3
{
}
public class Bar3 { }
@@ -1,5 +1,3 @@
namespace ProxyInterfaceSourceGeneratorTests.Source;
public partial interface IBar3
{
}
public partial interface IBar3 { }
@@ -1,7 +1,3 @@
namespace ProxyInterfaceSourceGeneratorTests.Source;
public partial interface IBar3Proxy : IBar3
{
}
public partial interface IBar3Proxy : IBar3 { }
@@ -1,6 +1,7 @@
namespace ProxyInterfaceSourceGeneratorTests.Source
{
public partial interface IFoo2: IFoo2Base { }
public partial interface IFoo2 : IFoo2Base { }
public partial interface IFoo2Base
{
int Weird2();
@@ -4,5 +4,4 @@ namespace ProxyInterfaceSourceGeneratorTests.Source
{
IBar3 Weird();
}
}
@@ -1,3 +1,3 @@
namespace ProxyInterfaceSourceGeneratorTests.Source;
public partial interface IFoo3Proxy: IFoo3 { }
public partial interface IFoo3Proxy : IFoo3 { }
@@ -0,0 +1,4 @@
namespace ProxyInterfaceSourceGeneratorTests.Source
{
public partial interface IMyStruct2 { }
}
@@ -1,6 +1,17 @@
namespace ProxyInterfaceSourceGeneratorTests.Source;
public struct MyStruct
{
public int Id { get; set; }
public bool TryGetMyStruct2(int i, out MyStruct2 x, double z)
{
x = default;
return true;
}
}
public struct MyStruct2
{
public int Id { get; set; }
}