forked from Azure/bicep
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Permit newline in lambda arguments and function definition arguments (A…
…zure#13043) Permit newline in lambda arguments and function definition arguments Closes Azure#12913 ###### Microsoft Reviewers: [Open in CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/Azure/bicep/pull/13043)
- Loading branch information
1 parent
12cb7b8
commit e321ef8
Showing
50 changed files
with
2,085 additions
and
760 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
251 changes: 146 additions & 105 deletions
251
src/Bicep.Core.Samples/Files/baselines/Functions_LF/main.ir.bicep
Large diffs are not rendered by default.
Oops, something went wrong.
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
73 changes: 47 additions & 26 deletions
73
src/Bicep.Core.Samples/Files/baselines/Functions_LF/main.symbols.bicep
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,83 @@ | ||
func buildUrl(https bool, hostname string, path string) string => '${https ? 'https' : 'http'}:https://${hostname}${empty(path) ? '' : '/${path}'}' | ||
//@[14:19) Local https. Type: bool. Declaration start char: 14, length: 10 | ||
//@[26:34) Local hostname. Type: string. Declaration start char: 26, length: 15 | ||
//@[43:47) Local path. Type: string. Declaration start char: 43, length: 11 | ||
//@[05:13) Function buildUrl. Type: (bool, string, string) => string. Declaration start char: 0, length: 141 | ||
//@[14:019) Local https. Type: bool. Declaration start char: 14, length: 10 | ||
//@[26:034) Local hostname. Type: string. Declaration start char: 26, length: 15 | ||
//@[43:047) Local path. Type: string. Declaration start char: 43, length: 11 | ||
//@[05:013) Function buildUrl. Type: (bool, string, string) => string. Declaration start char: 0, length: 141 | ||
|
||
output foo string = buildUrl(true, 'google.com', 'search') | ||
//@[07:10) Output foo. Type: string. Declaration start char: 0, length: 58 | ||
//@[07:010) Output foo. Type: string. Declaration start char: 0, length: 58 | ||
|
||
func sayHello(name string) string => 'Hi ${name}!' | ||
//@[14:18) Local name. Type: string. Declaration start char: 14, length: 11 | ||
//@[05:13) Function sayHello. Type: string => string. Declaration start char: 0, length: 50 | ||
//@[14:018) Local name. Type: string. Declaration start char: 14, length: 11 | ||
//@[05:013) Function sayHello. Type: string => string. Declaration start char: 0, length: 50 | ||
|
||
output hellos array = map(['Evie', 'Casper'], name => sayHello(name)) | ||
//@[46:50) Local name. Type: 'Casper' | 'Evie'. Declaration start char: 46, length: 4 | ||
//@[07:13) Output hellos. Type: array. Declaration start char: 0, length: 69 | ||
//@[46:050) Local name. Type: 'Casper' | 'Evie'. Declaration start char: 46, length: 4 | ||
//@[07:013) Output hellos. Type: array. Declaration start char: 0, length: 69 | ||
|
||
func objReturnType(name string) object => { | ||
//@[19:23) Local name. Type: string. Declaration start char: 19, length: 11 | ||
//@[05:18) Function objReturnType. Type: string => object. Declaration start char: 0, length: 68 | ||
//@[19:023) Local name. Type: string. Declaration start char: 19, length: 11 | ||
//@[05:018) Function objReturnType. Type: string => object. Declaration start char: 0, length: 68 | ||
hello: 'Hi ${name}!' | ||
} | ||
|
||
func arrayReturnType(name string) array => [ | ||
//@[21:25) Local name. Type: string. Declaration start char: 21, length: 11 | ||
//@[05:20) Function arrayReturnType. Type: string => [string]. Declaration start char: 0, length: 53 | ||
//@[21:025) Local name. Type: string. Declaration start char: 21, length: 11 | ||
//@[05:020) Function arrayReturnType. Type: string => [string]. Declaration start char: 0, length: 53 | ||
name | ||
] | ||
|
||
func asdf(name string) array => [ | ||
//@[10:14) Local name. Type: string. Declaration start char: 10, length: 11 | ||
//@[05:09) Function asdf. Type: string => ['asdf', string]. Declaration start char: 0, length: 51 | ||
//@[10:014) Local name. Type: string. Declaration start char: 10, length: 11 | ||
//@[05:009) Function asdf. Type: string => ['asdf', string]. Declaration start char: 0, length: 51 | ||
'asdf' | ||
name | ||
] | ||
|
||
@minValue(0) | ||
type positiveInt = int | ||
//@[05:16) TypeAlias positiveInt. Type: Type<int>. Declaration start char: 0, length: 35 | ||
//@[05:016) TypeAlias positiveInt. Type: Type<int>. Declaration start char: 0, length: 35 | ||
|
||
func typedArg(input string[]) positiveInt => length(input) | ||
//@[14:19) Local input. Type: string[]. Declaration start char: 14, length: 14 | ||
//@[05:13) Function typedArg. Type: string[] => int. Declaration start char: 0, length: 58 | ||
//@[14:019) Local input. Type: string[]. Declaration start char: 14, length: 14 | ||
//@[05:013) Function typedArg. Type: string[] => int. Declaration start char: 0, length: 58 | ||
|
||
func barTest() array => ['abc', 'def'] | ||
//@[05:12) Function barTest. Type: () => ['abc', 'def']. Declaration start char: 0, length: 38 | ||
//@[05:012) Function barTest. Type: () => ['abc', 'def']. Declaration start char: 0, length: 38 | ||
func fooTest() array => map(barTest(), a => 'Hello ${a}!') | ||
//@[39:40) Local a. Type: any. Declaration start char: 39, length: 1 | ||
//@[05:12) Function fooTest. Type: () => string[]. Declaration start char: 0, length: 58 | ||
//@[39:040) Local a. Type: any. Declaration start char: 39, length: 1 | ||
//@[05:012) Function fooTest. Type: () => string[]. Declaration start char: 0, length: 58 | ||
|
||
output fooValue array = fooTest() | ||
//@[07:15) Output fooValue. Type: array. Declaration start char: 0, length: 33 | ||
//@[07:015) Output fooValue. Type: array. Declaration start char: 0, length: 33 | ||
|
||
func test() object => loadJsonContent('./repro-data.json') | ||
//@[05:09) Function test. Type: () => object. Declaration start char: 0, length: 58 | ||
//@[05:009) Function test. Type: () => object. Declaration start char: 0, length: 58 | ||
func test2() string => loadTextContent('./repro-data.json') | ||
//@[05:10) Function test2. Type: () => '{}'. Declaration start char: 0, length: 59 | ||
//@[05:010) Function test2. Type: () => '{}'. Declaration start char: 0, length: 59 | ||
func test3() object => loadYamlContent('./repro-data.json') | ||
//@[05:10) Function test3. Type: () => object. Declaration start char: 0, length: 59 | ||
//@[05:010) Function test3. Type: () => object. Declaration start char: 0, length: 59 | ||
func test4() string => loadFileAsBase64('./repro-data.json') | ||
//@[05:10) Function test4. Type: () => repro-data.json. Declaration start char: 0, length: 60 | ||
//@[05:010) Function test4. Type: () => repro-data.json. Declaration start char: 0, length: 60 | ||
|
||
// validate formatter works (https://github.com/Azure/bicep/issues/12913) | ||
func a(____________________________________________________________________________________________ string) string => 'a' | ||
//@[07:099) Local ____________________________________________________________________________________________. Type: string. Declaration start char: 7, length: 99 | ||
//@[05:006) Function a. Type: string => 'a'. Declaration start char: 0, length: 121 | ||
func b(longParameterName1 string, longParameterName2 string, longParameterName3 string, longParameterName4 string) string => 'b' | ||
//@[07:025) Local longParameterName1. Type: string. Declaration start char: 7, length: 25 | ||
//@[34:052) Local longParameterName2. Type: string. Declaration start char: 34, length: 25 | ||
//@[61:079) Local longParameterName3. Type: string. Declaration start char: 61, length: 25 | ||
//@[88:106) Local longParameterName4. Type: string. Declaration start char: 88, length: 25 | ||
//@[05:006) Function b. Type: (string, string, string, string) => 'b'. Declaration start char: 0, length: 128 | ||
|
||
func buildUrlMultiLine( | ||
//@[05:022) Function buildUrlMultiLine. Type: (bool, string, string) => string. Declaration start char: 0, length: 158 | ||
https bool, | ||
//@[02:007) Local https. Type: bool. Declaration start char: 2, length: 10 | ||
hostname string, | ||
//@[02:010) Local hostname. Type: string. Declaration start char: 2, length: 15 | ||
path string | ||
//@[02:006) Local path. Type: string. Declaration start char: 2, length: 11 | ||
) string => '${https ? 'https' : 'http'}:https://${hostname}${empty(path) ? '' : '/${path}'}' | ||
|
Oops, something went wrong.