Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

var loops and completion fixes #2077

Merged
merged 2 commits into from
Apr 1, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions src/Bicep.Core.Samples/Files/InvalidOutputs_CRLF/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ output missingValueAndType =
// #completionTest(28,29) -> symbols
output missingValue string =

// #completionTest(31,32) -> arrayPlusSymbols
output arrayCompletions array =

// #completionTest(33,34) -> objectPlusSymbols
output objectCompletions object =

// #completionTest(29,30) -> boolPlusSymbols
output boolCompletions bool =

output foo

// space after identifier #completionTest(20) -> outputTypes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ output missingValueAndType =
output missingValue string =
//@[29:29) [BCP009 (Error)] Expected a literal value, an array, an object, a parenthesized expression, or a function call at this location. ||

// #completionTest(31,32) -> arrayPlusSymbols
output arrayCompletions array =
//@[32:32) [BCP009 (Error)] Expected a literal value, an array, an object, a parenthesized expression, or a function call at this location. ||

// #completionTest(33,34) -> objectPlusSymbols
output objectCompletions object =
//@[34:34) [BCP009 (Error)] Expected a literal value, an array, an object, a parenthesized expression, or a function call at this location. ||

// #completionTest(29,30) -> boolPlusSymbols
output boolCompletions bool =
//@[30:30) [BCP009 (Error)] Expected a literal value, an array, an object, a parenthesized expression, or a function call at this location. ||

output foo
//@[7:10) [BCP145 (Error)] Output "foo" is declared multiple times. Remove or rename the duplicates. |foo|
//@[10:10) [BCP146 (Error)] Expected an output type at this location. Please specify one of the following types: "array", "bool", "int", "object", "string". ||
Expand Down Expand Up @@ -191,21 +203,21 @@ output noNestedLoops array = [for thing in things: {
//@[43:49) [BCP057 (Error)] The name "things" does not exist in the current context. |things|
something: [
[for thing in things: true]
//@[5:8) [BCP138 (Error)] For-expressions are not supported in this context. For-expressions may be used as values of resource and module declarations, values of resource and module properties, or values of outputs. |for|
//@[5:8) [BCP138 (Error)] For-expressions are not supported in this context. For-expressions may be used as values of resource, module, variable, and output declarations, or values of resource and module properties. |for|
//@[18:24) [BCP057 (Error)] The name "things" does not exist in the current context. |things|
]
}]

// loops in inner properties inside outputs are not supported
output noInnerLoopsInOutputs object = {
a: [for i in range(0,10): i]
//@[6:9) [BCP138 (Error)] For-expressions are not supported in this context. For-expressions may be used as values of resource and module declarations, values of resource and module properties, or values of outputs. |for|
//@[6:9) [BCP138 (Error)] For-expressions are not supported in this context. For-expressions may be used as values of resource, module, variable, and output declarations, or values of resource and module properties. |for|
}
output noInnerLoopsInOutputs2 object = {
a: [for i in range(0,10): {
//@[6:9) [BCP138 (Error)] For-expressions are not supported in this context. For-expressions may be used as values of resource and module declarations, values of resource and module properties, or values of outputs. |for|
//@[6:9) [BCP138 (Error)] For-expressions are not supported in this context. For-expressions may be used as values of resource, module, variable, and output declarations, or values of resource and module properties. |for|
b: [for j in range(0,10): i+j]
//@[8:11) [BCP138 (Error)] For-expressions are not supported in this context. For-expressions may be used as values of resource and module declarations, values of resource and module properties, or values of outputs. |for|
//@[8:11) [BCP138 (Error)] For-expressions are not supported in this context. For-expressions may be used as values of resource, module, variable, and output declarations, or values of resource and module properties. |for|
}]
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ output missingValueAndType =
// #completionTest(28,29) -> symbols
output missingValue string =

// #completionTest(31,32) -> arrayPlusSymbols
output arrayCompletions array =

// #completionTest(33,34) -> objectPlusSymbols
output objectCompletions object =

// #completionTest(29,30) -> boolPlusSymbols
output boolCompletions bool =

output foo

// space after identifier #completionTest(20) -> outputTypes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ output missingValueAndType =
output missingValue string =
//@[7:19) Output missingValue. Type: string. Declaration start char: 0, length: 29

// #completionTest(31,32) -> arrayPlusSymbols
output arrayCompletions array =
//@[7:23) Output arrayCompletions. Type: array. Declaration start char: 0, length: 32

// #completionTest(33,34) -> objectPlusSymbols
output objectCompletions object =
//@[7:24) Output objectCompletions. Type: object. Declaration start char: 0, length: 34

// #completionTest(29,30) -> boolPlusSymbols
output boolCompletions bool =
//@[7:22) Output boolCompletions. Type: bool. Declaration start char: 0, length: 30

output foo
//@[7:10) Output foo. Type: any. Declaration start char: 0, length: 10

Expand Down
39 changes: 39 additions & 0 deletions src/Bicep.Core.Samples/Files/InvalidOutputs_CRLF/main.syntax.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,45 @@ output missingValue string =
//@[29:29) SkippedTriviaSyntax
//@[29:33) NewLine |\r\n\r\n|

// #completionTest(31,32) -> arrayPlusSymbols
//@[45:47) NewLine |\r\n|
output arrayCompletions array =
//@[0:32) OutputDeclarationSyntax
//@[0:6) Identifier |output|
//@[7:23) IdentifierSyntax
//@[7:23) Identifier |arrayCompletions|
//@[24:29) TypeSyntax
//@[24:29) Identifier |array|
//@[30:31) Assignment |=|
//@[32:32) SkippedTriviaSyntax
//@[32:36) NewLine |\r\n\r\n|

// #completionTest(33,34) -> objectPlusSymbols
//@[46:48) NewLine |\r\n|
output objectCompletions object =
//@[0:34) OutputDeclarationSyntax
//@[0:6) Identifier |output|
//@[7:24) IdentifierSyntax
//@[7:24) Identifier |objectCompletions|
//@[25:31) TypeSyntax
//@[25:31) Identifier |object|
//@[32:33) Assignment |=|
//@[34:34) SkippedTriviaSyntax
//@[34:38) NewLine |\r\n\r\n|

// #completionTest(29,30) -> boolPlusSymbols
//@[44:46) NewLine |\r\n|
output boolCompletions bool =
//@[0:30) OutputDeclarationSyntax
//@[0:6) Identifier |output|
//@[7:22) IdentifierSyntax
//@[7:22) Identifier |boolCompletions|
//@[23:27) TypeSyntax
//@[23:27) Identifier |bool|
//@[28:29) Assignment |=|
//@[30:30) SkippedTriviaSyntax
//@[30:34) NewLine |\r\n\r\n|

output foo
//@[0:10) OutputDeclarationSyntax
//@[0:6) Identifier |output|
Expand Down
27 changes: 27 additions & 0 deletions src/Bicep.Core.Samples/Files/InvalidOutputs_CRLF/main.tokens.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,33 @@ output missingValue string =
//@[27:28) Assignment |=|
//@[29:33) NewLine |\r\n\r\n|

// #completionTest(31,32) -> arrayPlusSymbols
//@[45:47) NewLine |\r\n|
output arrayCompletions array =
//@[0:6) Identifier |output|
//@[7:23) Identifier |arrayCompletions|
//@[24:29) Identifier |array|
//@[30:31) Assignment |=|
//@[32:36) NewLine |\r\n\r\n|

// #completionTest(33,34) -> objectPlusSymbols
//@[46:48) NewLine |\r\n|
output objectCompletions object =
//@[0:6) Identifier |output|
//@[7:24) Identifier |objectCompletions|
//@[25:31) Identifier |object|
//@[32:33) Assignment |=|
//@[34:38) NewLine |\r\n\r\n|

// #completionTest(29,30) -> boolPlusSymbols
//@[44:46) NewLine |\r\n|
output boolCompletions bool =
//@[0:6) Identifier |output|
//@[7:22) Identifier |boolCompletions|
//@[23:27) Identifier |bool|
//@[28:29) Assignment |=|
//@[30:34) NewLine |\r\n\r\n|

output foo
//@[0:6) Identifier |output|
//@[7:10) Identifier |foo|
Expand Down
Loading