Skip to content

Support explicit source module qualification for mocks - #604

Open
GtechGovind wants to merge 1 commit into
Brightify:masterfrom
GtechGovind:fix/source-module-qualified-mocks
Open

GtechGovind wants to merge 1 commit into
Brightify:masterfrom
GtechGovind:fix/source-module-qualified-mocks

Conversation

@GtechGovind

Copy link
Copy Markdown

Fixes #128

I added an optional sourceModule configuration value so generated mocks and stubs can refer to their original declarations with a module-qualified name when imported modules share type names.

Qualification covers inheritance, MocksType, default implementations, type-erasure constraints and nested declaration namespaces. Generated mock/proxy names remain unchanged. The option is explicit rather than inferred from a configuration section name, and does not rewrite arbitrary member types.

I added a Swift Package regression fixture with colliding class, protocol and namespace names in two imported modules, and wired it into the macOS package CI job.

Validation:

  • swift build passed.
  • swift test --force-resolved-versions in IntegrationTests/SourceModule: 4 tests passed.
  • Removing sourceModule from the fixture reproduced ambiguous-type compilation failures; restoring it passed.
  • macOS and iOS Xcode suites: 357 passed and 8 expected failures each, with no unexpected failures.
  • git diff --check passed.

For the local Xcode suites, I generated the workspace with Tuist 4.53.4 and used command-line deployment-target overrides (macOS 12 and iOS 15) because the installed SDK no longer accepts the project's macOS 10.15 target. I generated mocks separately and set GENERATE_TEST_MOCKS=NO; project deployment settings are unchanged. Root swift test cannot run the Objective-C mock tests without the generated Xcode workspace, so the full suites were run through Xcode.

@GtechGovind
GtechGovind marked this pull request as ready for review October 17, 2026 06:45
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.

Provide a way to disambiguate types that exist in multiple frameworks

1 participant