Skip to content
This repository was archived by the owner on Apr 27, 2022. It is now read-only.

Conversation

@rhysd
Copy link

@rhysd rhysd commented Jan 3, 2020

Hi,

thank you for exciting new-year present! I tried the measurement code in README.md on my local and noticed it caused an error as follows:

E1017: Variable already declared: sum

Though I'm not fully understanding the grammar, it seems that let is used for declaration in new syntax. is_decl is set to true on :let or :const so I guess assignment to existing variable should be in var = expr style.

if (is_decl)

After this fix above E1017 no longer occurred.

@rhysd rhysd force-pushed the vim9-fix-measure-code branch from 506fea0 to 48a5cbd Compare January 3, 2020 03:55
@rhysd rhysd changed the title Fix measurement code causes E1017 Fix measurement code causes E1017 and type mismatch Jan 3, 2020
@rhysd
Copy link
Author

rhysd commented Jan 3, 2020

I also found that the measurement code still caused a type error because return type was not set to VimNew.

It seems that function return type is void by default here if type annotation is missing:

fp->uf_ret_type = &t_void;

And VimNew returns number so its return type must be typed. After this fix, I confirmed the measurement code runs correctly. And vim9 is far faster! 👍

4499998500000
Vim old:   6.321314
4499998500000
Vim new:   0.138511

> E1017: Variable already declared: sum
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant