c9cf5b9916
The front end and analyzer use the same representation for types and type schemas, with the unknown type schema (`_`) treated as a pseudo-type. This creates the risk of accidentally mixing types and schemas, resulting in `_` accidentally "leaking" into the type system and showing up in static analysis results or error messages. As a step toward reducing this risk, this change adds a type parameter to `TypeAnalyzer`, preventing the shared type analysis code from being able to assume that types and schemas are represented the same. This extra discipline makes it much easier to search through the code and identify how types are manipulated vs. how type schemas are manipulated, and makes it impossible for the shared type analysis to accidentally leak `_` into the type system. I believe this change will also make it easier to implement some type inference improvements we've been contemplating, such as improved type inference of `.map(...).toList()`, as well as https://github.com/dart-lang/language/issues/3471, because those improvements may require introducing new kinds of type schemas. Change-Id: Ifcd7e2c4e1172ee39719ce8c8b10d7f10f6a7b6f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345353 Reviewed-by: Chloe Stefantsova <cstefantsova@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Paul Berry <paulberry@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
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.