-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[cfe/analyzer] No error when extension type Type
is duplicated with its underlying type's in constant sets and maps
#53918
Comments
Type
is duplicated with its underlying type's in constant sets and maps
@eernstg Is the instance of |
Yes, the run-time representation of an extension type is the 'extension type erasure' (sometimes known as the ultimate representation type), and in this case it's |
(It's surprising that those errors aren't reported: I thought such things as "duplicate element in constant set" were checked based on the a static-analysis stand-in for the object which is the result of a constant evaluation, and that would be the |
Constant evaluation with extension types is somewhat special in that it should use the runtime semantics, which have erased extension types, but every result can still have a static type which is an extension type. That is: We need tests. Lots of tests. |
I'm working on "tests, lots of tests", and while they're not complete yet, and probably not all correct yet, I am seeing similar issues when directly comparing constant type expressions for identity. |
Bug: #53918 Change-Id: I941332f30bdc681dd10c8471e1710f2e9dde4c68 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/336501 Reviewed-by: Kallen Tu <kallentu@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Currently the following passes analysis and compiles, but I think it shouldn't since at runtime
E
andint
are equal and const sets/maps don't allow elements/keys that are equal. I haven't read the full extension type spec though, so I might be missing something :)Currently compiling and passing analysis:
Expected:
Dart SDK version: 3.3.0-edge.8b3d93234d1df69c3db5428fa02bb6b39c671ed8
The text was updated successfully, but these errors were encountered: