-   Notifications  
You must be signed in to change notification settings  - Fork 10.6k
 
Open
Labels
TypeResolverbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfextensionFeature → declarations: `extension` declarationsFeature → declarations: `extension` declarationsgeneric constraintsFeature → generics: generic constraintsFeature → generics: generic constraintsgenericsFeature: generic declarations and typesFeature: generic declarations and typesswift 5.9type checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysisunexpected errorBug: Unexpected errorBug: Unexpected error
Description
Description
 I found an odd case where the compiler will refuse to compile an extension of a generic type's subtype, with the subtype using the same type parameters as its container type.
Steps to reproduce
 Try building the following on current released tooling (Xcode 14.2, Swift 5.7):
struct Property<Value: Equatable> { var value: Value } enum Namespace<Value: Equatable> { typealias Prop = Property<Value> } extension Namespace.Prop { static func buildOne(initialValue: Value) -> Self { return .init(value: initialValue) } }I get the following error:
 <path to file>:<line>:<column> Reference to generic type ‘Namespace’ requires arguments in <...>
Using extension Property instead will compile.
Expected behavior
 I'm reasonably sure it should build. Even if I'm wrong about that, the error emitted doesn't make sense.
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: 
macOS 13.3 
Metadata
Metadata
Assignees
Labels
TypeResolverbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfextensionFeature → declarations: `extension` declarationsFeature → declarations: `extension` declarationsgeneric constraintsFeature → generics: generic constraintsFeature → generics: generic constraintsgenericsFeature: generic declarations and typesFeature: generic declarations and typesswift 5.9type checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysisunexpected errorBug: Unexpected errorBug: Unexpected error