diff --git a/Chickensoft.Introspection.Generator.Tests/.generated/Chickensoft.Introspection.Generator/Chickensoft.Introspection.Generator.TypeGenerator/TypeRegistry.g.cs b/Chickensoft.Introspection.Generator.Tests/.generated/Chickensoft.Introspection.Generator/Chickensoft.Introspection.Generator.TypeGenerator/TypeRegistry.g.cs index e4e5246..297b6ff 100644 --- a/Chickensoft.Introspection.Generator.Tests/.generated/Chickensoft.Introspection.Generator/Chickensoft.Introspection.Generator.TypeGenerator/TypeRegistry.g.cs +++ b/Chickensoft.Introspection.Generator.Tests/.generated/Chickensoft.Introspection.Generator/Chickensoft.Introspection.Generator.TypeGenerator/TypeRegistry.g.cs @@ -43,6 +43,7 @@ public partial class TypeRegistry : Chickensoft.Introspection.ITypeRegistry { [typeof(Chickensoft.Introspection.Generator.Tests.TestCases.ConcreteChildOne)] = new Chickensoft.Introspection.IdentifiableTypeMetadata("ConcreteChildOne", static (r) => r.Receive(), static () => System.Activator.CreateInstance(), new Chickensoft.Introspection.Generator.Tests.TestCases.ConcreteChildOne.MetatypeMetadata(), "concrete_child_one", 1), [typeof(Chickensoft.Introspection.Generator.Tests.TestCases.ConcreteChildTwo)] = new Chickensoft.Introspection.IdentifiableTypeMetadata("ConcreteChildTwo", static (r) => r.Receive(), static () => System.Activator.CreateInstance(), new Chickensoft.Introspection.Generator.Tests.TestCases.ConcreteChildTwo.MetatypeMetadata(), "concrete_child_two", 1), [typeof(Chickensoft.Introspection.Generator.Tests.TestCases.DerivedModel)] = new Chickensoft.Introspection.IntrospectiveTypeMetadata("DerivedModel", static (r) => r.Receive(), static () => System.Activator.CreateInstance(), new Chickensoft.Introspection.Generator.Tests.TestCases.DerivedModel.MetatypeMetadata(), 1), + [typeof(Chickensoft.Introspection.Generator.Tests.TestCases.ExampleStruct)] = new Chickensoft.Introspection.ConcreteTypeMetadata("ExampleStruct", static (r) => r.Receive(), static () => System.Activator.CreateInstance()), [typeof(Chickensoft.Introspection.Generator.Tests.TestCases.GenericStruct<>)] = new Chickensoft.Introspection.TypeMetadata("GenericStruct"), [typeof(Chickensoft.Introspection.Generator.Tests.TestCases.InitArgsModel)] = new Chickensoft.Introspection.IdentifiableTypeMetadata("InitArgsModel", static (r) => r.Receive(), static () => System.Activator.CreateInstance(), new Chickensoft.Introspection.Generator.Tests.TestCases.InitArgsModel.MetatypeMetadata(), "init_args_model", 1), [typeof(Chickensoft.Introspection.Generator.Tests.TestCases.JunkAttribute)] = new Chickensoft.Introspection.ConcreteTypeMetadata("JunkAttribute", static (r) => r.Receive(), static () => System.Activator.CreateInstance()), diff --git a/Chickensoft.Introspection.Generator.Tests/Chickensoft.Introspection.Generator.Tests.csproj b/Chickensoft.Introspection.Generator.Tests/Chickensoft.Introspection.Generator.Tests.csproj index 4c1923f..dd4ac1c 100644 --- a/Chickensoft.Introspection.Generator.Tests/Chickensoft.Introspection.Generator.Tests.csproj +++ b/Chickensoft.Introspection.Generator.Tests/Chickensoft.Introspection.Generator.Tests.csproj @@ -15,10 +15,12 @@ true + + CA1010;NU1903 - + diff --git a/Chickensoft.Introspection.Generator.Tests/test_cases/GlobalUsing.cs b/Chickensoft.Introspection.Generator.Tests/test_cases/GlobalUsing.cs new file mode 100644 index 0000000..eeecb09 --- /dev/null +++ b/Chickensoft.Introspection.Generator.Tests/test_cases/GlobalUsing.cs @@ -0,0 +1,5 @@ +#pragma warning disable IDE0005 // Using directive is unnecessary. +global using MyExampleStruct = + Chickensoft.Introspection.Generator.Tests.TestCases.ExampleStruct; +global using MyExampleType = int; +#pragma warning restore IDE0005 // Using directive is unnecessary. diff --git a/Chickensoft.Introspection.Generator.Tests/test_cases/GlobalUsingValueType.cs b/Chickensoft.Introspection.Generator.Tests/test_cases/GlobalUsingValueType.cs new file mode 100644 index 0000000..8290659 --- /dev/null +++ b/Chickensoft.Introspection.Generator.Tests/test_cases/GlobalUsingValueType.cs @@ -0,0 +1,3 @@ +namespace Chickensoft.Introspection.Generator.Tests.TestCases; + +public readonly record struct ExampleStruct; diff --git a/Chickensoft.Introspection.Generator/Chickensoft.Introspection.Generator.csproj b/Chickensoft.Introspection.Generator/Chickensoft.Introspection.Generator.csproj index f0c214d..b0df518 100644 --- a/Chickensoft.Introspection.Generator/Chickensoft.Introspection.Generator.csproj +++ b/Chickensoft.Introspection.Generator/Chickensoft.Introspection.Generator.csproj @@ -43,7 +43,7 @@ - + diff --git a/Chickensoft.Introspection.Generator/src/TypeGenerator.cs b/Chickensoft.Introspection.Generator/src/TypeGenerator.cs index 3425a55..b39361f 100644 --- a/Chickensoft.Introspection.Generator/src/TypeGenerator.cs +++ b/Chickensoft.Introspection.Generator/src/TypeGenerator.cs @@ -494,7 +494,8 @@ TypeDeclarationSyntax type public static UsingDirective GetUsing(UsingDirectiveSyntax @using) => new( Alias: @using.Alias?.Name.NormalizeWhitespace().ToString(), - Name: @using.Name.NormalizeWhitespace().ToString(), + Name: @using.Name?.NormalizeWhitespace().ToString() + ?? @using.NamespaceOrType.NormalizeWhitespace().ToString(), IsGlobal: @using.GlobalKeyword is { ValueText: "global" }, IsStatic: @using.StaticKeyword is { ValueText: "static" }, IsAlias: @using.Alias != default diff --git a/Chickensoft.Introspection.Tests/Chickensoft.Introspection.Tests.csproj b/Chickensoft.Introspection.Tests/Chickensoft.Introspection.Tests.csproj index 047c3f3..203e53d 100644 --- a/Chickensoft.Introspection.Tests/Chickensoft.Introspection.Tests.csproj +++ b/Chickensoft.Introspection.Tests/Chickensoft.Introspection.Tests.csproj @@ -16,6 +16,8 @@ true + + NU1903 diff --git a/global.json b/global.json index 85721c3..2c56923 100644 --- a/global.json +++ b/global.json @@ -1,9 +1,9 @@ { "sdk": { - "version": "7.0.404", + "version": "9.0.100", "rollForward": "latestMinor" }, "msbuild-sdks": { "Godot.NET.Sdk": "4.2.2" } -} +} \ No newline at end of file