-
Notifications
You must be signed in to change notification settings - Fork 1.7k
language/least_upper_bound/least_upper_bound_greatest_closure_2_test causes stack overflow in SubtypeHelper.isSubtypeOf #46524
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
Comments
The minimal reproduction so far import 'dart:async';
void f<X extends FutureOr<X>>(X x) {
x ?? 0;
} |
We apply rules:
|
CC @eernstg for bug which may be an infinite loop which is specified in the spec |
Right, the subtype rules do give rise to an attempt to prove However, the bound In the specification we could have a notion of normalization of type variable bounds, which is applied before we proceed to use any subtyping rules (and those rules would be the same as today). It is not trivial to see that any particular change would eliminate all looping cases. For instance, Left Null may seem similar to Right Object, but it is different: We have @leafpetersen, WDYT? |
Is this not just another instance of dart-lang/language#433 ? |
I don't think dart-lang/language#433 mentions the connection to looping subtype checks. This issue would then serve as a concrete motivation for re-opening dart-lang/language#433 (and the fix would then be to make those bounds an error, rather than normalizing them away). |
Awaiting dart-lang/language#433. |
@chloestefantsova Is there any work here for the CFE? |
@johnniwinther We should report an error in this case instead of crashing; however, the well-formed Dart programs aren't broken. |
This test is still failing on all configurations with StackOverflow in the CFE. |
@chloestefantsova Can you take at the CFE-side of things? |
Sure thing! |
@eernstg I like this idea. I'm working on a CL (https://dart-review.googlesource.com/c/sdk/+/342920) to mitigate the amount of crashes due to the infinite recursion, and the approach I'm taking there is that the bounds of the form |
I do think it is benign to simply eliminate bounds from type parameter declarations of the form @leafpetersen, WDYT? Do you prefer to make those vacuous bounds an error? |
Good point. We should probably consider self-dependency via another variable too, for example, |
The text was updated successfully, but these errors were encountered: