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-1054] Casting [AnyObject] to generic type is not consistent with casting to non-generic types #43666

Open
swift-ci opened this issue Mar 24, 2016 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. runtime The Swift Runtime

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-1054
Radar None
Original Reporter sulthan (JIRA User)
Type Bug
Environment

Xcode 7.3, Swift 2.2

Additional Detail from JIRA
Votes 1
Component/s
Labels Bug, Runtime
Assignee None
Priority Medium

md5: 32776caf1482818306e70c7e8df3a15b

Issue Description:

See the following example

class GenericClass<T> {
    func someMethod() {
        let anyObjectArray: [AnyObject] = ["test1", "test2", "test3"]

        print(T) //Array<String>
        print(T.self == Array<String>.self) //true

        print(anyObjectArray is [String]) //true
        print(anyObjectArray is T) //false - BUG
    }
}

let instance = GenericClass<[String]>()
instance.someMethod()

Might be connected to SR-1024

@belkadan
Copy link
Contributor

@jckarter, any ideas?

@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. runtime The Swift Runtime
Projects
None yet
Development

No branches or pull requests

2 participants