This fixes a test involving transitive captures of local functions, as well as an infinite recursion possible with the old code. Fixes <rdar://problem/34496304>.