<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/155545>155545</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[HeuristicResolver] Tests should fail if parsed code has error diagnostics
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:frontend
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
HighCommander4
</td>
</tr>
</table>
<pre>
Discovered this while reviewing https://github.com/llvm/llvm-project/pull/155143:
Test cases in [`HeuristicResolverTest.cpp`](https://searchfox.org/llvm/rev/773e6c3a3563421e1ae8c0093d03a5de8a3139c2/clang/unittests/Sema/HeuristicResolverTest.cpp) pass even if the code being parsed in the test case has error diagnostics.
That's not the intention, as this has the potential to hide bugs in the test cases. Error diagnostics while parsing should cause the test case to fail.
In clangd tests, that's accomplished like [this](https://searchfox.org/llvm/rev/773e6c3a3563421e1ae8c0093d03a5de8a3139c2/clang-tools-extra/clangd/unittests/TestTU.cpp#152-160); we should do something similar. (The clangd test infra also has a mechanism to deliberately allow errors for a particular test case, to allow testing behaviour on invalid code. For HeuristicResolver, we can leave that for a later time if/when we need it.)
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy0lM-O4zYMxp9GuRAT2FLkxAcfdmdqbK_t9AFoiYnUylIgys7u2xfyJBh0pj30sECAGPrHj9-PJDL7SyQahP4q9MsOl-JSHr75i3tO84zRUj7spmR_DC-eTVopk4XiPMPN-UCQafV08_ECrpQrC_VFyFHI8eKLW6a9SbOQYwjr4-_pmtOfZIqQ43UJQcix1bo9qHqxqb9X4gIGmRh8hCqra77Rkj0Xb34jTmGlXA_tzfUqukboFyFP_wzOhNm4c_q-T_nyHj_TKuR4PCrqjEKlO3WQLbVIJ9M0vbKNQm3phKpVvZFCjiZgrPeX6EshLizk-DvNKOT435JkD1dkBlopgj9DcQQmWYKJqk1XzEy25lY3yiNbcMhAOacM1uMlpvo27--eOCxCHhliKts1HwvF4lMU8hmQ34C47YPgmrZNDFASOF8jLxf-FJH38MvHeHeoVWPVyi4twYLBhemD3JLgjD7cBf4aYfPKwt2mZygPzWhMmq_BsyMLwf9FFWoV_NPJPZWUAj_R95LxsWY_4KzYXv94A6daLZ_arhGyF-or3OhhgE3AaabiNlP87APmPQh5eq1s3xMHH88ZAQOnjQbCTMZh9DxXwywFP1HGQuEHYAjp9kac4ZwyYLW9eLMEzO9Gb1am--m6WiVM5HD1acmQIvi4YvB2q7E9jCnDp9qsj9wIDEYIhCttcO5BAxbKUPxM4M9CjjdHsR6OVKu07IXsd3ZQtlc97mhoj7qTnVa93LnhZFD36tB17YnwrKbThFIdJzw0jdZG4c4PspG6Ocljo2Sv5V5jd9bS2tOE_VFJEoeG5lpHFXRlvvPMCw2t1vqgdwEnCrwNJynfulF9OedUy98KKevIysM2V2qNi0MTPBd-f634Erbh9tkT_QIVPj8g13Ku_Xpv0K1l_7Upd0sOw_-edlte_DbvamrrIP8OAAD__6PV10M">