factor out infer-app, fix shadowing error in test