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-13289] No warning/error when inheriting protocol and redeclaring property with different type #55729

Open
theblixguy opened this issue Jul 24, 2020 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation type checker Area → compiler: Semantic analysis

Comments

@theblixguy
Copy link
Collaborator

Previous ID SR-13289
Radar None
Original Reporter @theblixguy
Type Bug
Environment

Xcode 12 beta 1

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

md5: caa89b1fd62314d47242373b121f150b

Issue Description:

protocol P {
  var foo: Int { get }
}

protocol Q: P {
  var foo: Bool { get }
}

Here, we don't get a warning or an error for redeclaring foo with a different type. This is problematic because a type cannot conform to the Q protocol if the requirements have the same name but incompatible types.

struct S: Q {
  var foo: Int
  var foo: Bool // Invalid redeclaration of 'foo'
}
@theblixguy
Copy link
Collaborator Author

cc @xedin @hborla do you think we should detect such cases and emit a warning/error?

@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 diagnostics QoI Bug: Diagnostics Quality of Implementation type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

1 participant