Fix Trac #3823, plus warning police in TcRnDriver
The immediate reason for this patch is to fix #3823. This was rather easy: all the work was being done but I was returning type_env2 rather than type_env3. An unused-veriable warning would have shown this up, so I fixed all the other warnings in TcRnDriver. Doing so showed up at least two genuine lurking bugs. Hurrah.