The current IDL compiler will compile the following IDL with no warnings or errors:
and this (w/ thrift -r):
Both of these IDLs generate un-compilable output in most languages.
The attached patch adds typename collision checking to the compiler. It generates errors when a typename is declared twice in the same file or when the same typename is declared in two files causing collisions in all namespace scopes. Explicit namespace declarations with collisions in some but not all scopes are reported as warning because the user could compile for a scope that would succeed. More details in the patch comments.
Built and tested on Windows with VS2012 and Unbuntu w/ gcc 4.7.2
make check ran on Unbuntu clean (though I had to switch the config.h to thrift/thrift-config.h in TFileTransportTest.cpp)