mirror of
https://github.com/dart-lang/sdk
synced 2024-09-18 21:51:18 +00:00
ad06d73ace
The current two-level indexing scheme for function type parameters (depth and index) breaks down in the case of type substitution when the substituted type is a generic function type, since its internal type parameter types have been encoded assuming that the function type had nesting depth zero, but after substitution its nesting depth can be higher. Relative indexing schemes such as De Bruijn indices will also not work, since function type parameter types are constant types, and the constant infrastructure assumes that the same constant always has the same representation. This change introduces a flat indexing scheme where function type parameters are indexed using a single index which is independent of the context in which the type parameter type appears. To avoid collisions in the case of nested generic function types, every function type has a type parameter offset, which conceptually shifts the indexing range of its type parameters so it doesn't necessarily start at zero. Looking up a function type parameter in its environment thus involves searching outwards until a function type is found whose type parameter index range contains the index encoded in the function type parameter type. Change-Id: I544056d52711ff829b170f78a7274a93871825a4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272361 Reviewed-by: Joshua Litt <joshualitt@google.com> |
||
---|---|---|
.. | ||
bin | ||
lib | ||
.gitignore | ||
api_readme.md | ||
BUILD.gn | ||
OWNERS |