Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves #13556 Given an object type declaration with no catchall schema, the type checker will issue warnings if a property whose name does not match any property declarations is supplied. ```bicep param example { foo: string } = { bar: 'string' } // <-- Issues a BCP037 warning because there is no known `bar` property @Sealed() param sealedExample { foo: string } = { bar: 'string' } // <-- Issues a BCP037 error because there is no known `bar` property and the object is sealed ``` This means that given an object type declaration of `{}`, all supplied properties will trigger a BCP037 warning because an empty object was expected. This behaves differently from the untyped object `object`, which matches without warning against any object. The distinction between `{}` and `object` was getting dropped when templates were compiled to JSON, however, because the compiler wasn't including any information in the type definition that would allow the two to be distinguished; instead, they would both be compiled to `{"type": "object"}`. This PR updates the compiler to include an empty `properties` constraint on object type declarations that include no properties so that it can tell the difference between `{}` and `object` when loading or importing from JSON modules. ###### Microsoft Reviewers: [Open in CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/Azure/bicep/pull/13597)
- Loading branch information
Showing
8 changed files
with
107 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters