Skip to content

Assorted delaborator fixes - #941

Merged
Kha merged 3 commits into
leanprover:masterfrom
gebner:delabexplicit
Jan 12, 2022
Merged

Kha merged 3 commits into
leanprover:masterfrom
gebner:delabexplicit

Conversation

@gebner

@gebner gebner commented Jan 11, 2022

Copy link
Copy Markdown
Member

I was also confused by the error message in #939, where we print @ [] (?m x), which is fairly cryptic syntax and doesn't even roundtrip.

The reason for this is that the setAppPPExplicitForExposingMVars function adds metadata constructors to the application itself, the arguments, and the function symbol. The delabAppExplicit function then doesn't recognize the head symbol as a constant (because it is wrapped in an mdata constructor), and calls delab which in turn calls delabAppImplicit which helpfully prints @List.nil as [].

This PR 1) makes delabAppExplicit recognize mdata (const ...) as a head symbol, and 2) delaborates the constant @nil to @nil.

The latter change might be a bit controversial, since we often use constants in messages to refer to the declaration name and not an elaboratable expression, e.g. TC traces print something like m!"global instances {insts}", where insts : List Expr is a list of constants. These declaration names now get an extra @. I think the @ is important for expressions because otherwise you cannot distinguish @Eq and Eq, but maybe we should add an explicit way to include clickable constant names in messages.

@leodemoura
leodemoura self-requested a review January 11, 2022 19:56
@Kha
Kha merged commit 50abc3e into leanprover:master Jan 12, 2022
@Kha Kha mentioned this pull request Jan 18, 2022
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