Be more graceful when handing null values#3245
Be more graceful when handing null values#3245tikurahul wants to merge 1 commit intosquare:masterfrom
Conversation
…when dealing with mutable types. Test: Updated golden tests.
|
|
||
| override fun toString(): String { | ||
| val result = mutableListOf<String>() | ||
| if (preamble != null) result += """preamble=${sanitize(preamble!!)}""" |
There was a problem hiding this comment.
If preamble is not null when would preamble ?: "" make sense?
There was a problem hiding this comment.
I think doing ?.let would be best, but there's that compiler bug with them...
There was a problem hiding this comment.
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.