-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[pigeon] removes safe casting from nullables in kotlin and swift #3284
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 1 commit
1f893d7
4331ba1
2772e95
a6fe0b3
1ac0aee
8d4cba5
307128f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,20 +50,20 @@ struct AllTypes { | |
| var a4ByteArray: FlutterStandardTypedData | ||
| var a8ByteArray: FlutterStandardTypedData | ||
| var aFloatArray: FlutterStandardTypedData | ||
| var aList: [Any?] | ||
| var aList: [Any] | ||
| var aMap: [AnyHashable: Any?] | ||
| var anEnum: AnEnum | ||
| var aString: String | ||
|
|
||
| static func fromList(_ list: [Any?]) -> AllTypes? { | ||
| static func fromList(_ list: [Any]) -> AllTypes? { | ||
| let aBool = list[0] as! Bool | ||
| let anInt = list[1] as! Int32 | ||
| let aDouble = list[2] as! Double | ||
| let aByteArray = list[3] as! FlutterStandardTypedData | ||
| let a4ByteArray = list[4] as! FlutterStandardTypedData | ||
| let a8ByteArray = list[5] as! FlutterStandardTypedData | ||
| let aFloatArray = list[6] as! FlutterStandardTypedData | ||
| let aList = list[7] as! [Any?] | ||
| let aList = list[7] as! [Any] | ||
|
Contributor
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. do we want to test out both
Contributor
Author
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. What do you mean? I'm not sure why we would need Any? for anything in this context since Any can already be nil
Contributor
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. Oh interesting - what about the maps below? Do you also want to remove the e.g.
Contributor
Author
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. probably a good idea
Contributor
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.
Hmmm, if I provide concrete type of nil then it works. I think it's fine to keep
Contributor
Author
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. The |
||
| let aMap = list[8] as! [AnyHashable: Any?] | ||
| let anEnum = AnEnum(rawValue: list[9] as! Int)! | ||
| let aString = list[10] as! String | ||
|
|
@@ -108,23 +108,23 @@ struct AllNullableTypes { | |
| var aNullable4ByteArray: FlutterStandardTypedData? = nil | ||
| var aNullable8ByteArray: FlutterStandardTypedData? = nil | ||
| var aNullableFloatArray: FlutterStandardTypedData? = nil | ||
| var aNullableList: [Any?]? = nil | ||
| var aNullableList: [Any]? = nil | ||
| var aNullableMap: [AnyHashable: Any?]? = nil | ||
| var nullableNestedList: [[Bool?]?]? = nil | ||
| var nullableMapWithAnnotations: [String?: String?]? = nil | ||
| var nullableMapWithObject: [String?: Any?]? = nil | ||
| var aNullableEnum: AnEnum? = nil | ||
| var aNullableString: String? = nil | ||
|
|
||
| static func fromList(_ list: [Any?]) -> AllNullableTypes? { | ||
| static func fromList(_ list: [Any]) -> AllNullableTypes? { | ||
| let aNullableBool = list[0] as! Bool? | ||
| let aNullableInt = list[1] as! Int32? | ||
| let aNullableDouble = list[2] as! Double? | ||
| let aNullableByteArray = list[3] as! FlutterStandardTypedData? | ||
| let aNullable4ByteArray = list[4] as! FlutterStandardTypedData? | ||
| let aNullable8ByteArray = list[5] as! FlutterStandardTypedData? | ||
| let aNullableFloatArray = list[6] as! FlutterStandardTypedData? | ||
| let aNullableList = list[7] as! [Any?]? | ||
| let aNullableList = list[7] as! [Any]? | ||
| let aNullableMap = list[8] as! [AnyHashable: Any?]? | ||
| let nullableNestedList = list[9] as! [[Bool?]?]? | ||
| let nullableMapWithAnnotations = list[10] as! [String?: String?]? | ||
|
|
@@ -176,8 +176,8 @@ struct AllNullableTypes { | |
| struct AllNullableTypesWrapper { | ||
| var values: AllNullableTypes | ||
|
|
||
| static func fromList(_ list: [Any?]) -> AllNullableTypesWrapper? { | ||
| let values = AllNullableTypes.fromList(list[0] as! [Any?])! | ||
| static func fromList(_ list: [Any]) -> AllNullableTypesWrapper? { | ||
| let values = AllNullableTypes.fromList(list[0] as! [Any])! | ||
|
|
||
| return AllNullableTypesWrapper( | ||
| values: values | ||
|
|
@@ -194,10 +194,10 @@ struct AllNullableTypesWrapper { | |
| /// | ||
| /// Generated class from Pigeon that represents data sent in messages. | ||
| struct TestMessage { | ||
| var testList: [Any?]? = nil | ||
| var testList: [Any]? = nil | ||
|
|
||
| static func fromList(_ list: [Any?]) -> TestMessage? { | ||
| let testList = list[0] as! [Any?]? | ||
| static func fromList(_ list: [Any]) -> TestMessage? { | ||
| let testList = list[0] as! [Any]? | ||
|
|
||
| return TestMessage( | ||
| testList: testList | ||
|
|
||

Uh oh!
There was an error while loading. Please reload this page.