Skip to content

Conversation

@tejassharma96
Copy link
Contributor

Fixes the problems in #574

@@ -1,9 +1,21 @@
struct StubError: Error {}

class ClassWithTypedThrows {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this now generates:

override func typedThrows() throws(Error) -> Int? {
    return try cuckoo_manager.callThrows(
        "typedThrows() throws(Error) -> Int?",
        parameters: (),
        escapingParameters: (),
        errorType: Error.self,
        superclassCall: super.typedThrows(),
        defaultCall: __defaultImplStub!.typedThrows()
    )
}

override func genericWithTypedThrows<T> (_ p0: T) throws(StubError) {
    return try cuckoo_manager.callThrows(
        "genericWithTypedThrows<T> (_ p0: T) throws(StubError)",
        parameters: (p0),
        escapingParameters: (p0),
        errorType: StubError.self,
        superclassCall: super.genericWithTypedThrows(p0),
        defaultCall: __defaultImplStub!.genericWithTypedThrows(p0)
    )
}

override func asyncTypedThrow() async throws(Error) -> Int? {
    return try await cuckoo_manager.callThrows(
        "asyncTypedThrow() async throws(Error) -> Int?",
        parameters: (),
        escapingParameters: (),
        errorType: Error.self,
        superclassCall: await super.asyncTypedThrow(),
        defaultCall: await __defaultImplStub!.asyncTypedThrow()
    )
}

override func asyncGenericWithTypedThrows<T> (_ p0: T) async throws(StubError) {
    return try await cuckoo_manager.callThrows(
        "asyncGenericWithTypedThrows<T> (_ p0: T) async throws(StubError)",
        parameters: (p0),
        escapingParameters: (p0),
        errorType: StubError.self,
        superclassCall: await super.asyncGenericWithTypedThrows(p0),
        defaultCall: await __defaultImplStub!.asyncGenericWithTypedThrows(p0)
    )
}

override func untypedThrows() throws {
    return try cuckoo_manager.callThrows(
        "untypedThrows() throws",
        parameters: (),
        escapingParameters: (),
        errorType: Swift.Error.self,
        superclassCall: super.untypedThrows(),
        defaultCall: __defaultImplStub!.untypedThrows()
    )
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

note that it correctly uses Error.self when needed but untypedThrows() uses Swift.Error.self instead

@tejassharma96
Copy link
Contributor Author

ci error seems unrelated to my change. likely this: actions/runner-images#12541

I've updated the simulator to 18.6

@tejassharma96
Copy link
Contributor Author

hey @MatyasKriz, would love to get some eyes on this when you have a minute :)

@MatyasKriz
Copy link
Collaborator

Hey, I'm aware, but I couldn't find the time and now I'm vacationing, but I'll go through this when I return, promise!

@tejassharma96
Copy link
Contributor Author

ah, my bad! sorry for interrupting your vacation, enjoy! :)

@MatyasKriz
Copy link
Collaborator

Damn, and then I forgot about it. Sorry! Merging.

@MatyasKriz MatyasKriz merged commit 8d862f7 into Brightify:master Oct 11, 2025
3 checks passed
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