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-13848] Restore Note About Optionality Mismatch in Redeclared Functions Involving IUOs and Optionals #56246

Closed
CodaFi opened this issue Nov 12, 2020 · 4 comments
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 good first issue Good for newcomers type checker Area → compiler: Semantic analysis

Comments

@CodaFi
Copy link
Member

CodaFi commented Nov 12, 2020

Previous ID SR-13848
Radar rdar://42074887
Original Reporter @CodaFi
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI, StarterBug, TypeChecker
Assignee saidhon (JIRA)
Priority Medium

md5: 1147b9bfe76cf8f9a6a7fd5065ba6139

Issue Description:

We currently consider functions that attempt to overload with an implicitly unwrapped optional and a plain optional to be redeclarations of each other and emit an error

func test1(i: Int?) {} // 'test1(i:)' previously declared here
func test1(i: Int!) {} // error: invalid redeclaration of 'test1(i:)'

There used to be a note in Swift 4.1 about how these redeclarations only differed in optionality, but it was removed here f088237

We should really add it back, it was helpful.

@MartinP7r
Copy link

Hello @CodaFi, I'm new here and trying to find something easy to get acquainted with the process.

Please correct me when I'm wrong.

Essentially the new

func optionalInOut(x: inout Int!) { } // expected-error{{invalid redeclaration of 'optionalInOut(x:)}}

should also include the note

which differs only by the kind of optional passed as an inout argument ('Int!' vs. 'Int?')

Like it used to for the warning before this commit?

@CodaFi
Copy link
Member Author

CodaFi commented Nov 15, 2020

Yes, that’s the idea.

@swift-ci
Copy link
Collaborator

Comment by Saidhon Orifov (JIRA)

Hi @CodaFi, I opened a PR for this: #34823

@CodaFi
Copy link
Member Author

CodaFi commented Jul 14, 2021

Resolved by the merge of #34823

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

No branches or pull requests

3 participants