Skip to content

Conversation

@rintaro
Copy link
Member

@rintaro rintaro commented Jul 10, 2025

  • Introduce SwiftType.opaque(SwiftType) and .existential(SwiftType) to represent some and any types respectively.
  • Introduce SwiftKnownTypes.representativeType(of:) to the hardcoded DataProtocol -> Data translation mapping.

* Introduce `SwiftType.opaque(SwiftType)` and `.existential(SwiftType)`
  to represent `some` and `any` types respectively.
* Introduce `SwiftKnownTypes.representativeType(of:)` to the hardcoded
  `DataProtocol` -> `Data` translation mapping.
try (var arena = AllocatingSwiftArena.ofConfined()) {
var bytes = arena.allocateFrom("hello");
var dat = Data.init(bytes, bytes.byteSize(), arena);
MySwiftLibrary.globalReceiveSomeDataProtocol(dat);
Copy link
Member Author

Choose a reason for hiding this comment

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

@ktoso I'd be happy to make this and Data thing test cases, but where exactly I should write? Any PR testing runs Samples:SwiftKitSampleApp:test?

Copy link
Collaborator

Choose a reason for hiding this comment

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

So every example has a ci-validate.sh and you can add a ./gradle test in there in Samples/SwiftKitSampleApp/ci-validate.sh and add a test in Samples/SwiftKitSampleApp/src/test/java/com/example/swift :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh boy I just realized we have tests there but we've not been running them huh. so yeah please add a gradle test there :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

let concreteTy = knownTypes.representativeType(of: knownProtocol)
{
return try lowerParameter(concreteTy, convention: convention, parameterName: parameterName)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

Copy link
Collaborator

@ktoso ktoso left a comment

Choose a reason for hiding this comment

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

Very nice!

Also, run Samples:SwiftKitSampleApp:test in CI
@rintaro rintaro merged commit 31fd9e3 into swiftlang:main Jul 10, 2025
55 of 56 checks passed
@rintaro rintaro deleted the jextract-ffm-representative branch July 11, 2025 00:07
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