-
Notifications
You must be signed in to change notification settings - Fork 28
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
Some tests for instantiate-to-bound and super-bounded should be updated #984
Comments
@scheglov how changes related with NNBD may affect co19_2 tests? These tests are pre-nnbd ones |
I agree that dart-lang/language#1133 is intended to change the treatment of super-bounded types only for code with null safety. Each of the helper predicates TOP, NULL, MORETOP, MOREBOTTOM mention types availably only with null safety; OBJECT implies null safety because OBJECT( So moving the helper predicates to the null safety spec should not imply that they now mean something different, and hence 'resources/type-system/upper-lower-bounds.md' should also not mean something different than it did before the change. |
Note that we will now treat top types in positions that have no variance and in invariant positions the same as top types in covariant positions, but this is not the same thing as saying that every type variable which is unused/invariant is now considered covariant: typedef F<X> = void Function(); // X is unused.
typedef G<Y> = Y Function(Y); // Y is invariant.
void main() {
F<dynamic> x1; // Here, `dynamic` occurs in a position with no variance.
F<void Function(dynamic)> x2; // `dynamic` position: no variance.
G<dynamic> x3; // `dynamic` position: invariant.
G<void Function(dynamic)> x4; // `dynamic` position: invariant.
G<List<dynamic>> x5; // `dynamic` position: invariant.
F<G<dynamic>> x5; // `dynamic` position: invariant.
G<F<dynamic>> x6; // `dynamic` position: no variance.
} For the purpose of checking a super-bounded type there is no need to make a distinction between a position that is invariant and a position that has no variance: Let 'unrelated' mean 'either invariant or without variance', then any subterm of a term whose position is unrelated will again be unrelated. In particular, the position does not switch to a different variance when we go from a function type F to to a parameter type of F, which is otherwise a situation where the variance changes (from covariant to contravariant, or from contravariant to covariant). |
I'm working on an update to checking regular-bounded and super-bounded types, motivated by this change. I see failures in
co19
andco19_2
tests. See details in the test results./cc @eernstg
The text was updated successfully, but these errors were encountered: