-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Change unicodescalar initializer to failable #3662
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,9 +33,9 @@ PrintTests.test("CustomStringConvertible") { | |
hasDescription(CInt(42)) | ||
hasDescription(CLong(42)) | ||
hasDescription(CLongLong(42)) | ||
hasDescription(CWideChar(42)) | ||
hasDescription(CWideChar(42)!) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Won't this infer '42' to be a UInt8, and then not even need the unwrapping? (Similarly for other cases below.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it will treat it as Int. I had to do hasDescription(CWideChar(UInt8(42))) to get rid of the unwrapping. |
||
hasDescription(CChar16(42)) | ||
hasDescription(CChar32(42)) | ||
hasDescription(CChar32(42)!) | ||
} | ||
|
||
PrintTests.test("Printable") { | ||
|
@@ -50,9 +50,9 @@ PrintTests.test("Printable") { | |
expectPrinted("42", CInt(42)) | ||
expectPrinted("42", CLong(42)) | ||
expectPrinted("42", CLongLong(42)) | ||
expectPrinted("*", CWideChar(42)) | ||
expectPrinted("*", CWideChar(42)!) | ||
expectPrinted("42", CChar16(42)) | ||
expectPrinted("*", CChar32(42)) | ||
expectPrinted("*", CChar32(42)!) | ||
|
||
if (UInt64(Int.max) > 0x1_0000_0000 as UInt64) { | ||
expectPrinted("-9223372036854775808", Int.min) | ||
|
@@ -141,9 +141,9 @@ PrintTests.test("Printable") { | |
expectPrinted("42", CLong(42)) | ||
expectPrinted("42", CLongLong(42)) | ||
|
||
expectPrinted("*", CWideChar(42)) | ||
expectPrinted("*", CWideChar(42)!) | ||
expectPrinted("42", CChar16(42)) | ||
expectPrinted("*", CChar32(42)) | ||
expectPrinted("*", CChar32(42)!) | ||
} | ||
|
||
runAllTests() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also add an example of when it can return nil?