Skip to content

[RGen] Add factory method needed to create a aux variable for a BindFrom(typeof(NSNumber)).#22111

Merged
mandel-macaque merged 3 commits into
mainfrom
dev/mandel/aux-variable-nsnumber-bindfrom
Feb 5, 2025
Merged

[RGen] Add factory method needed to create a aux variable for a BindFrom(typeof(NSNumber)).#22111
mandel-macaque merged 3 commits into
mainfrom
dev/mandel/aux-variable-nsnumber-bindfrom

Conversation

@mandel-macaque
Copy link
Copy Markdown
Contributor

@mandel-macaque mandel-macaque commented Feb 4, 2025

This change allows to be able to generate an aux variable that will be needed if a customer defined a export method in the following way:

[Export<Method> ()]
public virtual partial void MyMethod ([BindFrom (typeof (NSNumber))] double myDouble);

The above binding API indicates that the native method in objc will take a NSNumber but we want to expose our users a double. In order to send a NSNumber to objc, we need to declare an aux variable that will be used for the native method invocation.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 4, 2025

⚠️ Your code has been reformatted. ⚠️

If this is not desired, add the actions-disable-autoformat label, and revert the reformatting commit.

If files unrelated to your change were modified, try reverting the reformatting commit + merging with the target branch (and push those changes).

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [PR Build] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 70b7a1ccf05f513a249cc3c1807a6c90e8624973 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [PR Build] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: 70b7a1ccf05f513a249cc3c1807a6c90e8624973 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [PR Build] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 70b7a1ccf05f513a249cc3c1807a6c90e8624973 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

💻 [PR Build] Tests on macOS M1 - Mac Monterey (12) passed 💻

All tests on macOS M1 - Mac Monterey (12) passed.

Pipeline on Agent
Hash: 70b7a1ccf05f513a249cc3c1807a6c90e8624973 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

💻 [PR Build] Tests on macOS M1 - Mac Ventura (13) passed 💻

All tests on macOS M1 - Mac Ventura (13) passed.

Pipeline on Agent
Hash: 70b7a1ccf05f513a249cc3c1807a6c90e8624973 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

💻 [PR Build] Tests on macOS arm64 - Mac Sequoia (15) passed 💻

All tests on macOS arm64 - Mac Sequoia (15) passed.

Pipeline on Agent
Hash: 70b7a1ccf05f513a249cc3c1807a6c90e8624973 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

💻 [PR Build] Tests on macOS X64 - Mac Sonoma (14) passed 💻

All tests on macOS X64 - Mac Sonoma (14) passed.

Pipeline on Agent
Hash: 70b7a1ccf05f513a249cc3c1807a6c90e8624973 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

.NET ( No breaking changes )

❗ API diff vs stable (Breaking changes)

.NET ( ❗ Breaking changes ❗ )

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 70b7a1ccf05f513a249cc3c1807a6c90e8624973 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

💻 [CI Build] Windows Integration Tests passed 💻

All Windows Integration Tests passed.

Pipeline on Agent
Hash: 70b7a1ccf05f513a249cc3c1807a6c90e8624973 [PR build]

{
yield return [
new Parameter (0, ReturnTypeForInt (), "myParam"),
"var nsb_myParam = NSNumber.FromInt32 (myParam);"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you never ever feed the generated files in customers partial classes, right ? and you 100% control the typename and the namespace ? otherwise, it's safer to fullyqualify type names in sourcegen'd code

Copy link
Copy Markdown
Contributor Author

@mandel-macaque mandel-macaque Feb 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have a point. I'll do a second pass to do a fully qualified version of all the different types, I'll create a bug for it so that we use global:: etc

Better safe than sorry.

@mandel-macaque mandel-macaque merged commit 6770c15 into main Feb 5, 2025
@mandel-macaque mandel-macaque deleted the dev/mandel/aux-variable-nsnumber-bindfrom branch February 5, 2025 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants