Skip to content

Conversation

@TheRogue76
Copy link
Owner

Need these since i am a huge fan of result types and typed throws (Good errors make good neighbours)

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for Result types and Swift 6's typed throws syntax to SwiftMockk, enabling better error handling patterns in mocked protocols.

  • Adds convenience DSL methods returnsSuccess() and returnsFailure() for stubbing Result-returning methods
  • Implements full support for Swift 6's typed throws syntax throws(ErrorType) in protocol methods
  • Updates swift-syntax dependency from 510.0.0 to 600.0.0 to leverage proper typed throws API support

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
Tests/SwiftMockkTests/SwiftMockkTests.swift Adds comprehensive test coverage for Result type stubbing and typed throws scenarios including sync/async variants
Sources/SwiftMockkMacros/MockableMacro.swift Implements typed throws detection and generates appropriate stub helper calls based on throw type
Sources/SwiftMockk/SwiftMockk.swift Adds typed throws helper functions and Result type handling in dummy value generation
Sources/SwiftMockk/DSL/Stubbing.swift Adds returnsSuccess() and returnsFailure() convenience methods for Result type stubbing
README.md Documents Result type and typed throws features with examples and important usage notes
CLAUDE.md Provides technical implementation details for Result and typed throws support
Package.swift Updates swift-syntax dependency to 600.0.0 for typed throws API support
Package.resolved Reflects swift-syntax version update to 600.0.1

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

TheRogue76 and others added 4 commits December 31, 2025 21:47
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@TheRogue76 TheRogue76 merged commit d01b553 into main Dec 31, 2025
3 checks passed
@TheRogue76 TheRogue76 deleted the feature/typed-throws-and-result-types branch December 31, 2025 20:52
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.

Lack of support for Result types and Typed throws

2 participants