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

[swift2objc] Support throws on methods returning primitive types #1761

Open
liamappelbe opened this issue Nov 28, 2024 · 0 comments
Open

[swift2objc] Support throws on methods returning primitive types #1761

liamappelbe opened this issue Nov 28, 2024 · 0 comments
Labels
good first issue A good starting issue for contributors (issues with this label will appear in /contribute) package:swift2objc

Comments

@liamappelbe
Copy link
Contributor

Hitting this compile error when trying to support the throws annotation:

pkgs/swift2objc/test/integration/throws_output.swift:16:21: error: throwing method cannot be marked @objc because it returns a value of type 'Int'; return 'Void' or a type that bridges to an Objective-C class
  @objc public func intMethod(y: Int) throws -> Int {

Looks like functions and methods that return primitive types can't be marked both @objc and throws. This is similar to #1743. The fix in both cases is to return a boxed primitive.

@liamappelbe liamappelbe moved this to Backlog in ObjC/Swift interop Nov 28, 2024
@liamappelbe liamappelbe added the good first issue A good starting issue for contributors (issues with this label will appear in /contribute) label Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue A good starting issue for contributors (issues with this label will appear in /contribute) package:swift2objc
Projects
Status: Backlog
Development

No branches or pull requests

1 participant