Repository navigation
Skip files the Kotlin analysis cannot handle, and always exit - #1038
Open
ofir-blaus wants to merge 1 commit into
Open
ofir-blaus wants to merge 1 commit into
ofir-blaus wants to merge 1 commit into
Conversation
A top-level destructuring declaration in a .kt file (`val (a, b) = ...`) is not valid Kotlin, so the Analysis API has no FIR for it, and asking for its type threw "No fir element was found for KtDestructuringDeclaration". That exception aborted the whole run. Afterwards a non-daemon pooled thread kept the JVM alive, so the process hung instead of exiting. - Skip a top-level destructuring declaration instead of resolving it. - If indexing a file throws, skip that file (no shard, one line on stderr) and keep indexing the rest. - Exit with status 1 when the run fails, so the process never hangs. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Small fix on top of #963.
Problem: a
.ktfile with a top-level destructuring declaration (val (a, b) = Pair(1, 2)) crashes the indexer withNo fir element was found for KtDestructuringDeclaration. The whole run is lost. Then the process hangs instead of exiting, because a non-daemon thread keeps the JVM alive. We hit this on a test fixture in a real repo. The code is invalid Kotlin, but it can still show up in a source tree.Reproduction: two files.
The command, run from the folder with
src/:Before (
kotlin-analysis-api@ a77e133): the indexer crashes, writes no output for either file, and never exits. It was still running after 25 seconds, and the thread dump shows a non-daemonApplicationImpl pooled threadwaiting forever:After (this PR): exit 0 in about 1 second, with output for both files:
Fix:
Tests:
:scip-kotlin-analysis:testpasses, andspotlessCheckpasses.:scip-snapshots:test: all Kotlin snapshots pass. Locally I see 17 Java snapshot failures, but the same 17 fail onkotlin-analysis-apiwithout this change. My local JDK is 21, not 17.🤖 Generated with Claude Code