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-6863] Completely misleading type error before undefined type member is checked #49412

Closed
rxwei opened this issue Jan 29, 2018 · 6 comments
Closed
Assignees
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

@rxwei
Copy link
Member

rxwei commented Jan 29, 2018

Previous ID SR-6863
Radar rdar://problem/36989788
Original Reporter @rxwei
Type Bug
Status Resolved
Resolution Done
Environment

4.1

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

md5: 317f8f00aab04bbb7e0c4b49d646bf59

Issue Description:

Here's a really bad diagnostic.

protocol P {}
 
struct A<T> : P {
    func foo() -> A<T> {
        return self
    }
}
 
func bar<T>(_ x: A<T>) -> (A<T>, A<T>) {
    return (x.foo(), x.whateverUndefined())
}

Expected result: error: x has no member `whateverUndefined`

Actual result:

error: cannot convert return expression of type 'A<T>' to return type 'A<_>'
    return (x.foo(), x.whateverUndefined())
            ~~^~~~~
                    as! A<_>
@belkadan
Copy link
Contributor

@swift-ci create

@rxwei
Copy link
Member Author

rxwei commented Aug 30, 2018

Any chance to improve this diagnostic for Swift 5?

@xedin
Copy link
Member

xedin commented Aug 30, 2018

Maybe, I'm going to try to add missing members as a fix, will see if that works out...

@xedin
Copy link
Member

xedin commented Jan 10, 2019

Has been fixed by #21756 @rxwei please verify using the next available nightly snapshot.

@rxwei
Copy link
Member Author

rxwei commented Jan 10, 2019

awesome!

@AnnaZaks
Copy link
Mannequin

AnnaZaks mannequin commented Aug 9, 2019

@rxwei, Could you verify if the problem is fixed and if so move the JIRA to "Closed"?

Thanks!
Anna

@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 type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

3 participants