Files
sdk/pkg/_fe_analyzer_shared
Paul Berry 5c904c17f7 [mini_types] Add an assertion to verify the runtime type of PrimaryType-derived objects.
The class hierarchy for `PrimaryType` has several subtypes to
represent special types in Dart:

- DynamicType (for `dynamic`)
- FutureOrType (for `FutureOr<...>`)
- InvalidType (for the invalid type)
- NeverType (for `Never`)
- NullType (for `Null`)
- VoidType (for `Void`)

When constructing a `PrimaryType` for one of these special types, we
need to make sure that the type that's being ultimately constructed is
the proper subtype, otherwise algorithms that do `is` tests on the
`Type` hierarchy will behave incorrectly.

This change adds an assertion to the `PrimaryType` constructor to
verify that the appropriate subtype of `Type` is being constructed.

Change-Id: I347cc4893da265b35e97636479700a92a8e61541
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/395560
Reviewed-by: Kallen Tu <kallentu@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2024-11-16 14:27:41 +00:00
..
2022-02-14 14:06:34 +00:00

FE/analyzer shared code

This package contains logic that is shared between the front_end and analyzer packages. It is intended solely to facilitate development of the Dart SDK, and is not intended for use by end users. In particular, this package has no public API, so no guarantee is made of compatibility between one version of the package and the next.

End users should consider using the analyzer package to analyze Dart source code.