Problem
galaxyscope.extract_raw_imports handles a brace-selector import by deleting the braces and then splitting on commas. So
import io.circe.{ Decoder, Json }
records the tokens io.circe. Decoder (with a space) and a bare Json. Neither resolves: the first carries a space, and the second has lost its package. Rust's use a::{b, c} goes through the same code.
Measured
tests/tools/import_graph_accuracy.py scala (circe/circe, added in #3594): precision 99.4%, recall 33.0%, 674 missed imports. Examples from TodoService.scala and AtBenchmark.scala:
io.circe.{ DecodingFailure, Errors } → Errors and io.circe. DecodingFailure
io.circe.{ Decoder, Json } → Json and io.circe. Decoder
Fix direction
In extract_raw_imports, expand prefix{a, b => c, _} into prefix + each selector before the comma split:
- the prefix is everything before
{, keeping its trailing . or ::;
b => c keeps b;
_ and * are wildcards.
This helps both Scala and Rust. Some of the remaining Scala misses are wildcard imports of package objects (io.circe.syntax._ → syntax/package.scala), which need a resolver rule; check them with --samples after the split fix.
Problem
galaxyscope.extract_raw_importshandles a brace-selector import by deleting the braces and then splitting on commas. Sorecords the tokens
io.circe. Decoder(with a space) and a bareJson. Neither resolves: the first carries a space, and the second has lost its package. Rust'suse a::{b, c}goes through the same code.Measured
tests/tools/import_graph_accuracy.py scala(circe/circe, added in #3594): precision 99.4%, recall 33.0%, 674 missed imports. Examples fromTodoService.scalaandAtBenchmark.scala:io.circe.{ DecodingFailure, Errors }→Errorsandio.circe. DecodingFailureio.circe.{ Decoder, Json }→Jsonandio.circe. DecoderFix direction
In
extract_raw_imports, expandprefix{a, b => c, _}intoprefix+ each selector before the comma split:{, keeping its trailing.or::;b => ckeepsb;_and*are wildcards.This helps both Scala and Rust. Some of the remaining Scala misses are wildcard imports of package objects (
io.circe.syntax._→syntax/package.scala), which need a resolver rule; check them with--samplesafter the split fix.