-
Notifications
You must be signed in to change notification settings - Fork 85
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
Generate mock method with Typed Throw #262
base: master
Are you sure you want to change the base?
Conversation
136cdd3
to
bbb6de0
Compare
c5c877f
to
725c67d
Compare
let funcThrow2 = """ | ||
import Foundation | ||
/// \(String.mockAnnotation) | ||
protocol FuncThrow { | ||
func update<T>(arg1: T, arg2: () throws -> T) rethrows -> T | ||
func update<T, U>(arg1: T, arg2: @escaping (U) throws -> ()) throws -> ((T) -> (U)) | ||
} | ||
""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI
This test-fixture is not used and is covered by funcThrow
test-fixture. So I deleted it.
) | ||
} | ||
.first | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if splitting by .whitespace
is suitable or not. but this code works in added test-cases.
As far as I investigated,
any Error
can't be thrown type because it's not a concrete type.some Error
can't come here due to an issue related to performance (https://github.com/swiftlang/swift-evolution/blob/main/proposals/0413-typed-throws.md#opaque-thrown-error-types).
@@ -11,7 +11,7 @@ let package = Package( | |||
.library(name: "MockoloFramework", targets: ["MockoloFramework"]), | |||
], | |||
dependencies: [ | |||
.package(url: "https://github.com/apple/swift-syntax.git", from: "510.0.1"), | |||
.package(url: "https://github.com/swiftlang/swift-syntax.git", from: "600.0.0-prerelease-2024-06-12"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to use ThrowsClauseSyntax
, I updated swift-syntax.
In this pull request, parse typed-throw name from throws clause.