Azure / Azure/bicep

Misleading second error if using `=` for a property value rather than `:`

Open
#2,476 1 comment 0 reactions 0 assignees View on GitHub
enhancement error-message
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 21m
Merged PRs (30d)
79

Description

**Is your feature request related to a problem? Please describe.**
Consider the following bicep. Whilst this is wrong bicep, it is increadibly easy to write if you're familiar with other programming languages which use `=` rather than `:`, and have a brain fart.
```bicep
var foo = {
name = 'value${deployment().name}'
}
```

Whilst the first error is correct, the second error could is a bit misleading, and is just a consequence of the parser getting confused

![image](https://user-images.githubusercontent.com/289860/116623721-9488ec80-a93e-11eb-81dc-bc01e277c79d.png)

**Describe the solution you'd like**
Could the parser's error handling better handle this error such that the second error doesn't get reported?

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported Bicep snippet and inspect the parser diagnostics it produces. The work is done when the incorrect second error is no longer reported while the valid first error remains.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.