Skip to content
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

Add missing word 'bounded' to definition of flatten #3561

Closed
wants to merge 2 commits into from

Conversation

eernstg
Copy link
Member

@eernstg eernstg commented Jan 15, 2024

This PR adds the word 'bounded' to the S? case in the definition of flatten. This change is needed for consistency. Here is an example:

typedef Exactly<X> = X Function(X);

extension<X> on X {
  X expectStaticType<Y extends Exactly<X>>() => this;
}

Future<void> test<X extends Future<int>?>(X x) async {
  // ignore: await_only_futures
  var y = await x;
  y.expectStaticType<Exactly<int?>>; // This is what we want.
}

void main() async {
  await test<Future<int>?>(null);
  await test<Future<int>>(Future.value(1));
}

If we do not have the word 'bounded' in said rule then await x will have the type X and the future will not be awaited. The type will be int? as shown above if the rule is changed and 'bounded' is included.

There is no breaking change, and indeed no implementation effort associated with this specification change: the implementations behave as if the spec change had already been performed.

@eernstg eernstg requested review from natebosch and removed request for natebosch January 15, 2024 15:01
@eernstg
Copy link
Member Author

eernstg commented Jan 16, 2024

Hi, Nate!

It is indeed true that some cases in the current implementations behave as if we had that word 'bounded' in the specification already—but it isn't true in all cases. So the situation isn't as simple as it looked at first.

So I'll retract this PR and then we'll have to discuss the topic in more detail in the language team.

Sorry about the bothering you for no good reason!

@eernstg eernstg closed this Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant