Skip to content
New issue

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

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

Already on GitHub? # to your account

Binding ident has incorrect span with type annotation #9290

Closed
dsherret opened this issue Jul 19, 2024 · 2 comments
Closed

Binding ident has incorrect span with type annotation #9290

dsherret opened this issue Jul 19, 2024 · 2 comments
Labels
Milestone

Comments

@dsherret
Copy link
Contributor

Describe the bug

Binding identifier span doesn't include the type annotation. See here how it's 20-21:

"pat": {
            "type": "Identifier",
            "span": {
              "start": 20,
              "end": 21
            },
            "ctxt": 3,
            "value": "a",
            "optional": false,
            "typeAnnotation": {
              "type": "TsTypeAnnotation",
              "span": {
                "start": 21,
                "end": 29
              },
              "typeAnnotation": {
                "type": "TsKeywordType",
                "span": {
                  "start": 23,
                  "end": 29
                },
                "kind": "number"
              }
            }
          }

Input code

function test(
    a: number
) {}

Config

No response

Playground link (or link to the minimal reproduction)

https://play.swc.rs/?version=1.7.0&code=H4sIAAAAAAAAA0srzUsuyczPUyhJLS7R4OVSAIJEK4W80tyk1CJeLk2F6loAKw2U9iMAAAA%3D&config=H4sIAAAAAAAAA21QOw7CMAzde4rKMwPqwMAdmDiBFVwU1HxkOxJV1buTtA0tEksUv4%2Bf7alpW3iJgWs75W8uIrIQf%2BuMyOgV3xkBHSOJYRsVTpVVKVSPg9ACzSsDivwkLS6S7tx1mwOGEISqY8Oc9bYfj5kmuMgk8issUvTPgf4nMnrpA7tjIyY0egAyZF0MrPeQ2JRG4KO7rrLTLuLk1bqFx6TBoVoDGz039V2iwYVHWmbaTljOtC5%2BgV1Ud%2FzuA1Zu1amcqJk%2FtsEHsI4BAAA%3D

SWC Info output

No response

Expected behavior

Should include the type annotation

Actual behavior

It only includes the identifier

Version

1.7.0

Additional context

No response

@dsherret
Copy link
Contributor Author

dsherret commented Jul 19, 2024

Hmmm... I just noticed that the json output doesn't have a span specific to the ident. I feel like it should. Maybe the JSON output is considered correct and only the rust span is wrong.

@kdy1 kdy1 added this to the Planned milestone Jul 19, 2024
@kdy1 kdy1 closed this as completed in 2b32481 Jul 19, 2024
@kdy1 kdy1 modified the milestones: Planned, v1.7.1 Jul 23, 2024
@swc-bot
Copy link
Collaborator

swc-bot commented Aug 22, 2024

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Aug 22, 2024
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Development

No branches or pull requests

3 participants