Skip to content

Conversation

@stuartmorgan-g
Copy link
Collaborator

Updates the Objective-C generator to use BOOL, NSInteger, and double for non-nullable versions of those primitives, instead of boxing them with NSNumber*. This makes the code more idiomatic, brings them into alignment with enum behavior, and importantly helps minimize the chances of clients having issues with silent conversion of NSNumber* to BOOL in the long term (although it may cause some such issues in the short term when people update; the changelog contains a prominent warning about this).

As an incidental fix, this also fixes the use of strong for collections and strings, which is not best practice, since I was already changing related code.

Fixes flutter/flutter#116680
Fixes flutter/flutter#127401

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

Copy link
Contributor

@tarrinneal tarrinneal left a comment

Choose a reason for hiding this comment

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

Looks good, I like the changes you made to the typing class

/// Returns a version of the string form that can be used directly before
/// another string (e.g., a variable name) and handle spacing correctly for
/// a right-aligned pointer format.
String get beforeString => hasAsterisk ? toString() : '$this ';
Copy link
Contributor

Choose a reason for hiding this comment

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

is toString() just providing an empty string here? we have a ton of '' in the generators.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's calling the toString method that's just above this, giving '$basename *'; it just looks odd because usually toString() isn't being called on this.

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 30, 2023
@stuartmorgan-g
Copy link
Collaborator Author

Once this is published I'll update all of our plugins, so the updates aren't done as an incidental part of other changes when we are much less likely to notice implicit conversion bugs.

@auto-submit auto-submit bot merged commit 7319d3a into flutter:main Oct 30, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 30, 2023
@stuartmorgan-g stuartmorgan-g deleted the pigeon-objc-primitives branch October 30, 2023 16:56
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 31, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Oct 31, 2023
flutter/packages@2af6954...c9fec61

2023-10-31 [email protected] [image_picker] Prevent multiple active calls on iOS (flutter/packages#5272)
2023-10-30 [email protected] [in_app_purchase_android] Add missing response code to BillingResponse enum (flutter/packages#5120)
2023-10-30 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 2.22.4 to 2.22.5 (flutter/packages#5263)
2023-10-30 [email protected] Bump play-service-maps dependency from version 18.1.0 to 18.2.0 (flutter/packages#5243)
2023-10-30 [email protected] Roll Flutter from a4ec627 to e12d1a7 (3 revisions) (flutter/packages#5267)
2023-10-30 [email protected] [camerax] Loosen restrictions of fallback strategies for choosing resolutions (flutter/packages#5239)
2023-10-30 [email protected] [pigeon] Don't wrap non-nullable primitives in Obj-C (flutter/packages#5214)
2023-10-30 [email protected] [flutter_lints] Replace "flutter pub add --dev" with "dev:" (flutter/packages#5260)
2023-10-28 [email protected] Roll Flutter from 5907c97 to a4ec627 (18 revisions) (flutter/packages#5255)
2023-10-27 [email protected] [go_router] Fixes deep-link with no path on cold start (flutter/packages#5113)
2023-10-27 [email protected] [two_dimensional_scrollables] Fix pinned row painting when one axis is reversed (flutter/packages#5187)
2023-10-27 [email protected] Roll Flutter from c555599 to 5907c97 (45 revisions) (flutter/packages#5252)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
ksokolovskyi pushed a commit to ksokolovskyi/flutter that referenced this pull request Oct 31, 2023
flutter/packages@2af6954...c9fec61

2023-10-31 [email protected] [image_picker] Prevent multiple active calls on iOS (flutter/packages#5272)
2023-10-30 [email protected] [in_app_purchase_android] Add missing response code to BillingResponse enum (flutter/packages#5120)
2023-10-30 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 2.22.4 to 2.22.5 (flutter/packages#5263)
2023-10-30 [email protected] Bump play-service-maps dependency from version 18.1.0 to 18.2.0 (flutter/packages#5243)
2023-10-30 [email protected] Roll Flutter from a4ec627 to e12d1a7 (3 revisions) (flutter/packages#5267)
2023-10-30 [email protected] [camerax] Loosen restrictions of fallback strategies for choosing resolutions (flutter/packages#5239)
2023-10-30 [email protected] [pigeon] Don't wrap non-nullable primitives in Obj-C (flutter/packages#5214)
2023-10-30 [email protected] [flutter_lints] Replace "flutter pub add --dev" with "dev:" (flutter/packages#5260)
2023-10-28 [email protected] Roll Flutter from 5907c97 to a4ec627 (18 revisions) (flutter/packages#5255)
2023-10-27 [email protected] [go_router] Fixes deep-link with no path on cold start (flutter/packages#5113)
2023-10-27 [email protected] [two_dimensional_scrollables] Fix pinned row painting when one axis is reversed (flutter/packages#5187)
2023-10-27 [email protected] Roll Flutter from c555599 to 5907c97 (45 revisions) (flutter/packages#5252)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
@reidbaker reidbaker mentioned this pull request Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App p: pigeon platform-ios platform-macos

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[pigeon] Incorrect memory semantics for Obj-C collections [pigeon] Don't use NSNumber for non-nullable types

2 participants