{"action":"closed","issue":{"url":"https://api.github.com/repos/facebook/flow/issues/800","labels_url":"https://api.github.com/repos/facebook/flow/issues/800/labels{/name}","comments_url":"https://api.github.com/repos/facebook/flow/issues/800/comments","events_url":"https://api.github.com/repos/facebook/flow/issues/800/events","html_url":"https://github.com/facebook/flow/issues/800","id":106597354,"number":800,"title":"Missing relevant lines in Flow errors in 0.15","user":{"login":"danvk","id":98301,"avatar_url":"https://avatars.githubusercontent.com/u/98301?v=3","gravatar_id":"","url":"https://api.github.com/users/danvk","html_url":"https://github.com/danvk","followers_url":"https://api.github.com/users/danvk/followers","following_url":"https://api.github.com/users/danvk/following{/other_user}","gists_url":"https://api.github.com/users/danvk/gists{/gist_id}","starred_url":"https://api.github.com/users/danvk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danvk/subscriptions","organizations_url":"https://api.github.com/users/danvk/orgs","repos_url":"https://api.github.com/users/danvk/repos","events_url":"https://api.github.com/users/danvk/events{/privacy}","received_events_url":"https://api.github.com/users/danvk/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/facebook/flow/labels/error%20messages","name":"error messages","color":"009800"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-15T16:42:35Z","updated_at":"2015-10-15T19:18:15Z","closed_at":"2015-10-15T19:18:14Z","body":"Error messages have made great strides in Flow-land! But there's still room for improvement. I've just run into an example of a tough-to-debug missing line number in an error today that I wanted to share.\r\n\r\nHere's my repo in a broken state:\r\n\r\n```\r\n$ git clone https://github.com/hammerlab/pileup.js.git\r\n$ git reset --hard 7ae00b9\r\n$ npm install\r\n$ flow status\r\n\r\n/Users/danvk/github/pileup.js/src/main/SamRead.js:40:11,21: property `buffer`\r\nProperty not found in\r\n/Users/danvk/github/pileup.js/src/main/Alignment.js:23:25,37:1: object type\r\n\r\n/Users/danvk/github/pileup.js/src/main/SamRead.js:41:11,23: property `offset`\r\nProperty not found in\r\n/Users/danvk/github/pileup.js/src/main/Alignment.js:23:25,37:1: object type\r\n\r\n/Users/danvk/github/pileup.js/src/main/SamRead.js:44:10,15: property `refID`\r\nProperty not found in\r\n/Users/danvk/github/pileup.js/src/main/Alignment.js:23:25,37:1: object type\r\n\r\n/Users/danvk/github/pileup.js/src/main/SamRead.js:46:10,15: property `l_seq`\r\nProperty not found in\r\n/Users/danvk/github/pileup.js/src/main/Alignment.js:23:25,37:1: object type\r\n\r\n/Users/danvk/github/pileup.js/src/main/SamRead.js:49:11,16: property `_full`\r\nProperty not found in\r\n/Users/danvk/github/pileup.js/src/main/Alignment.js:23:25,37:1: object type\r\n\r\n/Users/danvk/github/pileup.js/src/main/SamRead.js:50:10,15: property `_seq`\r\nProperty not found in\r\n/Users/danvk/github/pileup.js/src/main/Alignment.js:23:25,37:1: object type\r\n\r\n/Users/danvk/github/pileup.js/src/main/SamRead.js:51:15,36: property `_interval`\r\nProperty not found in\r\n/Users/danvk/github/pileup.js/src/main/Alignment.js:23:25,37:1: object type\r\n\r\n/Users/danvk/github/pileup.js/src/main/SamRead.js:78:3,81:3: property `_getJDataView`\r\nProperty not found in\r\n/Users/danvk/github/pileup.js/src/main/Alignment.js:23:25,37:1: object type\r\n\r\n/Users/danvk/github/pileup.js/src/main/SamRead.js:99:3,101:3: property `getFlag`\r\nProperty not found in\r\n/Users/danvk/github/pileup.js/src/main/Alignment.js:23:25,37:1: object type\r\n\r\n/Users/danvk/github/pileup.js/src/main/SamRead.js:108:3,114:3: property `getFull`\r\nProperty not found in\r\n/Users/danvk/github/pileup.js/src/main/Alignment.js:23:25,37:1: object type\r\n\r\n/Users/danvk/github/pileup.js/src/main/SamRead.js:156:3,158:3: property `getCigarString`\r\nProperty not found in\r\n/Users/danvk/github/pileup.js/src/main/Alignment.js:23:25,37:1: object type\r\n\r\n/Users/danvk/github/pileup.js/src/main/SamRead.js:160:3,162:3: property `getQualPhred`\r\nProperty not found in\r\n/Users/danvk/github/pileup.js/src/main/Alignment.js:23:25,37:1: object type\r\n\r\n/Users/danvk/github/pileup.js/src/main/SamRead.js:209:3,220:3: property `debugString`\r\nProperty not found in\r\n/Users/danvk/github/pileup.js/src/main/Alignment.js:23:25,37:1: object type\r\n\r\nFound 13 errors\r\n```\r\n\r\nThe error messages mention `SamRead.js` and `Alignment.js`. All properties & methods on `SamRead` which aren't declared in the `Alignment` exported type are being flagged as errors.\r\n\r\nIt's really unclear how Flow is discovering a connection between this class and type, and why it's getting it backwards. (I expect `SamRead` to implement all methods in `Alignment`, plus some of its own.)\r\n\r\nAfter puzzling it over, I found [the fix][1] in another file, `pileuputils.js`:\r\n\r\n```\r\n-function getOpInfo(read: SamRead, referenceSource: Object): OpInfo {\r\n+function getOpInfo(read: Alignment, referenceSource: Object): OpInfo {\r\n```\r\n\r\n```\r\n$ git reset --hard cc4bf8c1\r\n$ flow status\r\nNo errors!\r\n```\r\n\r\nI believe the chain is that `pileuputils.getOpInfo` was being called with an `Alignment` in `PileupTrack.js`, but was declared to take a `SamRead`. Hence Flow was explaining why an `Alignment` is not a `SamRead`, but without the context of why it was expecting this to be the case.\r\n\r\nA good error message for this issue would have started by mentioning these two relevant lines:\r\n```\r\nPileupTrack.js:265\r\npileuputils.js:133\r\n```\r\n\r\nI'd be happy to distill a more isolated repro if there's interest in improving this error.\r\n\r\n[1]: https://github.com/hammerlab/pileup.js/commit/cc4bf8c1458bc919233ed08e56da1b6297740ff8"}}