Misleading knock on error when parent references itself
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 21m
- Merged PRs (30d)
- 79
Description
**Bicep version**
VS Code 0.4.1124
**Describe the bug**
Consider the following bicep
```bicep
resource parent 'Microsoft.DocumentDB/databaseAccounts@2021-10-15' = {
name: parent.name
}
resource child 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases@2021-10-15' = {
parent: parent
}
```
This results in an error on line 2 due to the self reference which is expected. However that same error is also produced on line 6. The line 6 error is misleading as there is nothing wrong with the expression on line 6 - it's only wrong due to a knock on error from the resoruce used as it's parent.
In this scenario, I'd expect there to be no error on line 6.

Contributor guide
Research direction
Reproduce the example in the issue and inspect how the compiler reports the self-reference in parent.name and propagates diagnostics to the child resource. The work is done when the self-reference error remains on line 2 and no misleading error appears on line 6.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100