Skip to content
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

[Regression] Build failure when library distribution is enabled. #79846

Open
Skoti opened this issue Mar 7, 2025 · 0 comments
Open

[Regression] Build failure when library distribution is enabled. #79846

Skoti opened this issue Mar 7, 2025 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels

Comments

@Skoti
Copy link

Skoti commented Mar 7, 2025

Description

There is a build failure when compiling code with library distribution enabled.
The build fails on a typealias that is a composition of two protocols where at least one is using a primary associated type.

This is a regression that I first encountered in Xcode 15.1. It was working on Xcode 14.3.
I've just checked with Xcode 16.3 beta (16E5104o) - the same issue.

Regardless of the above, all work when library distribution is not set.

Reproduction

Create a Swift package that contains this code:

public protocol Test<PrimaryType> {
    associatedtype PrimaryType

    func give() -> PrimaryType
}

public typealias Concrete = Test<Int> & AnyObject

public protocol Factory {
    func concrete() -> any Concrete
}

Then build it with:

xcodebuild -configuration Release -scheme *YOUR_SCHEME* -destination generic/platform=macOS BUILD_LIBRARY_FOR_DISTRIBUTION=YES

and it fails with:

/{redacted}/TestPat.build/Release/PatTest.build/Objects-normal/x86_64/PatTest.private.swiftinterface:15:26: error: non-protocol, non-class type 'Test<Int>' cannot be used within a protocol-constrained type
13 | public typealias Concrete = PatTest.Test<Swift.Int> & Swift.AnyObject
14 | public protocol Factory {
15 |   func concrete() -> any PatTest.Test<Swift.Int> & Swift.AnyObject
   |                          `- error: non-protocol, non-class type 'Test<Int>' cannot be used within a protocol-constrained type
16 | }
17 |

/{redacted}/TestPat.build/Release/PatTest.build/Objects-normal/x86_64/PatTest.private.swiftinterface:1:1: error: failed to verify module interface of 'PatTest' due to the errors above; the textual interface may be broken by project issues or a compiler bug

Expected behavior

The build with library distribution enabled should end successfully as the build without that flag.

Environment

❯ swiftc -version
swift-driver version: 1.120.2 Apple Swift version 6.1 (swiftlang-6.1.0.106.4 clang-1700.0.9.2)
Target: arm64-apple-macosx15.0

Additional information

No response

@Skoti Skoti added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels labels Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels
Projects
None yet
Development

No branches or pull requests

1 participant