Created
January 20, 2017 12:04
-
-
Save tikitu/db54e63edb31b3ef3148e257573db50c to your computer and use it in GitHub Desktop.
Inconsistent implicit type conversions in Swift
This file contains 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
Welcome to Apple Swift version 3.0.2 (swiftlang-800.0.63 clang-800.0.42.1). Type :help for assistance. | |
1> let an_int: Int = 3 | |
an_int: Int = 3 | |
2> an_int is Int? | |
$R0: Bool = true | |
3> [an_int] is [Int?] | |
$R1: Bool = true | |
4> let list_of_ints = [an_int] | |
list_of_ints: [Int] = 1 value { | |
[0] = 3 | |
} | |
5> list_of_ints is [Int?] | |
error: repl.swift:5:14: error: 'Int?' is not a subtype of 'Int' | |
list_of_ints is [Int?] | |
~~~~~~~~~~~~~^~~~~~~~~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment