Skip to content

Conversation

bparrishMines
Copy link
Contributor

@bparrishMines bparrishMines commented Mar 5, 2024

In some areas of the Objc generator, the the name created from _objcTypeForDartType is being passed to _enumName and both of these methods add a prefix to enums. The locations are when they are used in HostApi or FlutterApi methods, but the name of the generated enum would be correct. e.g. FLTEnumName vs FLTFLTEnumName.

This fixes the locations where this is happening by passing the AST name to _enumName instead.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@bparrishMines bparrishMines marked this pull request as ready for review March 5, 2024 18:45
@bparrishMines bparrishMines changed the title [pigeon] Fixes double prefixes added to enum names for Objc [pigeon] Fixes double prefixes added to enum names for Objc HostApis and FlutterApis Mar 5, 2024
@tarrinneal
Copy link
Contributor

What scenario is missing from our integration tests that would have triggered this?

@bparrishMines
Copy link
Contributor Author

@tarrinneal It looks like the scenario is a combination of:

  1. Using a primitive enum as a method parameter or return value
  2. Generates Objective-c code with a prefix

It looks like CoreTests.gen.h doesn't use a prefix. Although scenario 1 does occur for it.

Would it be a good idea to update core tests with a prefix?

@tarrinneal
Copy link
Contributor

Would it be a good idea to update core tests with a prefix?

yup

@bparrishMines
Copy link
Contributor Author

@tarrinneal Adding the prefix to core tests also found a location where the prefix wasn't added to the enum. I think a better solution might be to actually get rid of the _enumName method altogether and just use _ObjcType instead. It seems redundant to _ObjcType and it seems to be error prone to have both. I will try and explore this option. What are your thoughts?

@bparrishMines
Copy link
Contributor Author

Actually it looks like the problem is bigger than enums. Objective-c prefixes may need a bigger fix.

@tarrinneal
Copy link
Contributor

I can take this over if you'd like.

@tarrinneal
Copy link
Contributor

@stuartmorgan this is ready for final review

Copy link
Collaborator

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

LGTM

@bparrishMines bparrishMines added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 14, 2024
@auto-submit auto-submit bot merged commit 0895119 into flutter:main Mar 14, 2024
@bparrishMines bparrishMines deleted the objc_enum_names branch March 14, 2024 19:39
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 15, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Mar 15, 2024
flutter/packages@b21c542...756dcc1

2024-03-15 [email protected] [go_router] Use `leak_tracker_flutter_testing`  (flutter/packages#6210)
2024-03-15 [email protected] [camera_web][google_maps_flutter] Fix tests throwing errors after test completion with manual roll (flutter/packages#6318)
2024-03-14 [email protected] [pigeon] Fixes double prefixes added to enum names for Objc HostApis and FlutterApis (flutter/packages#6263)
2024-03-14 [email protected] [webview_flutter_android][webview_flutter_wkwebview] Adds platform implementations for onHttpError (flutter/packages#6149)
2024-03-14 [email protected] [image_picker_android] Fix deprecation warnings by branching based on build version, and suppressing only when needed (flutter/packages#6233)
2024-03-14 [email protected] [google_maps_flutter] Started dispatching platform messages from platform thread (flutter/packages#6069)

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
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants