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

disjoint unions regression between 0.19 and 0.21 #1371

Closed
sakari opened this Issue Feb 5, 2016 · 3 comments

Comments

Projects
None yet
3 participants
@sakari

sakari commented Feb 5, 2016

the following program passes on flow 0.19 and in http://tryflow.org/#57c61a492a07f6e77eeb451064a5e2e4

function create(a: any): { type: 'B', data: number } | { type: 'A', data: string }
 {
  return {
    type: 'A',
    data: a
  }
}

but fails on OSX El Capitan with flow 0.21

test$ flow version
Flow, a static type checker for JavaScript, version 0.21.0
test$ flow
test.js:4
  4:   return {
              ^ object literal. This type is incompatible with
  2: function create(a: any): { type: 'B', data: number } | { type: 'A', data: string }
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ union: object type(s)


Found 1 error
@sakari

This comment has been minimized.

Show comment
Hide comment
@sakari

sakari Feb 5, 2016

interestingly if i set type: 'B' in the object literal flow does not complain

sakari commented Feb 5, 2016

interestingly if i set type: 'B' in the object literal flow does not complain

@jeffmo

This comment has been minimized.

Show comment
Hide comment
@jeffmo

jeffmo Feb 12, 2016

Member

This is a known problem that we're actively working on. There are various nasty bugs with unions right now that we're ironing out.

Thanks for reporting!

Member

jeffmo commented Feb 12, 2016

This is a known problem that we're actively working on. There are various nasty bugs with unions right now that we're ironing out.

Thanks for reporting!

@avikchaudhuri

This comment has been minimized.

Show comment
Hide comment
@avikchaudhuri

avikchaudhuri Jun 1, 2016

Contributor

This will be fixed in an upcoming release.

Contributor

avikchaudhuri commented Jun 1, 2016

This will be fixed in an upcoming release.

@ghost ghost closed this in 2df7671 Jun 10, 2016

This issue was closed.

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