Skip to content

Commit 296e7d2

Browse files
Added like() function to systemnamespace and updated baselines - (#18990)
## Description Added like() function implementation to SystemNameSpaces - #18263 ## Example Usage ```bicep output matchTrue bool = like(OneTwoThree, '*Two*') output matchFalse bool = like(OneTwoThree, 'Two*') ``` ## Checklist - [x] I have read and adhere to the (https://github.com/Azure/bicep/blob/main/CONTRIBUTING.md). ###### Microsoft Reviewers: [Open in CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/Azure/bicep/pull/18990)
1 parent 75cf8ee commit 296e7d2

File tree

68 files changed

+10734
-9320
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+10734
-9320
lines changed

src/Bicep.Core.Samples/Files/baselines/Functions/sys.json

Lines changed: 1908 additions & 1882 deletions
Large diffs are not rendered by default.

src/Bicep.Core.Samples/Files/baselines/Functions_LF/main.bicep

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,6 @@ func buildUrlMultiLine(
4343
hostname string,
4444
path string
4545
) string => '${https ? 'https' : 'http'}://${hostname}${empty(path) ? '' : '/${path}'}'
46+
47+
output likeExactMatch bool =like('abc', 'abc')
48+
output likeWildCardMatch bool= like ('abcdef', 'a*c*')

src/Bicep.Core.Samples/Files/baselines/Functions_LF/main.diagnostics.bicep

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,6 @@ func buildUrlMultiLine(
5353
path string
5454
) string => '${https ? 'https' : 'http'}://${hostname}${empty(path) ? '' : '/${path}'}'
5555

56+
output likeExactMatch bool =like('abc', 'abc')
57+
output likeWildCardMatch bool= like ('abcdef', 'a*c*')
58+

src/Bicep.Core.Samples/Files/baselines/Functions_LF/main.formatted.bicep

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,6 @@ func b(longParameterName1 string, longParameterName2 string, longParameterName3
4343

4444
func buildUrlMultiLine(https bool, hostname string, path string) string =>
4545
'${https ? 'https' : 'http'}://${hostname}${empty(path) ? '' : '/${path}'}'
46+
47+
output likeExactMatch bool = like('abc', 'abc')
48+
output likeWildCardMatch bool = like('abcdef', 'a*c*')

src/Bicep.Core.Samples/Files/baselines/Functions_LF/main.ir.bicep

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
func buildUrl(https bool, hostname string, path string) string => '${https ? 'https' : 'http'}://${hostname}${empty(path) ? '' : '/${path}'}'
2-
//@[000:1461) ProgramExpression
2+
//@[000:1564) ProgramExpression
33
//@[000:0141) ├─DeclaredFunctionExpression { Name = buildUrl }
44
//@[013:0141) | └─LambdaExpression
55
//@[020:0024) | ├─AmbientTypeReferenceExpression { Name = bool }
@@ -116,9 +116,9 @@ func fooTest() array => map(barTest(), a => 'Hello ${a}!')
116116
//@[015:0020) | └─AmbientTypeReferenceExpression { Name = array }
117117

118118
output fooValue array = fooTest()
119-
//@[000:0033) ─DeclaredOutputExpression { Name = fooValue }
120-
//@[016:0021) ├─AmbientTypeReferenceExpression { Name = array }
121-
//@[024:0033) └─UserDefinedFunctionCallExpression { Name = fooTest }
119+
//@[000:0033) ─DeclaredOutputExpression { Name = fooValue }
120+
//@[016:0021) | ├─AmbientTypeReferenceExpression { Name = array }
121+
//@[024:0033) | └─UserDefinedFunctionCallExpression { Name = fooTest }
122122

123123
func test() object => loadJsonContent('./repro-data.json')
124124
//@[000:0058) ├─DeclaredFunctionExpression { Name = test }
@@ -180,3 +180,16 @@ func buildUrlMultiLine(
180180
//@[079:0083) | | └─LambdaVariableReferenceExpression { Variable = path }
181181
//@[002:0008) | └─AmbientTypeReferenceExpression { Name = string }
182182

183+
output likeExactMatch bool =like('abc', 'abc')
184+
//@[000:0046) ├─DeclaredOutputExpression { Name = likeExactMatch }
185+
//@[022:0026) | ├─AmbientTypeReferenceExpression { Name = bool }
186+
//@[028:0046) | └─FunctionCallExpression { Name = like }
187+
//@[033:0038) | ├─StringLiteralExpression { Value = abc }
188+
//@[040:0045) | └─StringLiteralExpression { Value = abc }
189+
output likeWildCardMatch bool= like ('abcdef', 'a*c*')
190+
//@[000:0054) └─DeclaredOutputExpression { Name = likeWildCardMatch }
191+
//@[025:0029) ├─AmbientTypeReferenceExpression { Name = bool }
192+
//@[031:0054) └─FunctionCallExpression { Name = like }
193+
//@[037:0045) ├─StringLiteralExpression { Value = abcdef }
194+
//@[047:0053) └─StringLiteralExpression { Value = a*c* }
195+

0 commit comments

Comments
 (0)