Semantic Diff

#9337 Tell interface files from implementation files again in editor analysis

1 commit

0b2246c4185d068520d3708f84cab8c73ea5f7d7..pr-9337

8aa74ec3f · cknitt + Claude · Nov 19, 2026, 17:01 UTC

Tell interface files from implementation files again in editor analysis

Why

Since #8436, Uri.is_interface passes its arguments to Filename.check_suffix in the wrong order, so it always returns false. Editor analysis then pairs a .resi declaration with itself instead of with its .res side: references list the .resi location twice and miss the .res one, rename edits the .resi twice and leaves the .res unchanged, and go to definition from a .resi declaration stays in the interface.

modifiedReferences a value with an interface

// ReferencesWithInterface.reslet x = 2// ReferencesWithInterface.resilet x: int
text
Before references of x from the .resi
After references of x from the .resi
……ReferencesWithInterface.resi 0:4ReferencesWithInterface.resi 0:4ReferencesWithInterface.resi 0:4ReferencesWithInterface.res 0:4

modifiedDefinition from a declaration in a .resi

text
Before tests/analysis_tests/tests/src/DefinitionWithInterface.resi
After tests/analysis_tests/tests/src/DefinitionWithInterface.resi
DefinitionWithInterface.resiDefinitionWithInterface.res

Review

  • Why String.ends_with ~suffix:Literals.suffix_resi? Its labeled argument cannot be swapped the way the positional arguments of Filename.check_suffix were, and the compiler's .resi constant says what is meant. It tests the URI's path (Lsp.Uri.to_path), which ignores query and fragment, instead of the whole encoded URI. Shared_types.get_cmt_path, which picks the .cmti for an interface URI, had its own copy of the test and now calls Uri.is_interface.
  • Which snapshots change? Cross, DefinitionWithInterface.resi, Jsx2, References, ReferencesWithInterface.resi and RenameWithInterface.resi: each duplicate .resi entry becomes the .res entry, and definitions from a .resi reach the implementation, as they did before #8436.