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

if let chain has a weird behaviour #1033

Closed
Tracked by #1035
GuillaumeGomez opened this issue May 7, 2024 · 2 comments · Fixed by #1037
Closed
Tracked by #1035

if let chain has a weird behaviour #1033

GuillaumeGomez opened this issue May 7, 2024 · 2 comments · Fixed by #1037

Comments

@GuillaumeGomez
Copy link
Collaborator

I expected this code:

{%- if let Some(query) = search_query && !query.is_empty() %}

To either emit an error about the && after if let Some or to work, instead it generated:

if let Some(query,) = &(search_query && !self.query.is_empty()) {

Which is a very unexpected in-between.

I think it should generate if let Some(query) = search_query && !self.query.is_empty(). What do you think?

@djc
Copy link
Collaborator

djc commented May 7, 2024

I think it should generate if let Some(query) = search_query && !self.query.is_empty(). What do you think?

That certainly looks more sensible!

@djc djc mentioned this issue May 7, 2024
7 tasks
@GuillaumeGomez
Copy link
Collaborator Author

Another interesting bug coming from if let: the binding var (query in this case) is not recognized as such.

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