Skip to content

Убрать запрет на expression body в общем случае #7

@PilotOfSparrow

Description

@PilotOfSparrow

Чтобы можно было так:

    private fun moo(mo: String) = when (mo) {
        "you",
        "and",
        "me" -> true
        else -> false
    }

    private fun foo() =
        try {
            if ("ohhh" == "you touch my talalam") {
                throw IllegalStateException("It's din din dong")
            }
            "magic"
        } catch (e: Exception) {
            println("ta talala talalalala")

            "the gathering"
        }

Сейчас можно только так:

    private fun moo(mo: String): Any {
        return when (mo) {
            "you",
            "and",
            "me" -> true
            else -> false
        }
    }

    private fun foo(): String {
        return try {
            if ("ohhh" == "you touch my talalam") {
                throw IllegalStateException("It's din din dong")
            }
            "magic"
        } catch (e: Exception) {
            println("ta talala talalalala")

            "the gathering"
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions