Summary
I found this panic using a fuzzer. It only happens on debug bulids. The following is a minimal reproduction:
#[test]
fn no_panic_argument_completion_before_paren() {
let builder = completion_test_builder(
r#"
list[int]<CURSOR>()
#",
);
assert_snapshot!(
builder.skip_keywords().skip_builtins().skip_auto_import().build().snapshot(),
@"<No completions found after filtering out completions>",
);
}
The debug assert that is causing the panic is here:
https://github.com/astral-sh/ruff/blob/ffeee66dfaf1b4fb1200be2bf8443fcc03e9258e/crates/ty_ide/src/completion.rs#L1474
This checks that we are in an Arguments node. But the caller is only checking if the cursor is within the range for Arguments node.
But I'm not familiar with this part of code so I also removed the debug assert to see if anything strange would happen. The test passes with no completions.
So this is why I opened this issue I wanted to fix it but I also don't know what's the best way because I didn't understand the intent of the code.
Version
No response
Summary
I found this panic using a fuzzer. It only happens on debug bulids. The following is a minimal reproduction:
The debug assert that is causing the panic is here:
https://github.com/astral-sh/ruff/blob/ffeee66dfaf1b4fb1200be2bf8443fcc03e9258e/crates/ty_ide/src/completion.rs#L1474
This checks that we are in an Arguments node. But the caller is only checking if the cursor is within the range for Arguments node.
But I'm not familiar with this part of code so I also removed the debug assert to see if anything strange would happen. The test passes with no completions.
So this is why I opened this issue I wanted to fix it but I also don't know what's the best way because I didn't understand the intent of the code.
Version
No response