-
Notifications
You must be signed in to change notification settings - Fork 26.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[pigeon] If both plugin and app uses Swift for generating code, extension for FlutterError make project not buildable. #147371
Labels
found in release: 3.19
Found to occur in 3.19
found in release: 3.22
Found to occur in 3.22
has reproducible steps
The issue has been confirmed reproducible and is ready to work on
p: pigeon
related to pigeon messaging codegen tool
P2
Important issues not at the top of the work list
package
flutter/packages repository. See also p: labels.
platform-ios
iOS applications specifically
r: fixed
Issue is closed as already fixed in a newer version
team-ecosystem
Owned by Ecosystem team
triaged-ecosystem
Triaged by Ecosystem team
Comments
11 tasks
Thanks for the detailed bug report and potential fix. stable, master flutter doctor -v
|
darshankawar
added
platform-ios
iOS applications specifically
package
flutter/packages repository. See also p: labels.
has reproducible steps
The issue has been confirmed reproducible and is ready to work on
p: pigeon
related to pigeon messaging codegen tool
found in release: 3.19
Found to occur in 3.19
found in release: 3.22
Found to occur in 3.22
team-ecosystem
Owned by Ecosystem team
and removed
in triage
Presently being triaged by the triage team
labels
Apr 26, 2024
stuartmorgan
added
P2
Important issues not at the top of the work list
triaged-ecosystem
Triaged by Ecosystem team
labels
Apr 30, 2024
auto-submit bot
pushed a commit
to flutter/packages
that referenced
this issue
May 16, 2024
Swift has more strict type system than Objective-C. For example, protocol conformance must not be redundant[1]. Also, Both FlutterError and Swift.Error are public, extension `FlutterError` to `Swift.Error` is also public. If someone create a such extension in the plugin code, Flutter app can't create a such extension in the app code, which forces Plugin developers to use Objective-C when they want to use pigeon, instead of Swift. To avoid this issue, this change makes pigeon to use another error type, named `PigeonError`, instead of `FlutterError`. By declaring `PigeonError` as internal visibility, their existence won't make compilation error even if `PigeonError` is declared in the app code. Fixes flutter/flutter#147371. See also flutter/flutter#137057 (comment). [1] https://docs.swift.org/swift-book/documentation/the-swift-programming-language/declarations/#Protocol-Conformance-Must-Not-Be-Redundant
darshankawar
added
the
r: fixed
Issue is closed as already fixed in a newer version
label
May 17, 2024
TecHaxter
pushed a commit
to TecHaxter/flutter_packages
that referenced
this issue
May 22, 2024
…#6611) Swift has more strict type system than Objective-C. For example, protocol conformance must not be redundant[1]. Also, Both FlutterError and Swift.Error are public, extension `FlutterError` to `Swift.Error` is also public. If someone create a such extension in the plugin code, Flutter app can't create a such extension in the app code, which forces Plugin developers to use Objective-C when they want to use pigeon, instead of Swift. To avoid this issue, this change makes pigeon to use another error type, named `PigeonError`, instead of `FlutterError`. By declaring `PigeonError` as internal visibility, their existence won't make compilation error even if `PigeonError` is declared in the app code. Fixes flutter/flutter#147371. See also flutter/flutter#137057 (comment). [1] https://docs.swift.org/swift-book/documentation/the-swift-programming-language/declarations/#Protocol-Conformance-Must-Not-Be-Redundant
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
found in release: 3.19
Found to occur in 3.19
found in release: 3.22
Found to occur in 3.22
has reproducible steps
The issue has been confirmed reproducible and is ready to work on
p: pigeon
related to pigeon messaging codegen tool
P2
Important issues not at the top of the work list
package
flutter/packages repository. See also p: labels.
platform-ios
iOS applications specifically
r: fixed
Issue is closed as already fixed in a newer version
team-ecosystem
Owned by Ecosystem team
triaged-ecosystem
Triaged by Ecosystem team
Steps to reproduce
extension FlutterError: Swift.Error {}
).Expected results
The project should build successfully.
Actual results
error: redundant conformance of 'FlutterError' to protocol 'Error'
Code sample
Check out https://github.com/bc-lee/demo-flutter-pigeon-swift.git with
aca044733e3f624a14ab6cd40851c733b519f1e7 commit.
Failing GitHub Action: Link
Analysis
Requiring users to add
extension FlutterError: Swift.Error {}
was due to #137057. However, even with that workaround, the project still remains unbuildable.The root cause of this issue is that Swift has much stricter type system than Objective-C. For example, protocol conformance must not be redundant[1].
We need better solution to avoid this issue. I'm working on a PR to fix this issue.
[1] https://docs.swift.org/swift-book/documentation/the-swift-programming-language/declarations/#Protocol-Conformance-Must-Not-Be-Redundant
Flutter Doctor output
Doctor output
The text was updated successfully, but these errors were encountered: