Detecting recursive promises