Skip to content

Error using function any(_:of:) when closure use generic types #336

@hrool20

Description

@hrool20

New Issue Checklist

Overview

Cannot use closures and an argument captor at the same time. It forces me to use classes.

Example

I think the problem starts because i need to declare the type of a closure and at the same time use an argument captor to return a value. If i try that, Xcode cannot run the test and it shows an error. And if i see inside any(_:of:), it shows that i'm using the following function

Test any function
image image

But if i don't use the argument captor, the error in the test disappear and i see that any is referring another function

Test any function
image image

The only difference i see inside any functions is that in the first one it requires T to be AnyObject. So, i'm wondering if this is a bug. Or what is the way to declare the type of a closure and also use an argument captor?

Expected Behavior

It should let me run the test without showing an error.

Environment

  • Mockingbird CLI version (0.20.0)
  • Xcode and Swift version (Xcode 15.0.1 | Swift 5.9 (swiftlang-5.9.0.128.108 clang-1500.0.40.1))
  • Package manager (CocoaPods)
  • Unit testing framework (XCTest)
  • Custom configuration
    • Mockingbird ignore files
    • Supporting source files

Metadata

Metadata

Assignees

No one assigned

    Labels

    framework bugBreaks tests or user testing code

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions