Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,809 changes: 1,927 additions & 1,882 deletions src/Bicep.Core.Samples/Files/baselines/Functions/sys.json

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions src/Bicep.Core.Samples/Files/baselines/Functions_LF/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,14 @@ func buildUrlMultiLine(
hostname string,
path string
) string => '${https ? 'https' : 'http'}://${hostname}${empty(path) ? '' : '/${path}'}'

output likeExactMatch bool =like('abc', 'abc')
output likeWildCardMatch bool= like ('abcdef', 'a*c*')
output distinctTest array = distinct(['a','b','a','c','b'])
output distinctTest2 array = distinct([1,2,3,1,2,4])
output distinctTest3 array = distinct([{a:1}, {a:1}, {b:2}])





Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,22 @@ func buildUrlMultiLine(
path string
) string => '${https ? 'https' : 'http'}://${hostname}${empty(path) ? '' : '/${path}'}'

output likeExactMatch bool =like('abc', 'abc')
//@[33:45) [BCP234 (Warning)] The ARM function "like" failed when invoked on the value [abc, abc]: The template function 'like' is not valid. Please see https://aka.ms/arm-functions for usage details. (bicep https://aka.ms/bicep/core-diagnostics#BCP234) |'abc', 'abc'|
output likeWildCardMatch bool= like ('abcdef', 'a*c*')
//@[37:53) [BCP234 (Warning)] The ARM function "like" failed when invoked on the value [abcdef, a*c*]: The template function 'like' is not valid. Please see https://aka.ms/arm-functions for usage details. (bicep https://aka.ms/bicep/core-diagnostics#BCP234) |'abcdef', 'a*c*'|
output distinctTest array = distinct(['a','b','a','c','b'])
//@[20:25) [use-user-defined-types (Warning)] Use user-defined types instead of 'object' or 'array'. (bicep core linter https://aka.ms/bicep/linter-diagnostics#use-user-defined-types) |array|
//@[37:58) [BCP234 (Warning)] The ARM function "distinct" failed when invoked on the value [[\r\n "a",\r\n "b",\r\n "a",\r\n "c",\r\n "b"\r\n]]: The template function 'distinct' is not valid. Please see https://aka.ms/arm-functions for usage details. (bicep https://aka.ms/bicep/core-diagnostics#BCP234) |['a','b','a','c','b']|
output distinctTest2 array = distinct([1,2,3,1,2,4])
//@[21:26) [use-user-defined-types (Warning)] Use user-defined types instead of 'object' or 'array'. (bicep core linter https://aka.ms/bicep/linter-diagnostics#use-user-defined-types) |array|
//@[38:51) [BCP234 (Warning)] The ARM function "distinct" failed when invoked on the value [[\r\n 1,\r\n 2,\r\n 3,\r\n 1,\r\n 2,\r\n 4\r\n]]: The template function 'distinct' is not valid. Please see https://aka.ms/arm-functions for usage details. (bicep https://aka.ms/bicep/core-diagnostics#BCP234) |[1,2,3,1,2,4]|
output distinctTest3 array = distinct([{a:1}, {a:1}, {b:2}])
//@[21:26) [use-user-defined-types (Warning)] Use user-defined types instead of 'object' or 'array'. (bicep core linter https://aka.ms/bicep/linter-diagnostics#use-user-defined-types) |array|
//@[38:59) [BCP234 (Warning)] The ARM function "distinct" failed when invoked on the value [[\r\n {\r\n "a": 1\r\n },\r\n {\r\n "a": 1\r\n },\r\n {\r\n "b": 2\r\n }\r\n]]: The template function 'distinct' is not valid. Please see https://aka.ms/arm-functions for usage details. (bicep https://aka.ms/bicep/core-diagnostics#BCP234) |[{a:1}, {a:1}, {b:2}]|






Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,9 @@ func b(longParameterName1 string, longParameterName2 string, longParameterName3

func buildUrlMultiLine(https bool, hostname string, path string) string =>
'${https ? 'https' : 'http'}://${hostname}${empty(path) ? '' : '/${path}'}'

output likeExactMatch bool = like('abc', 'abc')
output likeWildCardMatch bool = like('abcdef', 'a*c*')
output distinctTest array = distinct(['a', 'b', 'a', 'c', 'b'])
output distinctTest2 array = distinct([1, 2, 3, 1, 2, 4])
output distinctTest3 array = distinct([{ a: 1 }, { a: 1 }, { b: 2 }])
64 changes: 60 additions & 4 deletions src/Bicep.Core.Samples/Files/baselines/Functions_LF/main.ir.bicep
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
func buildUrl(https bool, hostname string, path string) string => '${https ? 'https' : 'http'}://${hostname}${empty(path) ? '' : '/${path}'}'
//@[000:1461) ProgramExpression
//@[000:1743) ProgramExpression
//@[000:0141) ├─DeclaredFunctionExpression { Name = buildUrl }
//@[013:0141) | └─LambdaExpression
//@[020:0024) | ├─AmbientTypeReferenceExpression { Name = bool }
Expand Down Expand Up @@ -116,9 +116,9 @@ func fooTest() array => map(barTest(), a => 'Hello ${a}!')
//@[015:0020) | └─AmbientTypeReferenceExpression { Name = array }

output fooValue array = fooTest()
//@[000:0033) ─DeclaredOutputExpression { Name = fooValue }
//@[016:0021) ├─AmbientTypeReferenceExpression { Name = array }
//@[024:0033) └─UserDefinedFunctionCallExpression { Name = fooTest }
//@[000:0033) ─DeclaredOutputExpression { Name = fooValue }
//@[016:0021) | ├─AmbientTypeReferenceExpression { Name = array }
//@[024:0033) | └─UserDefinedFunctionCallExpression { Name = fooTest }

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

output likeExactMatch bool =like('abc', 'abc')
//@[000:0046) ├─DeclaredOutputExpression { Name = likeExactMatch }
//@[022:0026) | ├─AmbientTypeReferenceExpression { Name = bool }
//@[028:0046) | └─FunctionCallExpression { Name = like }
//@[033:0038) | ├─StringLiteralExpression { Value = abc }
//@[040:0045) | └─StringLiteralExpression { Value = abc }
output likeWildCardMatch bool= like ('abcdef', 'a*c*')
//@[000:0054) ├─DeclaredOutputExpression { Name = likeWildCardMatch }
//@[025:0029) | ├─AmbientTypeReferenceExpression { Name = bool }
//@[031:0054) | └─FunctionCallExpression { Name = like }
//@[037:0045) | ├─StringLiteralExpression { Value = abcdef }
//@[047:0053) | └─StringLiteralExpression { Value = a*c* }
output distinctTest array = distinct(['a','b','a','c','b'])
//@[000:0059) ├─DeclaredOutputExpression { Name = distinctTest }
//@[020:0025) | ├─AmbientTypeReferenceExpression { Name = array }
//@[028:0059) | └─FunctionCallExpression { Name = distinct }
//@[037:0058) | └─ArrayExpression
//@[038:0041) | ├─StringLiteralExpression { Value = a }
//@[042:0045) | ├─StringLiteralExpression { Value = b }
//@[046:0049) | ├─StringLiteralExpression { Value = a }
//@[050:0053) | ├─StringLiteralExpression { Value = c }
//@[054:0057) | └─StringLiteralExpression { Value = b }
output distinctTest2 array = distinct([1,2,3,1,2,4])
//@[000:0052) ├─DeclaredOutputExpression { Name = distinctTest2 }
//@[021:0026) | ├─AmbientTypeReferenceExpression { Name = array }
//@[029:0052) | └─FunctionCallExpression { Name = distinct }
//@[038:0051) | └─ArrayExpression
//@[039:0040) | ├─IntegerLiteralExpression { Value = 1 }
//@[041:0042) | ├─IntegerLiteralExpression { Value = 2 }
//@[043:0044) | ├─IntegerLiteralExpression { Value = 3 }
//@[045:0046) | ├─IntegerLiteralExpression { Value = 1 }
//@[047:0048) | ├─IntegerLiteralExpression { Value = 2 }
//@[049:0050) | └─IntegerLiteralExpression { Value = 4 }
output distinctTest3 array = distinct([{a:1}, {a:1}, {b:2}])
//@[000:0060) └─DeclaredOutputExpression { Name = distinctTest3 }
//@[021:0026) ├─AmbientTypeReferenceExpression { Name = array }
//@[029:0060) └─FunctionCallExpression { Name = distinct }
//@[038:0059) └─ArrayExpression
//@[039:0044) ├─ObjectExpression
//@[040:0043) | └─ObjectPropertyExpression
//@[040:0041) | ├─StringLiteralExpression { Value = a }
//@[042:0043) | └─IntegerLiteralExpression { Value = 1 }
//@[046:0051) ├─ObjectExpression
//@[047:0050) | └─ObjectPropertyExpression
//@[047:0048) | ├─StringLiteralExpression { Value = a }
//@[049:0050) | └─IntegerLiteralExpression { Value = 1 }
//@[053:0058) └─ObjectExpression
//@[054:0057) └─ObjectPropertyExpression
//@[054:0055) ├─StringLiteralExpression { Value = b }
//@[056:0057) └─IntegerLiteralExpression { Value = 2 }






22 changes: 21 additions & 1 deletion src/Bicep.Core.Samples/Files/baselines/Functions_LF/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"_generator": {
"name": "bicep",
"version": "dev",
"templateHash": "2216132208843131284"
"templateHash": "4573292804379626792"
}
},
"definitions": {
Expand Down Expand Up @@ -226,6 +226,26 @@
"fooValue": {
"type": "array",
"value": "[__bicep.fooTest()]"
},
"likeExactMatch": {
"type": "bool",
"value": "[like('abc', 'abc')]"
},
"likeWildCardMatch": {
"type": "bool",
"value": "[like('abcdef', 'a*c*')]"
},
"distinctTest": {
"type": "array",
"value": "[distinct(createArray('a', 'b', 'a', 'c', 'b'))]"
},
"distinctTest2": {
"type": "array",
"value": "[distinct(createArray(1, 2, 3, 1, 2, 4))]"
},
"distinctTest3": {
"type": "array",
"value": "[distinct(createArray(createObject('a', 1), createObject('a', 1), createObject('b', 2)))]"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ output fooValue array = fooTest()
//@ "fooValue": {
//@ "type": "array",
//@ "value": "[__bicep.fooTest()]"
//@ }
//@ },

func test() object => loadJsonContent('./repro-data.json')
//@ "test": {
Expand Down Expand Up @@ -251,3 +251,34 @@ func buildUrlMultiLine(
//@ "type": "string",
//@ "value": "[format('{0}://{1}{2}', if(parameters('https'), 'https', 'http'), parameters('hostname'), if(empty(parameters('path')), '', format('/{0}', parameters('path'))))]"

output likeExactMatch bool =like('abc', 'abc')
//@ "likeExactMatch": {
//@ "type": "bool",
//@ "value": "[like('abc', 'abc')]"
//@ },
output likeWildCardMatch bool= like ('abcdef', 'a*c*')
//@ "likeWildCardMatch": {
//@ "type": "bool",
//@ "value": "[like('abcdef', 'a*c*')]"
//@ },
output distinctTest array = distinct(['a','b','a','c','b'])
//@ "distinctTest": {
//@ "type": "array",
//@ "value": "[distinct(createArray('a', 'b', 'a', 'c', 'b'))]"
//@ },
output distinctTest2 array = distinct([1,2,3,1,2,4])
//@ "distinctTest2": {
//@ "type": "array",
//@ "value": "[distinct(createArray(1, 2, 3, 1, 2, 4))]"
//@ },
output distinctTest3 array = distinct([{a:1}, {a:1}, {b:2}])
//@ "distinctTest3": {
//@ "type": "array",
//@ "value": "[distinct(createArray(createObject('a', 1), createObject('a', 1), createObject('b', 2)))]"
//@ }






Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"_generator": {
"name": "bicep",
"version": "dev",
"templateHash": "2216132208843131284"
"templateHash": "4573292804379626792"
}
},
"definitions": {
Expand Down Expand Up @@ -226,6 +226,26 @@
"fooValue": {
"type": "array",
"value": "[__bicep.fooTest()]"
},
"likeExactMatch": {
"type": "bool",
"value": "[like('abc', 'abc')]"
},
"likeWildCardMatch": {
"type": "bool",
"value": "[like('abcdef', 'a*c*')]"
},
"distinctTest": {
"type": "array",
"value": "[distinct(createArray('a', 'b', 'a', 'c', 'b'))]"
},
"distinctTest2": {
"type": "array",
"value": "[distinct(createArray(1, 2, 3, 1, 2, 4))]"
},
"distinctTest3": {
"type": "array",
"value": "[distinct(createArray(createObject('a', 1), createObject('a', 1), createObject('b', 2)))]"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,19 @@ func buildUrlMultiLine(
//@[02:006) Local path. Type: string. Declaration start char: 2, length: 11
) string => '${https ? 'https' : 'http'}://${hostname}${empty(path) ? '' : '/${path}'}'

output likeExactMatch bool =like('abc', 'abc')
//@[07:021) Output likeExactMatch. Type: bool. Declaration start char: 0, length: 46
output likeWildCardMatch bool= like ('abcdef', 'a*c*')
//@[07:024) Output likeWildCardMatch. Type: bool. Declaration start char: 0, length: 54
output distinctTest array = distinct(['a','b','a','c','b'])
//@[07:019) Output distinctTest. Type: array. Declaration start char: 0, length: 59
output distinctTest2 array = distinct([1,2,3,1,2,4])
//@[07:020) Output distinctTest2. Type: array. Declaration start char: 0, length: 52
output distinctTest3 array = distinct([{a:1}, {a:1}, {b:2}])
//@[07:020) Output distinctTest3. Type: array. Declaration start char: 0, length: 60






Loading
Loading