-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
409 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,28 @@ | ||
using System; | ||
using System.Diagnostics.CodeAnalysis; | ||
using TestInterfacesNetStandard; | ||
|
||
namespace AutoInterfaceSample.Test | ||
{ | ||
public partial record TestRecord( | ||
[property: BeaKona.AutoInterface(IncludeBaseInterfaces = true)] NLog.ILogger nlog, | ||
[property: BeaKona.AutoInterface(IncludeBaseInterfaces = true)] Serilog.ILogger slog, | ||
[property: BeaKona.AutoInterface(IncludeBaseInterfaces = true)] Microsoft.Extensions.Logging.ILogger melog | ||
|
||
) : NLog.ILogger; | ||
|
||
public class Program | ||
{ | ||
public static void Main() | ||
{ | ||
//System.Diagnostics.Debug.WriteLine(BeaKona.Output.Debug_TestRecord.Info); | ||
|
||
ITestInterfaceObsolete r = new TestObsoleteRecord(null); | ||
r.TestObsoleteMethod(""); | ||
// ITestable p = new TestRecord(new SimpleLogger()); | ||
|
||
// p.Test(); | ||
|
||
//p.Log<int?>(LogLevel.Debug, default, 1, null, null); | ||
//var result = p.BindProperty<int>("test", 1, false, out var property, 1, 2, 3); | ||
} | ||
} | ||
|
||
partial record TestObsoleteRecord( | ||
[property: BeaKona.AutoInterface(IncludeBaseInterfaces = true)] | ||
ITestInterfaceObsolete Testable) : ITestInterfaceObsolete; | ||
interface ITestInterfaceObsolete | ||
partial record TestRecord | ||
{ | ||
[Obsolete] | ||
[DoesNotReturn] | ||
[return: MaybeNull] | ||
[return: NotNullIfNotNull(nameof(test))] | ||
[return: TestReturn] | ||
ResObject? TestObsoleteMethod(string? test); | ||
|
||
[Obsolete] | ||
[DisallowNull] | ||
ResObject? TestObsoleteProperty | ||
{ | ||
get; | ||
} | ||
|
||
[DisallowNull] | ||
ResObject? TestExpandedProperty | ||
{ | ||
[return: MaybeNull] | ||
get; | ||
} | ||
|
||
//[BeaKona.AutoInterface(IncludeBaseInterfaces = true)] | ||
public ITestable2? Testable { get; set; } | ||
} | ||
} | ||
|
||
class ResObject; | ||
namespace System.Diagnostics.CodeAnalysis | ||
{ | ||
|
||
[AttributeUsage(AttributeTargets.All)] | ||
class TestReturnAttribute : Attribute; | ||
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)] | ||
internal sealed class NotNullWhenAttribute(bool returnValue) : Attribute | ||
{ | ||
public bool ReturnValue { get; } = returnValue; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
AutoInterfaceSampleNetStandard/AutoInterfaceSampleNetStandard.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
<LangVersion>8.0</LangVersion> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Analyzer Include="..\BeaKona.AutoInterfaceGenerator\bin\Debug\netstandard2.0\BeaKona.AutoInterfaceGenerator.dll" /> | ||
<ProjectReference Include="..\BeaKona.AutoInterfaceAttributes\BeaKona.AutoInterfaceAttributes.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="true" /> | ||
<ProjectReference Include="..\TestInterfacesNetStandard\TestInterfacesNetStandard.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using TestInterfacesNetStandard; | ||
|
||
namespace AutoInterfaceSampleNetStandard | ||
{ | ||
partial class TestRecord | ||
{ | ||
[BeaKona.AutoInterface(IncludeBaseInterfaces = true)] | ||
public ITestable2? Testable { get; set; } | ||
} | ||
} | ||
|
||
namespace System.Diagnostics.CodeAnalysis | ||
{ | ||
|
||
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)] | ||
internal sealed class NotNullWhenAttribute : Attribute | ||
{ | ||
public NotNullWhenAttribute(bool returnValue) | ||
{ | ||
this.ReturnValue = returnValue; | ||
} | ||
|
||
public bool ReturnValue { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System.Collections; | ||
|
||
namespace BeaKona.AutoInterfaceGenerator; | ||
|
||
public sealed class AliasRegistry : IEnumerable<string> | ||
{ | ||
private readonly HashSet<string> aliases = []; | ||
|
||
public void Add(string alias) => this.aliases.Add(alias); | ||
|
||
IEnumerator IEnumerable.GetEnumerator() => this.GetEnumerator(); | ||
|
||
public IEnumerator<string> GetEnumerator() => this.aliases.GetEnumerator(); | ||
} |
27 changes: 27 additions & 0 deletions
27
BeaKona.AutoInterfaceGenerator/AutoInterfaceResource.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.