Skip to content

fix parsing of bare open: do not load modules as require open does#1450

Merged
fblanqui merged 2 commits into
Deducteam:masterfrom
ciaran-matthew-dunne:pr/bare-open
Jul 9, 2026
Merged

fix parsing of bare open: do not load modules as require open does#1450
fblanqui merged 2 commits into
Deducteam:masterfrom
ciaran-matthew-dunne:pr/bare-open

Conversation

@ciaran-matthew-dunne

Copy link
Copy Markdown
Contributor

Since the LL(1) parser rework (#1441, 078dba4), a bare [private] open M; is parsed as P_require(Some private?, ...) — the same AST as require [private] open M;. Consequently:

  • open M; silently requires M when it is not yet loaded, instead of failing with Module "M" needs to be required first.Handle.Command.handle_open became unreachable, since no parser constructed P_open anymore;
  • the lp export prints open M; back as require open M;.

This PR restores P_open for the bare forms (open, private open), keeps P_require for the require forms, and adds a KO test (open of a module that was not required). No change to the grammar itself.

A bare open (not preceded by require) was parsed as require open
since the LL(1) parser rework (Deducteam#1441), silently loading not yet
required modules instead of failing, and pretty-printing back as
require open.
@sacerdot

sacerdot commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Yes, my bad!

@fblanqui fblanqui merged commit 3a1bf4f into Deducteam:master Jul 9, 2026
24 checks passed
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.

3 participants