Flow: Hang for override method with rest parameters that recursively calls itself

Created on 1 Mar 2017  路  4Comments  路  Source: facebook/flow

// @flow

class A {
    f(x: any, ...args: any[]) {}
}

class B extends A {
    f(x, ...args) {
      if (x.y) {
        this.f(x.y, ...args);
      }
    }
}

Type checking never terminates.

bug nontermination / perf

Most helpful comment

Ok, I have a fix! I'll try to get it reviewed and cherry picked into v0.42!

All 4 comments

Dupe of #3370?

cc @gabelevi

Yep, and much like I pointed out in #3370, if you declare the rest arg types on B.prototype.f, the problem goes away:

class B extends A {
    f(x, ...args: any[]) {
      if (x.y) {
        this.f(x.y, ...args);
      }
    }
}

Ok, I have a fix! I'll try to get it reviewed and cherry picked into v0.42!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bennoleslie picture bennoleslie  路  3Comments

john-gold picture john-gold  路  3Comments

ctrlplusb picture ctrlplusb  路  3Comments

davidpelaez picture davidpelaez  路  3Comments

ghost picture ghost  路  3Comments