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

Specification: Specify how a promoted type variable type (X & S) is handled in a type test #35314

eernstg opened this Issue Dec 4, 2018 · 1 comment


None yet
1 participant

eernstg commented Dec 4, 2018

Promotion of the type of a local variable v can give rise to a type of the form X & S when the static type of v is X, S is a subtype of the bound of X, and a test of the form v is S is known to have evaluated to true:

void f<X>(X x) {
  if (x is int) {
    // In this block, `x` is known to have type `X & int`.

The language specification currently does not specify this case at all, and this issue is concerned with adding language to specify it. A likely spot to edit is here.


This comment has been minimized.


eernstg commented Dec 4, 2018

Created a CL with a proposed update:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment