{{ message }}
fix(compiler-cli): more accurate diagnostics for host binding parser errors#58870
Closed
crisbeto wants to merge 1 commit into
Closed
fix(compiler-cli): more accurate diagnostics for host binding parser errors#58870crisbeto wants to merge 1 commit into
crisbeto wants to merge 1 commit into
Conversation
JoostK
approved these changes
Nov 25, 2024
JoostK
left a comment
Member
There was a problem hiding this comment.
One additional gotcha here could be for duplicate host binding expressions; they would report individual errors for each occurrence, but will then all get reported on the first host binding occurrence.
Overall this still seems like an improvement 👍
Member
Author
…errors Currently host bindings are in a bit of a weird state, because their source spans all point to the root object literal, rather than the individual expression. This is tricky to handle at the moment, because the object is being passed around as a `Record<string, string>` since the compiler needs to support both JIT and non-JIT environments, and because the AOT compiler evaluates the entire literal rather than doing it expression-by-expression. As a result, when we report errors in one of the host bindings, we end up highlighting the entire expression which can be very noisy in an IDE. These changes aim to report a more accurate error for the most common case where the `host` object is initialized to a `string -> string` object literal by matching the failing expression to one of the property initializers. Note that this isn't 100% reliable, because we can't map cases like `host: SOME_CONST`, but it's still better than the current setup.
8abee16 to
119877b
Compare
thePunderWoman
pushed a commit
that referenced
this pull request
Nov 25, 2024
…errors (#58870) Currently host bindings are in a bit of a weird state, because their source spans all point to the root object literal, rather than the individual expression. This is tricky to handle at the moment, because the object is being passed around as a `Record<string, string>` since the compiler needs to support both JIT and non-JIT environments, and because the AOT compiler evaluates the entire literal rather than doing it expression-by-expression. As a result, when we report errors in one of the host bindings, we end up highlighting the entire expression which can be very noisy in an IDE. These changes aim to report a more accurate error for the most common case where the `host` object is initialized to a `string -> string` object literal by matching the failing expression to one of the property initializers. Note that this isn't 100% reliable, because we can't map cases like `host: SOME_CONST`, but it's still better than the current setup. PR Close #58870
Contributor
|
This PR was merged into the repository by commit 4e92449. The changes were merged into the following branches: main, 19.0.x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Currently host bindings are in a bit of a weird state, because their source spans all point to the root object literal, rather than the individual expression. This is tricky to handle at the moment, because the object is being passed around as a
Record<string, string>since the compiler needs to support both JIT and non-JIT environments, and because the AOT compiler evaluates the entire literal rather than doing it expression-by-expression. As a result, when we report errors in one of the host bindings, we end up highlighting the entire expression which can be very noisy in an IDE.These changes aim to report a more accurate error for the most common case where the
hostobject is initialized to astring -> stringobject literal by matching the failing expression to one of the property initializers. Note that this isn't 100% reliable, because we can't map cases likehost: SOME_CONST, but it's still better than the current setup.Before:

After:
