Issue 1 just adds compile time. Issue 2 should be investigated.
1) I think the NodeVisitor in ApplySpecialization#hasApplies will enter into nested functions. Shouldn't it just look at the current function?
2) I wonder how hot the TransformFailedException constructor may get. Should we worry about string concatenation there?