When using the null propagation operator on a nullable sealed type, trying to access undefined properties trigger a warning instead of an error
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 79
Description
**Bicep version**
Bicep CLI version 0.39.26 (1e90b06e40)
**Describe the bug**
When I have a user-defined type that has the `sealed` decorator attributed to it. Attempting to to access a property that is not defined in by the type returns a warning instead of an error.
It would be more sensible to return an error as the expectation from the `sealed` decorator is that any property accessed on a typed symbol should be defined in the type definition. Whether it is a conditional access or not.
**To Reproduce**
```bicep
@sealed()
type sealedType = {
propertyA: string
}
param mySealedParam sealedType?
var shouldFail = mySealedParam.?propertyB
```
A warning is raised for `propertyB` instead of an error.
Contributor guide
Research direction
Start with the provided Bicep reproduction using a sealed nullable user-defined type and conditional access to an undefined property. Trace the diagnostic produced for propertyB; done means the undefined property is reported as an error rather than a warning, including when null propagation is used.
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
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100