Skip to content

Improve source_loc - #1527

Merged
jonludlam merged 5 commits into
ocaml:masterfrom
art-w:source-loc
Nov 26, 2026
Merged

jonludlam merged 5 commits into
ocaml:masterfrom
art-w:source-loc

Conversation

@art-w

@art-w art-w commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

This PR is an extract from #1520 by @avsm of only the commits related to improving source locations. Some changes:

  • fixed @Alizter's review regarding loc_end (which dropped the need for this commit 7d83062 updating the test for a wrong output)
  • dropped the introduction of Source_loc_jane, which we could still add later but currently it's unused in odoc
  • added a new test for mutually recursive type locations, to validate ox9 custom code there

@Leonidas-from-XIV Leonidas-from-XIV left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for factoring out this improvement, it makes reviewing the change easier! My comments are mostly about understandability for me and future readers of the code.

Comment thread src/xref2/shape_reducer.cppo.ml Resolved
Comment thread test/sources/mutrec_types.t/run.t Resolved
Comment thread test/sources/mutrec_types.t/run.t Resolved
@art-w art-w mentioned this pull request Nov 23, 2026
@jonludlam

Copy link
Copy Markdown
Member

I've been going back and forth a bit about this PR. It's adding a new feature with no obvious consumers, and it's a little bit potentially misleading, as seeing cnum and lnum might lead one to think they're column and line, but they're not! And the bit that would otherwise tie them together (bol) isn't there at all.

Having said that, the lnum field can serve a good purpose (and indeed does at JS) of allowing e.g. a search index to link to the line(s) being referenced. So I guess this is OK.

@jonludlam
jonludlam merged commit 11ecf0a into ocaml:master Nov 26, 2026
14 checks passed
@jonludlam

Copy link
Copy Markdown
Member

Sorry, that sounded pretty negative - it was more a comment on this as a standalone piece of work than on the efforts that people have put in. Thanks @art-w and everyone else! :-)

@jonludlam jonludlam mentioned this pull request Nov 26, 2026
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

Successfully merging this pull request may close these issues.

5 participants