Zulip Chat Archive

Stream: general

Topic: Universe binder syntax


Eric Wieser (May 26 2021 at 10:20):

I was surprised to find that {u} binder syntax works for some commands but not others:

-- ok
def {w} foo1 {Q : Type w} := Q
abbreviation {w} foo2 {Q : Type w} := Q
lemma {w} foo3 {Q : Type w} : Type w := Q
-- fail
instance {w} foo4 {Q : Type w} : Type w := Q

Is this deliberate?

Gabriel Ebner (May 26 2021 at 10:21):

Eric Wieser said:

Is this deliberate?

No.

Eric Wieser (May 26 2021 at 10:22):

Edited, I screwed up on the lemma one.

Eric Wieser (May 26 2021 at 10:22):

I guess the problem with instance is that you then don't know how to parse

instance {w} {Q : Type w} : Type w := Q

Eric Wieser (May 26 2021 at 10:30):

I'm asking these because the new syntax highlighter gets highlighting slightly wrong on instance {R : Type}

Eric Wieser (May 26 2021 at 11:19):

leanprover/vscode-lean#269

Eric Rodriguez (May 26 2021 at 13:30):

@Eric Wieser , these get messed up by }} brackets:

image.png

Eric Wieser (May 26 2021 at 14:06):

Can you paste a mwe so that I can debug?

Eric Wieser (May 26 2021 at 14:11):

Ah, it's an easy fix - the binder name regex seems to think is allowed as part of an unquoted name

Eric Wieser (May 26 2021 at 14:12):

That is, these patterns need to include that character in their forbidden-symbol list:

https://github.com/leanprover/vscode-lean/blob/master/syntaxes/lean.json#L225-L236

Eric Rodriguez (May 26 2021 at 14:13):

you're fast - didn't even finish writing the MWE in time!

Bhavik Mehta (May 26 2021 at 14:47):

Is this fix in the process of being PR'd? I'm hitting this a lot today :(

Eric Wieser (May 26 2021 at 14:48):

Is it the same bug?

Eric Wieser (May 26 2021 at 14:49):

I haven't gotten around to Pring it, but it's a 4-charcter fix

Bhavik Mehta (May 26 2021 at 14:50):

It seems like it, yeah, everything after a }} looks completely broken in my VSCode

Eric Wieser (May 26 2021 at 14:50):

Will PR it now

Bhavik Mehta (May 26 2021 at 14:51):

Thanks!

Eric Wieser (May 26 2021 at 14:52):

https://github.com/leanprover/vscode-lean/pull/270


Last updated: Dec 20 2023 at 11:08 UTC