Files
sdk/pkg/analyzer/test/generated
Paul Berry ac6d86c737 [analyzer] Represent Null as NullTypeImpl.
This change introduces the class `NullTypeImpl` to represent the
special type `Null`, which was previously represented as an ordinary
`InterfaceType`.

This class mirrors the CFE's `NullType` class. Adding it will
facilitate further code sharing between the analyzer and the CFE,
because it will allow code that's shared between the analyzer and CFE
to use `is` tests to recognize the type `Null`.

The new `NullTypeImpl` class always has a nullability suffix of
`NullabilitySuffix.none`, so it is impossible for the type `Null?` to
occur. This is a benign behavioral change; previously there were some
circumstances in which the type `Null?` might occur in the analyzer,
but the type `Null?` behaved the same as `Null` so there was no
user-visible effect. This behavioral change brings the analyzer's
treatment of `Null` into alignment with that of the CFE.

This is the first step in a planned patch series. In follow-up CLs, I
intend to:

- Introduce a public-facing `NullType` for use by clients.

- Change `NullTypeImpl` so that it no longer extends `InterfaceTypeImpl`.

- Add a base class that is common to the analyzer and CFE `NullType`
  representations.

Change-Id: I9cea84d8149347bffdee006d544af28c66eba429
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/396320
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-19 17:17:18 +00:00
..