Skip to content
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

Wrong work with kotlin ranges #175

Open
DaniilStepanov opened this issue Sep 7, 2023 · 0 comments
Open

Wrong work with kotlin ranges #175

DaniilStepanov opened this issue Sep 7, 2023 · 0 comments
Labels
bug Something isn't working ir

Comments

@DaniilStepanov
Copy link
Collaborator

Example:

 fun isDigit(a: Int) : String {
        val aa = ArrayList<Int> ()
        aa.add(239)

        return when(a) {
            in aa -> "array list"
            in 0..9 -> "digit"
            !in 0..100 -> "not small"
            else -> "something"
        }
    }

    fun assertDigit(i: Int, expected: String): String {
        val result = isDigit(i)
        return if (result == expected) "" else "fail: isDigit($i) = \"$result\""
    }

    @JvmStatic
    fun box(): String {
        val result = assertDigit(0, "digit")
        if (result == "") return "OK"
        return result
    }
lehvolk added a commit that referenced this issue Sep 13, 2023
@lehvolk lehvolk added the bug Something isn't working label Sep 15, 2023
lehvolk added a commit that referenced this issue Sep 26, 2023
lehvolk added a commit that referenced this issue Sep 26, 2023
@lehvolk lehvolk added the ir label Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ir
Projects
None yet
Development

No branches or pull requests

2 participants