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-12925] Property Name Collision handled incorrectly #55371

Closed
swift-ci opened this issue Jun 2, 2020 · 3 comments
Closed

[SR-12925] Property Name Collision handled incorrectly #55371

swift-ci opened this issue Jun 2, 2020 · 3 comments
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

@swift-ci
Copy link
Collaborator

swift-ci commented Jun 2, 2020

Previous ID SR-12925
Radar None
Original Reporter sachinvas16 (JIRA User)
Type Bug
Status Closed
Resolution Done

Attachment: Download

Environment

Xcode 11.3.1

Swift: 5.1

Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Bug, TypeChecker
Assignee None
Priority Medium

md5: 3c162fdb3f570c4a80ac0ec03f3118da

Issue Description:

1. We have defined a Protocol:

protocol ExampleProtocol {
      var parameters: [String: Any]
}

2. Added a Protocol extension with default empty value

extension ExampleProtocol {
      var parameters: [String: Any]  {                        
            [:]                
       }
}
  1. Defined a struct which conforms to ExampleProtocol protocol
struct ContentAPIRequest: ExampleProtocol {                  
           var parameters: [String: Any]? // No Error thrown as the type mismatches
}

Even though the Type [String: Any] and [String: Any]? are different, the compiler doesn't throw any error.

@LucianoPAlmeida
Copy link
Collaborator

On Xcode 11.5 the compiler throws an error, it's not type mismatch but no protocol conformance

![](Screen Shot 2020-06-02 at 22.16.09.png)

So maybe this is fixed sachinvas16 (JIRA User)

@swift-ci
Copy link
Collaborator Author

swift-ci commented Jun 3, 2020

Comment by Sachin Vas (JIRA)

@LucianoPAlmeida Yes it is fixed in Xcode 11.5, thank you.

@LucianoPAlmeida
Copy link
Collaborator

So if you verify its fixed, think we can close this 🙂
cc @xedin

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
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