-
Notifications
You must be signed in to change notification settings - Fork 576
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
Be more graceful when handing null values #3245
Conversation
…when dealing with mutable types. Test: Updated golden tests.
@@ -93,7 +93,7 @@ public class MutablePayload( | |||
|
|||
override fun toString(): String { | |||
val result = mutableListOf<String>() | |||
if (preamble != null) result += """preamble=${sanitize(preamble!!)}""" |
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.
If preamble
is not null when would preamble ?: ""
make sense?
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.
I think doing ?.let
would be best, but there's that compiler bug with them...
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.
Was the thought that it's confusing to read ? I guess we are doing more work than we need to strictly speaking.
I considered one other thing which is to make sanitize(...)
accept String?
but I would have to rename the list variant to sanitizeList
to disambiguate. Maybe we should do that instead ?
Sorry, there is not that much different. I was trying to avoid the use of the |
@tikurahul let's use |
I feel like what's there right now might be okay; and better than then |
|
Test: Updated golden tests.