Skip to content

Wrong behavior of a constrained protocol type in the inheritance clause of a concrete type #63377

Closed as duplicate of#62906
@alberussoftware

Description

@alberussoftware

Description

Cannot inherit from protocol type with generic argument

Steps to reproduce

protocol P<Q> {
  associatedtype Q
}

struct S: P<Int> { // Cannot inherit from protocol type with generic argument 'P<Int>
}

Expected behavior

meantime it should be equivalent to the second form

struct S: P { 
  typealias Q = Int
}

Environment

  • Swift compiler version info: swift-driver version: 1.62.15 Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)
  • Xcode version info: Xcode 14.2 Build version 14C18
  • Deployment target: iOS 16.0

Metadata

Metadata

Assignees

Labels

associated type inferencebugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfconformancesFeature → protocol: protocol conformancesparameterized protocolsFeature → protocol: protocols with primary associated typesprotocolFeature → type declarations: Protocol declarationsswift 5.9type checkerArea → compiler: Semantic analysis

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions