//@flow

interface A extends B {
  foo: C;
}

interface B {
  bar: A;
}

declare class D {
  w(): number;
}

declare class C extends D {
  m(): this;
}

declare const a: A;
a.foo.w() as empty; // err

var c = new C();
c.m().w() as empty; // err
