Created
October 7, 2016 14:14
-
-
Save hamishknight/2ab42f3e92447bda0e7e572c7e3f9d04 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo {} | |
class Bar : Foo {} | |
class Baz : Foo {} | |
// if you remove the Foo type annotation, (bar, baz) is (Bar, Baz) will return true, | |
// as the compiler can statically check the type. | |
let bar : Foo = Bar() | |
let baz : Foo = Baz() | |
print((bar, baz) is (Bar, Baz)) // false | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment