<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/110985>110985</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
TableGen gives misleading location/diagnosis when syntax error occurs inside let binding
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Hugobros3
</td>
</tr>
</table>
<pre>
The following TableGen snippet:
```
class A1 {
int x = 69;
}
let x = 42 in {
def a1 = A1 {}
}
```
produces the following diagnosis:
```
kewl.td:5:5: error: Value 'x' unknown!
let x = 42 in {
^
```
Which is confusing to a newcomer to TableGen like myself, because it looks like you really should be able to do so.
---
However the underlying issue is that there is a syntax error inside the brackets of the let, as without the enclosing let:
```
class A1 {
int x = 69;
}
def a1 = A1 {}
```
we get an accurate diagnosis:
```
kewl.td:6:10: error: Expected '{' to start body or ';' for declaration only
def a1 = A1 {}
^
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVMkO4zYM_Rr5QiSw5S05-JBpJp0PGLRnWaJtNYoYaImTvy_kLJOgRQcFxvAiiubjI_Uk4b0eLWLH6i-s3mciholc9y2O1DvyZdaTunXfJ4SBjKFZ2xG-i97g72jBW30-Y2DljuV7lj_fTf64F1Ma4T3sCmDtl_sMgLYBrsDKPTRbVj6mWbt_hzH4_KfioO17uMIBRLH4Hriv0Nfgk8TZkYoSPYSPSpQWoyWv_Y8SPuOOOJt1UKzc1Y8H0DlyafCHMBGB8fbKeAvRHi3NlvHip_QBWP31X9P9OWk5gfYgyQ7RJ4qBQIDFWdIJXbJe3Tf6iHC6eTQD479Bj1JEj6ADGKKjv_tvFMGhMOYGfqJoFPQICSFBKQJP6_emr1ard_MbzXhJaSeEaBU6c0uctPcRE80wiZCcbrEE-JsN4npvEWjrtcIltndCHjF4oGGxDYZEWXiYdZgoLiCAVhpaijbvovo1cvoPzXwmmBFGDCAsCCmjEwH_j0waVu6K_EMnX69nlAFVkkrKy9vUex-EC5B2F5BbXOXiGsiBQmmEE0GTBbLm9nPdw_P6p7Iy1ZVqW25Fhl3R8nZb13XeZFNXqXrTDHldb8qqqSo1DJuSb_KhEVg3qqwy3fGcV0Wel0VRbni9zkXbNxsphWyqtm57VuV4Etqsjbmc1uTGbFFGVxT5dlNnRvRo_HKycG5xvuuGcZ4OGteloFUfR8-q3Ggf_A-YoIPB7qX0UV_Qw0l7g0It-iC5dIfxw2ttYJ7SkfSuQEoL6J9CTDuy1zYBZNGZbgrhvKwoPzB-GHWYYr-WdGL8kIg8Pquzo79QBsYPC33P-OFR36XjfwcAAP__JzaLng">