Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid expression: .pat..'$' #67

Closed
apemost opened this issue Feb 25, 2021 · 4 comments · Fixed by #68
Closed

Invalid expression: .pat..'$' #67

apemost opened this issue Feb 25, 2021 · 4 comments · Fixed by #68

Comments

@apemost
Copy link
Contributor

apemost commented Feb 25, 2021

environment

  • vim: VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Mar 18 2020 18:29:15) Included patches: 1-1453
  • OS: Ubuntu 18.04

actual behavior

Error detected while processing function illuminate#on_cursor_moved[1]..<SNR>223_should_illuminate_file[4]..<SNR>223_list_contains_pat:
line    2:
E15: Invalid expression: .pat..'$'
Error detected while processing function illuminate#on_cursor_moved[1]..<SNR>223_should_illuminate_file[4]..<SNR>223_list_contains_pat:
line    2:
E15: Invalid expression: a:val =~# '^'..pat..'$'

expected behavior

No errors.

screen shot (if possible)

image

@apemost
Copy link
Contributor Author

apemost commented Feb 25, 2021

Lua offers a string concatenation operator, denoted by "..", but strings can be concatenated with "." in vimscript:

:echo "foo" . "bar"
foobar 

@RRethy
Copy link
Owner

RRethy commented Feb 25, 2021

String concatenation can be done in vimscript with ...

https://vimhelp.org/eval.txt.html#expr6:

For String concatenation ".." is preferred, since "." is ambiguous, it is also
used for |Dict| member access and floating point numbers.

The vim help you linked is for version 7.3.

It seems you are using an early 8.0 version which doesn't have this upgrade in the expression parsing, I'll merge the change, but you need to upgrade your Vim version since many plugins devs (and myself) won't go out of our way to support old version of Vim (5 years old in this case).

@apemost
Copy link
Contributor Author

apemost commented Feb 25, 2021

Can we add a compatibility check?

Patch 8.1.1114
Problem: Confusing overloaded operator "." for string concatenation.
Solution: Add ".." for string concatenation. Also "let a ..= b".
Files: src/eval.c, src/testdir/test_eval_stuff.vim, runtime/doc/eval.txt

@RRethy
Copy link
Owner

RRethy commented Feb 25, 2021

Compatibility check wouldn't be beneficial since it's adding a lot of logic (check for patch for Neovim and Vim) while the reward is just syntactical.

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 a pull request may close this issue.

2 participants