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-8543] UIAppearance doesn't allow generic in whenContainedInInstanceOf: #51061

Open
swift-ci opened this issue Aug 15, 2018 · 1 comment
Open
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

@swift-ci
Copy link
Collaborator

Previous ID SR-8543
Radar rdar://problem/43888481
Original Reporter nelsonaa (JIRA User)
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI, TypeChecker
Assignee None
Priority Medium

md5: 9d0d1fd9f4271291fe10ae1858692db5

Issue Description:

In the following example code it gives an error of 'Cannot assign value of type 'UIColor' to type 'UIColor!' ' It compiles fine without the generic in ExampleController.

import UIKit

final class ExampleController<T>: UITableViewController { }

UITableView.appearance(whenContainedInInstancesOf: [ExampleController.self]).tintColor = UIColor.blue
 

Ideally generic classes could be used with UIAppearance. However, the error message should at least reflect the real issue.

@belkadan
Copy link
Contributor

Yeah, you'll have to provide a specific ExampleController here, since the generic name "ExampleController" isn't itself a class at run time. You're totally right about the diagnostic, though.

@swift-ci create

@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

2 participants