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

Comments break if else chains #55954

Closed
Ookamini95 opened this issue May 21, 2024 · 4 comments
Closed

Comments break if else chains #55954

Ookamini95 opened this issue May 21, 2024 · 4 comments
Assignees
Labels
area: compiler Issues related to `ngc`, Angular's template compiler compiler: parser core: control flow Issues related to the built-in control flow (@if, @for, @switch) P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent state: has PR
Milestone

Comments

@Ookamini95
Copy link

Ookamini95 commented May 21, 2024

Which @angular/* package(s) are the source of the bug?

Don't known / other

Is this a regression?

Don't known / other

Description

    @if(foo1) {
      // something
    }
    <!-- TODO: totally legit todo -->
    @else if (foo2) {
       // something
    }

i get error:
@else if block can only be used after an @if or @else if block.

expected behaviour : ignores comment

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

@else if block can only be used after an @if or @else if block.

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 17.3.2
Node: 20.10.0
Package Manager: npm 10.3.0
OS: win32 x64

Angular: 17.3.2
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1703.2
@angular-devkit/build-angular   17.3.2
@angular-devkit/core            17.3.2
@angular-devkit/schematics      17.3.2
@schematics/angular             17.3.2
rxjs                            7.8.1
typescript                      5.3.3
zone.js                         0.14.4

Anything else?

If pointed to the right file i may be able to provide a pr (beginner here)

@JoostK JoostK added the core: control flow Issues related to the built-in control flow (@if, @for, @switch) label May 21, 2024
@JoostK
Copy link
Member

JoostK commented May 21, 2024

It would likely be similar to #52449, but I suppose @crisbeto has a fix faster than the blink of an eye.

@JoostK JoostK added area: compiler Issues related to `ngc`, Angular's template compiler P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent compiler: parser labels May 21, 2024
@ngbot ngbot bot modified the milestone: Backlog May 21, 2024
crisbeto added a commit to crisbeto/angular that referenced this issue May 21, 2024
Fixes that the logic which looks for connected blocks didn't allow for comments between them.

Fixes angular#55954.
@crisbeto crisbeto self-assigned this May 21, 2024
@Ookamini95
Copy link
Author

It would likely be similar to #52449, but I suppose @crisbeto has a fix faster than the blink of an eye.

Thanks for the fast response, and sorry for the duplicate, it's my first actual bug report and was eager to share.

@JoostK
Copy link
Member

JoostK commented May 21, 2024

It's not a duplicate, only a link to a prior PR that started to account for comments in some places, but not this one.

dylhunn pushed a commit that referenced this issue May 21, 2024
Fixes that the logic which looks for connected blocks didn't allow for comments between them.

Fixes #55954.

PR Close #55966
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jun 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: compiler Issues related to `ngc`, Angular's template compiler compiler: parser core: control flow Issues related to the built-in control flow (@if, @for, @switch) P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent state: has PR
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants