sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Store the static type on TypeState

Open mattrbeck opened this issue 1 year ago • 3 comments

This allows users to access the static type of a DartObject through DartObject#toStaticTypeValue.

I'm not sure whether this is the best approach or whether it'll solve all future use-cases. I suspect it might be nicer to instead have the TypeState maintain the static type as the default "type value" and have the analyzer erase the types for comparison when necessary. At least as a maintainer of Angular, I feel like I only really care about the static type while the runtime type isn't particularly useful to me.

Please let me know if you think there's a better way to address https://github.com/dart-lang/sdk/issues/55693 or if you think this won't cover it.

For an example in use, see cl/639257690.

Apologies in advance if this PR is formatted weirdly. This is the first time I've used the built-in editor in GitHub.

mattrbeck avatar Jun 01 '24 05:06 mattrbeck

Thank you for your contribution! This project uses Gerrit for code reviews. Your pull request has automatically been converted into a code review at:

https://dart-review.googlesource.com/c/sdk/+/369280

Please wait for a developer to review your code review at the above link; you can speed up the review if you sign into Gerrit and manually add a reviewer that has recently worked on the relevant code. See CONTRIBUTING.md to learn how to upload changes to Gerrit directly.

Additional commits pushed to this PR will update both the PR and the corresponding Gerrit CL. After the review is complete on the CL, your reviewer will merge the CL (automatically closing this PR).

copybara-service[bot] avatar Jun 01 '24 05:06 copybara-service[bot]

I'm not sure this is sufficient. It likely covers the case where we have a const of Foo where Foo is an extension type, but it may not work where we have a Parameterized<Foo>..

mattrbeck avatar Jun 01 '24 22:06 mattrbeck

https://dart-review.googlesource.com/c/sdk/+/369280 has been updated with the latest commits from this pull request.

copybara-service[bot] avatar Jun 21 '24 16:06 copybara-service[bot]

Closing in favor of https://github.com/dart-lang/sdk/issues/56118, which provides more detail and doesn't try to prescribe a solution

mattrbeck avatar Jul 01 '24 18:07 mattrbeck