Skip to content
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

fix: don't conform errors for swift 6 support #24

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cjbell
Copy link
Contributor

@cjbell cjbell commented Sep 19, 2024

  • Creates an error wrapper instead of conforming FlutterError as Error (which fails in Swift 6)

KNO-6949

Copy link

linear bot commented Sep 19, 2024

Copy link

@brentjanderson brentjanderson left a comment

Choose a reason for hiding this comment

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

LGTM - I think the introduction of hte wrapper is, itself, an interesting requirement here, but without further context this seems syntactically correct.

Have we validated this against versions less than Swift 6? Seems like it's just a plain struct that we're introducing here, so it's pretty clean.

@cjbell
Copy link
Contributor Author

cjbell commented Sep 19, 2024

@brentjanderson

Yep the reason we're doing this is:

The error "extension declares a conformance of imported type" occurs when you're trying to extend an imported type (like FlutterError from the Flutter framework) to conform to a protocol (like Error). In Swift, you are not allowed to declare a conformance of an imported type in an extension if you don’t own the type (i.e., you didn't define the type in your own module).
In your case, FlutterError is a type imported from the Flutter framework, and you're trying to extend it to conform to the Error protocol. Swift does not allow you to add conformance to types that you don't own unless it's done in the original module that defines the type.

A plain struct wrapper is absolutely compatible

@cjbell
Copy link
Contributor Author

cjbell commented Sep 19, 2024

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.

2 participants