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

fix tag function location on error #6816

Merged
merged 1 commit into from
Jun 17, 2024
Merged

fix tag function location on error #6816

merged 1 commit into from
Jun 17, 2024

Conversation

tsnobip
Copy link
Contributor

@tsnobip tsnobip commented Jun 17, 2024

Today the location of tag function is not reported in the compiler error/editor extension:

We've found a bug for you!
jscomp/build_tests/super_errors/fixtures/unknown_tagged_template_function.res

The value tagg can't be found
  
Hint: Did you mean tag?

Now it does track it:

We've found a bug for you!
jscomp/build_tests/super_errors/fixtures/unknown_tagged_template_function.res:1:11-14

1 │ let res = tagg`| 5 × 10 = ${5} |`

The value tagg can't be found

Copy link
Collaborator

@zth zth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

(Location.mknoloc lident)
in
let gen_tagged_template_call (lident_loc : Longident.t Location.loc) =
let ident = Ast_helper.Exp.ident ~attrs:[] ~loc:lident_loc.loc lident_loc in
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this didn't make any difference

@@ -2334,7 +2329,7 @@ and parse_template_expr ?prefix p =
in
Ast_helper.Exp.apply
~attrs:[tagged_template_literal_attr]
~loc:(mk_loc start_pos end_pos) ident
~loc:lident_loc.loc ident
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the real fix is here

@tsnobip tsnobip merged commit 6e22765 into master Jun 17, 2024
19 checks passed
@tsnobip tsnobip deleted the fix_tag_function_loc branch June 17, 2024 10:03
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 this pull request may close these issues.

2 participants