Skip to content

Instantly share code, notes, and snippets.

@hamishknight
Created October 7, 2016 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hamishknight/2ab42f3e92447bda0e7e572c7e3f9d04 to your computer and use it in GitHub Desktop.
Save hamishknight/2ab42f3e92447bda0e7e572c7e3f9d04 to your computer and use it in GitHub Desktop.
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