Skip to content

fix: Elaborate the source body in getFileEnv#456

Merged
samuelburnham merged 2 commits into
mainfrom
fix-getfileenv
Jun 27, 2026
Merged

fix: Elaborate the source body in getFileEnv#456
samuelburnham merged 2 commits into
mainfrom
fix-getfileenv

Conversation

@samuelburnham

Copy link
Copy Markdown
Member

This allows ix compile input.lean to include constants from input.lean itself, rather than just its imports.

`getFileEnv` ran only `processHeaderCore`, so the returned environment
held the file's imports but none of its own definitions. As a result
`ix compile foo.lean` produced an env without foo's constants, and
`--only-const <name>` over the resulting `.ixe` could not resolve any
name defined in the source file (e.g. `myReflEq` in MinimalDefs).

Run the body through `IO.processCommands` (as `runFrontend` does) so the
environment includes the file's definitions. Also fixes `ix validate`
and `ix ingress`, which share `getFileEnv`.
Adds `Tests.Ix.EnvBody`, run in the default suite: it loads the existing
`Tests/Ix/Fixtures/Export.lean` fixture via `getFileEnv` and asserts its
body definition (`inductive MyNat`) is present, alongside an imported
constant (`Nat`). The body assertion is red under the header-only
regression and green with the body-elaboration fix.
@samuelburnham samuelburnham merged commit 0f8eef5 into main Jun 27, 2026
14 checks passed
@samuelburnham samuelburnham deleted the fix-getfileenv branch June 27, 2026 15:35
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