Open
Description
Previous ID | SR-7217 |
Radar | None |
Original Reporter | @itaiferber |
Type | Bug |
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | Bug, TypeChecker |
Assignee | None |
Priority | Medium |
md5: c5f27b0f94d34e042696e3afc9cf3681
relates to:
- SR-7516 Compiler accepts ambiguous and/or invalid use of associated types
- SR-5392 Inconsistent "invalid redeclaration of typealias"
- SR-5440 Typealias in constrained extension misinterprets the where clause
Issue Description:
From discussion in https://forums.swift.org/t/decode-a-json-object-of-unknown-format-into-a-dictionary-with-decodable-in-swift-4/6138/38, the following typealias conflict produces no diagnostics in Swift 4.1:
struct Foo {}
struct Bar {}
protocol P1 { typealias T = Foo }
protocol P2 { typealias T = Bar }
typealias P3 = P1 & P2
print(P3.T.self) // => Bar()
typealias P4 = P2 & P1
print(P4.T.self) // => Bar()
Code completion shows two overloads for P3.T
and P4.T
but there are no warnings or complaints otherwise. The ordering of the composition makes no difference on which type "wins out".
Metadata
Metadata
Assignees
Labels
Bug: Accepts invalidA deviation from expected or documented behavior. Also: expected but undesirable behavior.The Swift compiler itselfFeature → type declarations: Protocol declarationsFeature → types: protocol composition typesArea → compiler: Semantic analysisFeature → declarations: Type declarationsFeature → type declarations: `typealias` declarationsFeature: typesBug: Unexpected behavior or incorrect output