Skip to content

fix import name generation#19

Closed
mo271 wants to merge 1 commit into
leanprover:masterfrom
mo271:import_fix
Closed

fix import name generation#19
mo271 wants to merge 1 commit into
leanprover:masterfrom
mo271:import_fix

Conversation

@mo271
Copy link
Copy Markdown

@mo271 mo271 commented Feb 13, 2026

this potentially fixes handling of filenames starting with number, for more details see leanprover/comparator#17

Comment thread Main.lean Outdated
let (imports, constants) := args.span (· != "--")
let imports := imports.toArray.map fun mod => { module := Syntax.decodeNameLit ("`" ++ mod) |>.get! }
let imports := imports.toArray.map fun mod => {
module := mod.splitOn "." |>.foldl Name.mkStr .anonymous
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This looks wrong to me, dots are allowed in french quotes.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think String.toName is what you want instead.

@eric-wieser
Copy link
Copy Markdown

Can you add a test?

@mo271
Copy link
Copy Markdown
Author

mo271 commented May 19, 2026

closing in favour of leanprover/comparator#40

I think the code here is doing the right thing, it just could be done slighly nicer with .toName, but I haven't found a case where it is wrong.

@mo271 mo271 closed this May 19, 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.

2 participants