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

Silently crashes neovim with elvis-operator null-safety handling #134

Closed
covelloz opened this issue Jul 30, 2024 · 4 comments
Closed

Silently crashes neovim with elvis-operator null-safety handling #134

covelloz opened this issue Jul 30, 2024 · 4 comments

Comments

@covelloz
Copy link

I'm noticing that the kotlin tree-sitter extension is crashing neovim when trying to throw errors on nullable types. I will give a very simple, reproducible example. I have confirmed that the issue is with tree-sitter-kotlin. If I uninstall kotlin from tree-sitter the issue resolves: :TSUninstall kotlin

tree-sitter: current (v0.9.2)
tree-sitter-kotlin: current (0.3.7)
Neovim version:

NVIM v0.10.1
Build type: Release
LuaJIT 2.1.1720049189
Run "nvim -V1 -v" for more info

Example:

package org.example

import kotlin.random.Random

class App {
    val greeting: String
        get() {
            val rng = Random.Default.nextInt(1, 11)
            val maybeSmInt: Int? = if (rng > 5) rng else null
            val safeSmlInt: Int = maybeInt ?: throw RuntimeException("not a sm int!!") <-- tree-sitter-kolin crashes here when trying to provide/type out an error message
            return "Hello World!"
        }
}

fun main() {
    println(App().greeting)
}
Screen.Recording.2024-07-30.at.18.20.16.mov
@fwcd
Copy link
Owner

fwcd commented Aug 1, 2024

This repo only contains the grammar, so there is very little surface for things to crash outside of maybe the external scanner. Your example seems to work fine in the web playground. Have you tried filing the issue with the devs of the Neovim extension that integrates tree-sitter-kotlin?

@covelloz
Copy link
Author

covelloz commented Aug 1, 2024

@fwcd it very well could be nvim-treesitter itself. Given that it works in the web playground - I would assume you're probably correct. I will close this & post it over there. Thanks for the sanity check!

@covelloz covelloz closed this as completed Aug 1, 2024
@fwcd
Copy link
Owner

fwcd commented Aug 3, 2024

Perhaps it was the external scanner after all, #136 fixed a segfault in the deserialization logic. Could you check whether tree-sitter-kotlin 0.3.8 fixes the issue for you?

@covelloz
Copy link
Author

covelloz commented Aug 6, 2024

@fwcd I can confirm that the issue is no longer happening after running :TSUpdate & updating the Kotlin parser. Looks like issue is fixed as of 0.3.8!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants