Open tlrobinson opened 6 years ago
This is just a guess, but in the past, bugs like this have sometimes been due to the parser providing slightly incorrect .loc.{start,end}.{line,column}
information. Like, perhaps the parser gets confused by the trailing comma and decides that the className
identifier location extends all the way past the end of the parameter list… or something like that.
Can you still reproduce this? I've been trying to write a regression test, and it seems to work now. If my previous theory is correct, the Flow parser might have fixed their .loc
tracking in the meantime.
I haven't been able to pin down exactly why this is happening, but here's my smallest reproduction so far. I'm using
flow
the parser.gets printed as
Note the extra (and mis-nested) parenthesis in the last function.
Interestingly, changing just about anything about the code above causes the problem to go away.