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

[SR-7217] Protocol composition with conflicting typealiases does not diagnose #49765

Open
itaiferber opened this issue Mar 16, 2018 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself type checker Area → compiler: Semantic analysis

Comments

@itaiferber
Copy link
Contributor

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".

@belkadan
Copy link
Contributor

cc @rudkx, @DougGregor

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
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. compiler The Swift compiler in itself type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

2 participants