Compare first operand of the trenary ? operator with default value

Description

converts to:

.. but should be something like:

Environment

None

Activity

Show:
Alex Petuschak
March 19, 2018, 10:14 AM

Related (ZendDesk ticket #143):

should be:

Keegan Rush
April 16, 2018, 7:32 AM
Edited

Why not use the nil coalescing operator?

Alex Petuschak
April 16, 2018, 8:09 AM
Edited

Great idea, however, the case you mention is just one of the cases when we return the same expression as the condition expression (`document?.documentPath`) as the `true` statement.

For example, the original code could read:
let pass: Any? = (document?.documentPath ? "someValue" : "anotherValue").

Anyway, I've just created to better handle such cases in the future.

Assignee

Alex Petuschak

Reporter

Alex Petuschak

Labels

Git Branch Name

None

GitHub Issue

None

Components

Fix versions

Priority

Medium
Configure