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-10136] Unclear error message after shadowing type(of:) function #52538

Closed
Agarunov opened this issue Mar 20, 2019 · 0 comments
Closed

[SR-10136] Unclear error message after shadowing type(of:) function #52538

Agarunov opened this issue Mar 20, 2019 · 0 comments

Comments

@Agarunov
Copy link

Previous ID SR-10136
Radar None
Original Reporter @Agarunov
Type Improvement
Status Resolved
Resolution Duplicate
Additional Detail from JIRA
Votes 0
Component/s
Labels Improvement
Assignee None
Priority Medium

md5: 41f33f1df262ec3b611599fd1425802a

duplicates:

  • SR-9096 If a variable shadows a function, the diagnostic when attempting to invoke the variable like a function should suggest to rename the variable or qualify the function

Issue Description:

This code provides unclear error message:

extension UIViewController {
    
    func findFirst<T>(of type: T.Type) {
        let t = type(of: self) // error: Non-nominal type 'T' does not support explicit initialization
    }
    
}

In this case variable type shadows type(of🙂 function.

Maybe compiler should provide more clear error message.

Environment: swift 4.2 Xcode 10.1. swift 5 Xcode 10.2

@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
Projects
None yet
Development

No branches or pull requests

1 participant