Skip to content

Commit 0bfe739

Browse files
Fix the case in which we need a using rename in the bindings. This happends with nfloat.
1 parent 55e372f commit 0bfe739

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

src/rgen/Microsoft.Macios.Generator/Extensions/SyntaxTreeExtensions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public static IReadOnlySet<string> CollectUsingStatements (this SyntaxTree self)
1616
var usingDirectives = self.GetRoot ()
1717
.DescendantNodes ()
1818
.OfType<UsingDirectiveSyntax> ()
19+
.Where (d => d.Alias is null)
1920
.Select (d => d.Name!.ToString ()).ToArray ();
2021

2122
// remove any possible duplicates by using a set

tests/rgen/Microsoft.Macios.Generator.Tests/Classes/Data/PropertyTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Foundation;
99
using ObjCBindings;
1010
using ObjCRuntime;
11+
using nfloat = System.Runtime.InteropServices.NFloat;
1112

1213
namespace TestNamespace;
1314

tests/rgen/Microsoft.Macios.Generator.Tests/Classes/Data/iOSExpectedPropertyTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,15 +439,15 @@ public virtual partial bool IsLenient
439439
[SupportedOSPlatform ("tvos")]
440440
[SupportedOSPlatform ("maccatalyst13.1")]
441441
[BindingImpl (BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
442-
public virtual partial global::CompareGeneratedCode.CompareGeneratedCode.netmodule..nfloat LineSpacing
442+
public virtual partial global::System.Runtime.InteropServices.NFloat LineSpacing
443443
{
444444
[SupportedOSPlatform ("macos")]
445445
[SupportedOSPlatform ("ios")]
446446
[SupportedOSPlatform ("tvos")]
447447
[SupportedOSPlatform ("maccatalyst13.1")]
448448
get
449449
{
450-
global::CompareGeneratedCode.CompareGeneratedCode.netmodule..nfloat ret;
450+
global::System.Runtime.InteropServices.NFloat ret;
451451
if (IsDirectBinding) {
452452
ret = global::ObjCRuntime.Messaging.nfloat_objc_msgSend (this.Handle, global::ObjCRuntime.Selector.GetHandle ("lineSpacing"));
453453
} else {

tests/rgen/Microsoft.Macios.Generator.Tests/Classes/Data/macOSExpectedPropertyTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,15 +439,15 @@ public virtual partial bool IsLenient
439439
[SupportedOSPlatform ("tvos")]
440440
[SupportedOSPlatform ("maccatalyst13.1")]
441441
[BindingImpl (BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
442-
public virtual partial global::CompareGeneratedCode.CompareGeneratedCode.netmodule..nfloat LineSpacing
442+
public virtual partial global::System.Runtime.InteropServices.NFloat LineSpacing
443443
{
444444
[SupportedOSPlatform ("macos")]
445445
[SupportedOSPlatform ("ios")]
446446
[SupportedOSPlatform ("tvos")]
447447
[SupportedOSPlatform ("maccatalyst13.1")]
448448
get
449449
{
450-
global::CompareGeneratedCode.CompareGeneratedCode.netmodule..nfloat ret;
450+
global::System.Runtime.InteropServices.NFloat ret;
451451
if (IsDirectBinding) {
452452
ret = global::ObjCRuntime.Messaging.nfloat_objc_msgSend (this.Handle, global::ObjCRuntime.Selector.GetHandle ("lineSpacing"));
453453
} else {

tests/rgen/Microsoft.Macios.Generator.Tests/Classes/Data/tvOSExpectedPropertyTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,15 +439,15 @@ public virtual partial bool IsLenient
439439
[SupportedOSPlatform ("tvos")]
440440
[SupportedOSPlatform ("maccatalyst13.1")]
441441
[BindingImpl (BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
442-
public virtual partial global::CompareGeneratedCode.CompareGeneratedCode.netmodule..nfloat LineSpacing
442+
public virtual partial global::System.Runtime.InteropServices.NFloat LineSpacing
443443
{
444444
[SupportedOSPlatform ("macos")]
445445
[SupportedOSPlatform ("ios")]
446446
[SupportedOSPlatform ("tvos")]
447447
[SupportedOSPlatform ("maccatalyst13.1")]
448448
get
449449
{
450-
global::CompareGeneratedCode.CompareGeneratedCode.netmodule..nfloat ret;
450+
global::System.Runtime.InteropServices.NFloat ret;
451451
if (IsDirectBinding) {
452452
ret = global::ObjCRuntime.Messaging.nfloat_objc_msgSend (this.Handle, global::ObjCRuntime.Selector.GetHandle ("lineSpacing"));
453453
} else {

0 commit comments

Comments
 (0)