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

disjoint unions regression between 0.19 and 0.21 #1371

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

disjoint unions regression between 0.19 and 0.21 #1371

sakari opened this issue Feb 5, 2016 · 3 comments

Comments

@sakari
Copy link

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
Copy link
Author

sakari commented Feb 5, 2016

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

@jeffmo
Copy link
Contributor

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
Copy link
Contributor

This will be fixed in an upcoming release.

@ghost ghost closed this as completed 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
Projects
None yet
Development

No branches or pull requests

3 participants