Skip to content

Commit

Permalink
fix for the case when the text some exists in the returning type
Browse files Browse the repository at this point in the history
  • Loading branch information
omarzl committed Apr 30, 2024
1 parent c5b823f commit b96380d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Sources/MockoloFramework/Utils/TypeParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ public final class `Type` {
if let closureRng = closureRng {
let left = ret[ret.startIndex..<closureRng.lowerBound]
let right = ret[closureRng.lowerBound..<ret.endIndex]
ret = left + right.replacingOccurrences(of: String.some, with: String.any)
ret = left + right.replacingOccurrences(of: "\(String.some) ", with: "\(String.any) ")

for item in typeParamList {
if isEscaping, left.literalComponents.contains(item) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public class OpaqueTypeWithMultiTypeProtocolMock: OpaqueTypeWithMultiTypeProtoco
let closureReturningSomeType = """
/// \(String.mockAnnotation)
protocol ProtocolReturningOpaqueTypeInClosureProtocol {
func register(router: @autoclosure @escaping () -> (some Error))
func register(router: @autoclosure @escaping () -> (some MyAwesomeType))
}
"""

Expand All @@ -106,8 +106,8 @@ class ProtocolReturningOpaqueTypeInClosureProtocolMock: ProtocolReturningOpaqueT
private(set) var registerCallCount = 0
var registerHandler: ((@autoclosure @escaping () -> (any Error)) -> ())?
func register(router: @autoclosure @escaping () -> (some Error)) {
var registerHandler: ((@autoclosure @escaping () -> (any MyAwesomeType)) -> ())?
func register(router: @autoclosure @escaping () -> (some MyAwesomeType)) {
registerCallCount += 1
if let registerHandler = registerHandler {
registerHandler(router())
Expand Down

0 comments on commit b96380d

Please sign in to comment.