Test and workaround inference bugs
This commit is contained in:
@@ -48,6 +48,14 @@ function getTypeAnnotationBindingConstantViolations(path, name) {
|
||||
if (constantViolations.length) {
|
||||
// pick one constant from each scope which will represent the last possible
|
||||
// control flow path that it could've taken/been
|
||||
/* This code is broken for the following problems:
|
||||
* It thinks that assignments can only happen in scopes.
|
||||
* What about conditionals, if statements without block,
|
||||
* or guarded assignments.
|
||||
* It also checks to see if one of the assignments is in the
|
||||
* same scope and uses that as the only "violation". However,
|
||||
* the binding is returned by `getConstantViolationsBefore` so we for
|
||||
* sure always going to return that as the only "violation".
|
||||
let rawConstantViolations = constantViolations.reverse();
|
||||
let visitedScopes = [];
|
||||
constantViolations = [];
|
||||
@@ -62,7 +70,7 @@ function getTypeAnnotationBindingConstantViolations(path, name) {
|
||||
constantViolations = [violation];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// add back on function constant violations since we can't track calls
|
||||
constantViolations = constantViolations.concat(functionConstantViolations);
|
||||
|
||||
Reference in New Issue
Block a user