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

ide-flow sometimes indicates wrong line #46

Open
dchambers opened this issue Jan 29, 2016 · 0 comments
Open

ide-flow sometimes indicates wrong line #46

dchambers opened this issue Jan 29, 2016 · 0 comments

Comments

@dchambers
Copy link

flow-ide sometimes seems to indicate the long line of code even though Flow has told it where the error is. For example, if I have a code snippet like this:

/* @flow */
type Type = {p1: boolean};
const f = (obj: Type) => obj; // error gets shown here
f({p1: true});
f({p2: true}); // invalid code here

Then Flow will give me an easy to comprehend error message like this:

src/index.js:5
  5: f({p2: true}); // invalid code here
     ^^^^^^^^^^^^^ function call
  3: const f = (obj: Type) => obj; // error gets shown here
                     ^^^^ property `p1`. Property not found in
  5: f({p2: true}); // invalid code here
       ^^^^^^^^^^ object literal

whereas flow-ide will indicate line 3 only, and display the error message property 'p1'. Property not found in.

This should work since even the JSON output from Flow seems to provide the correct information here:

{
  "passed":false,
  "errors":[{
    "operation":{
      "descr":"function call",
      "path":"/home/dominicc/dev/btczero/src/shared/types/index.js",
      "line":5,
      "endline":5,
      "start":1,
      "end":13
    },
    "message":[
      {
        "descr":"property `p1`",
        "level":"error",
        "path":"/home/dominicc/dev/btczero/src/shared/types/index.js",
        "line":3,
        "endline":3,
        "start":17,
        "end":20
      },
      {
        "descr":"Property not found in",
        "level":"error",
        "path":"",
        "line":0,
        "endline":0,
        "start":1,
        "end":0
      },
      {
        "descr":"object literal",
        "level":"error",
        "path":"/home/dominicc/dev/btczero/src/shared/types/index.js",
        "line":5,
        "endline":5,
        "start":3,
        "end":12
      }
    ],
    "kind":"infer"
  }],
  "version":"59d090c1390486bcf585e65f2cfe0214ee74f773 Dec 18 2015 21:50:15"
}
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

No branches or pull requests

1 participant