I've pushed this now. I made one additional change, which was to fix
things so that if both an INTERNAL and an EXTENSION dependency exist,
the first loop will reliably complain about the EXTENSION dependency.
It only takes one more if-test to do that now that we're postponing
the error report till after the loop, and this way we don't need to
split hairs about how likely it is for both to exist.
I think we're done with this thread, though I still need to look at
the problem I complained of in <26527(dot)1549572789(at)sss(dot)pgh(dot)pa(dot)us>.
regards, tom lane