You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tested with both:
Swift 4.0 2017-07-27
Swift 3.1.1
Additional Detail from JIRA
Votes
1
Component/s
Compiler
Labels
Bug, Miscompile
Assignee
None
Priority
Medium
md5: d07d4015e89a04e4adc1b6fb355d798f
Issue Description:
It appears that the `is` operator is incorrectly returning true in the following code.
public protocol EmptyProtocol {}
public protocol ClassRestrictedEmptyProtocol: class { }
public class EmptyClassA: EmptyProtocol {}
public class EmptyClassB: ClassRestrictedEmptyProtocol {}
func type<P>(_ type: Any.Type, conformsTo p: P.Type) -> Bool {
return type is P
}
print(type(EmptyClassA.self, conformsTo: EmptyProtocol.self)) // false
print(type(EmptyClassB.self, conformsTo: ClassRestrictedEmptyProtocol.self)) // true (should be false)
Environment
macOS 10.12.5
Tested with both:
Swift 4.0 2017-07-27
Swift 3.1.1
Additional Detail from JIRA
md5: d07d4015e89a04e4adc1b6fb355d798f
Issue Description:
It appears that the `is` operator is incorrectly returning true in the following code.
https://twitter.com/jckarter/status/891006142368817152
The text was updated successfully, but these errors were encountered: