kotlin-python icon indicating copy to clipboard operation
kotlin-python copied to clipboard

Optimize `Unit` returns

Open krzema12 opened this issue 2 years ago • 1 comments

Originally created by @SerVB.

If it's just Unit, just return Python's None; if it's nullable (Unit?), then do some more complex logic like null -> None and Unit -> Unit.getInstance(). However doing this will also require being careful with Unit assignments, for example, if there is code like val b = println(), it should be compiled like println(); val b = Unit (achievable via introducing an extra lowering) because println() will return None and it's not what we want to assign to b.

krzema12 avatar Nov 23 '21 07:11 krzema12