fix #6634, bug where a type decl requires a captured variable