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 bit mask of numberArguments #109

Merged
merged 1 commit into from
Nov 17, 2023

Conversation

p-x9
Copy link
Contributor

@p-x9 p-x9 commented Nov 16, 2023

Hi, I think it is a great library.

I have found that the wrong number of parameters is returned when retrieving FunctionInfo for the following closure.

let t = (@convention(thin) (Int, String) async throws -> String).self

let md = FunctionMetadata(type: t)
let info = md.info()
print(info.numberOfArguments) // -> 131074

It seems to be caused by an incorrect bit mask.

https://github.com/apple/swift/blob/ade2671aee6853e3b76511a9c9a57945676ef237/include/swift/ABI/MetadataValues.h#L1029-L1042

Here is my Swift environment

(Apple Swift version 5.9 (swiftlang-5.9.0.128.108 clang-1500.0.40.1))

@wickwirew
Copy link
Owner

Good catch! Cant believe this hasnt been hit before. Thanks for the fix!

@wickwirew wickwirew merged commit 73c9021 into wickwirew:master Nov 17, 2023
56 checks passed
@wickwirew
Copy link
Owner

@p-x9 btw just pushed 2.2.5 for this fix

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