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

More math parenthesis errors #7508

Closed
mqudsi opened this issue Nov 26, 2020 · 2 comments
Closed

More math parenthesis errors #7508

mqudsi opened this issue Nov 26, 2020 · 2 comments

Comments

@mqudsi
Copy link
Contributor

mqudsi commented Nov 26, 2020

This time, when forgetting to use a $ for variables:

mqudsi@studiog3 ~/fish-shell (regex_import) [127]> math n + 1
math: Error: Missing opening parenthesis
'n + 1'
   ^
@faho
Copy link
Member

faho commented Nov 26, 2020

This assumes "n" is a function.

We should probably check if it's a valid function name before we complain about the syntax.

But if you used e. g. "sin" instead complaining about the parens would be totally valid.

@faho faho added this to the fish-future milestone Nov 26, 2020
@faho
Copy link
Member

faho commented Nov 26, 2020

Okay, it turns out we did check if it's a valid function name, but the check only compared up to the length of the given token, so it would assume "n" is equal to "ncr".

That means technically math 'n(2,3)' is equivalent to math 'ncr(2,3)'.

Yeah, we're changing that.

faho added a commit that referenced this issue Nov 26, 2020
The comparison here is a bit naive, so "n" matches "ncr", so
technically

   math 'n(2, 3)'

is equivalent to

   math 'ncr(2, 3)'

Work towards #7508.
@faho faho closed this as completed in a14e64e Nov 26, 2020
@faho faho modified the milestones: fish-future, fish 3.2.0 Nov 26, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants