Skip to content

Conversation

@Julow
Copy link
Collaborator

@Julow Julow commented Apr 6, 2021

These references need to be resolved from their containing module's environment, which is only available when linking that module.
This PR adds a warning in case a reference is found and doesn't try to resolve it.

It should be possible to resolve some fully-qualified references using the available environment as a best-effort and to resolve references local to their parent module. That PR doesn't try that.

Rebased on top of #654

Julow added 2 commits April 15, 2021 19:09
This is no longer used since parser tests were rewritten as
expect-tests.
@Julow Julow force-pushed the modules-lists-syn branch from 36ea0c9 to bb406ea Compare April 16, 2021 14:21
{"`Root":["M","`TUnknown"]}
{"`Dot":[{"`Root":["M","`TUnknown"]},"t"]}
{"`Resolved":{"`Identifier":{"`Root":[{"`RootPage":"test"},"M"]}}}
{"`Resolved":{"`Type":[{"`Identifier":{"`Root":[{"`RootPage":"test"},"M"]}},"t"]}}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This changed because I've added back the missing M module. I think that's how the test was intended to be.


module Resolve_synopsis : sig
(** This should be resolved when included: {!Main.Resolve_synopsis.t}. These
shouldn't: {!t} {!Resolve_synopsis.t} *)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It should be easy to resolve these two references:

  • Add the target module to the new env
  • Open it

How sound it is ?

Copy link
Member

Choose a reason for hiding this comment

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

Let's leave this as an issue to resolve later - we need to discuss the various options available to us.

@Julow Julow marked this pull request as ready for review April 16, 2021 14:32
@Julow
Copy link
Collaborator Author

Julow commented Apr 16, 2021

I implemented best-effort resolving of fully-qualified references encountered in the synopsis.

There were no error reported when a reference failed to resolve so I've added one and attached some information to it when it happens while resolving a synopsis. The result is quite verbose but don't trigger fatal warnings, it'll need to be improved later. (errors need to be propagated while resolving the references)

Attempt to resolve references in synopses using a empty environment.
Fully-qualified references should resolve.

Removes the previous warning when a reference was encountered.
@Julow Julow force-pushed the modules-lists-syn branch from bb406ea to 31da4fb Compare April 19, 2021 15:30
@Julow
Copy link
Collaborator Author

Julow commented Apr 19, 2021

I've removed the warning code. (#664)

@Julow Julow changed the title Don't resolve references in synopses in {!modules} lists Resolve some references in synopses in {!modules} lists Apr 19, 2021
@jonludlam jonludlam merged commit e5a2c31 into ocaml:master May 9, 2021
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.

2 participants