-
Notifications
You must be signed in to change notification settings - Fork 775
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes for various minor decompiler issues (#5887)
* Fixes for issues 4896, 5881 & 5630 * Add repro for issue 2569 * Fix for issue 2162 * Add repro for issue 2639 * Fix for issue 2335 * Address PR comments
- Loading branch information
1 parent
8542f75
commit 39bef95
Showing
16 changed files
with
314 additions
and
69 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
8 changes: 8 additions & 0 deletions
8
src/Bicep.Decompiler.IntegrationTests/Working/issue2162/main.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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
resource foo 'Microsoft.Storage/storageAccounts@2021-01-01' = { | ||
name: 'foo' | ||
kind: 'StorageV2' | ||
location: '' | ||
sku: { | ||
name: 'Standard_RAGRS' | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/Bicep.Decompiler.IntegrationTests/Working/issue2162/main.json
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", | ||
"contentVersion": "1.0.0.0", | ||
"functions": [], | ||
"resources": [ | ||
{ | ||
"type": "Microsoft.Storage/storageAccounts/", | ||
"apiVersion": "2021-01-01", | ||
"name": "foo", | ||
"kind": "StorageV2", | ||
"location": "", | ||
"sku": { | ||
"name": "Standard_RAGRS" | ||
} | ||
} | ||
] | ||
} |
1 change: 1 addition & 0 deletions
1
src/Bicep.Decompiler.IntegrationTests/Working/issue2335/main.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 |
---|---|---|
@@ -0,0 +1 @@ | ||
var foo = '{"fooKey": "bar"}' |
7 changes: 7 additions & 0 deletions
7
src/Bicep.Decompiler.IntegrationTests/Working/issue2335/main.json
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", | ||
"contentVersion": "1.0.0.0", | ||
"variables": { | ||
"foo": "[format('{{\"fooKey\": \"{0}\"}}', 'bar')]" | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
src/Bicep.Decompiler.IntegrationTests/Working/issue2569/main.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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
param siteName string | ||
|
||
var apiSiteName = siteName | ||
var apiAppInsightsName = '${siteName}Insights' |
13 changes: 13 additions & 0 deletions
13
src/Bicep.Decompiler.IntegrationTests/Working/issue2569/main.json
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", | ||
"contentVersion": "1.0.0.0", | ||
"parameters": { | ||
"siteName": { | ||
"type": "string" | ||
} | ||
}, | ||
"variables": { | ||
"apiSiteName": "[concat(parameters('siteName'), '')]", | ||
"apiAppInsightsName": "[concat(parameters('siteName'), 'Insights')]" | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/Bicep.Decompiler.IntegrationTests/Working/issue2639/main.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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
param deployAutomationModules string | ||
param automationAccountName string | ||
param location string | ||
|
||
var automationModules = { | ||
modules: [ | ||
{ | ||
Name: 'foo' | ||
url: 'https://foo.com' | ||
} | ||
] | ||
} | ||
|
||
resource automationAccountName_automationModules_modules_Name 'Microsoft.Automation/automationAccounts/modules@2015-10-31' = [for i in range(0, length(automationModules.modules)): if (deployAutomationModules == 'true') { | ||
name: '${automationAccountName}/${automationModules.modules[i].Name}' | ||
location: location | ||
properties: { | ||
contentLink: { | ||
uri: automationModules.modules[i].url | ||
} | ||
} | ||
dependsOn: [ | ||
resourceId('Microsoft.Automation/automationAccounts/', automationAccountName) | ||
//@[4:81) [BCP034 (Error)] The enclosing array expected an item of type "module[] | (resource | module) | resource[]", but the provided item was of type "string". (CodeDescription: none) |resourceId('Microsoft.Automation/automationAccounts/', automationAccountName)| | ||
] | ||
}] |
46 changes: 46 additions & 0 deletions
46
src/Bicep.Decompiler.IntegrationTests/Working/issue2639/main.json
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", | ||
"contentVersion": "1.0.0.0", | ||
"parameters": { | ||
"deployAutomationModules": { | ||
"type": "string" | ||
}, | ||
"automationAccountName": { | ||
"type": "string" | ||
}, | ||
"location": { | ||
"type": "string" | ||
} | ||
}, | ||
"variables": { | ||
"automationModules": { | ||
"modules": [ | ||
{ | ||
"Name": "foo", | ||
"url": "https://foo.com" | ||
} | ||
] | ||
} | ||
}, | ||
"resources": [ | ||
{ | ||
"condition": "[equals(parameters('deployAutomationModules'),'true')]", | ||
"apiVersion": "2015-10-31", | ||
"type": "Microsoft.Automation/automationAccounts/modules", | ||
"name": "[concat(parameters('automationAccountName'), '/', variables('automationModules').modules[copyIndex()].Name)]", | ||
"location": "[parameters('location')]", | ||
"dependsOn": [ | ||
"[resourceId('Microsoft.Automation/automationAccounts/', parameters('automationAccountName'))]" | ||
], | ||
"copy": { | ||
"name": "modulesLoop", | ||
"count": "[length(variables('automationModules').modules)]" | ||
}, | ||
"properties": { | ||
"contentLink": { | ||
"uri": "[variables('automationModules').modules[copyIndex()].url]" | ||
} | ||
} | ||
} | ||
] | ||
} |
2 changes: 2 additions & 0 deletions
2
src/Bicep.Decompiler.IntegrationTests/Working/issue4896/main.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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@description('The name of the Resource Group the VM(s) was/were created in.') | ||
output virtualMachinesResourceGroup string = resourceGroup().name |
13 changes: 13 additions & 0 deletions
13
src/Bicep.Decompiler.IntegrationTests/Working/issue4896/main.json
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", | ||
"contentVersion": "1.0.0.0", | ||
"outputs": { | ||
"virtualMachinesResourceGroup": { | ||
"type": "string", | ||
"value": "[resourceGroup().name]", | ||
"metadata": { | ||
"description": "The name of the Resource Group the VM(s) was/were created in." | ||
} | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/Bicep.Decompiler.IntegrationTests/Working/issue5881/main.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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
var foo = 'abc' | ||
var bar = guid(subscription().id, 'xxxx', foo) | ||
var abc = guid('blah') | ||
var def = { | ||
'1234': '1234' | ||
'${guid('blah')}': guid('blah') | ||
} |
13 changes: 13 additions & 0 deletions
13
src/Bicep.Decompiler.IntegrationTests/Working/issue5881/main.json
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", | ||
"contentVersion": "1.0.0.0", | ||
"variables": { | ||
"foo": "abc", | ||
"bar": "[format('{0}', guid(subscription().id, 'xxxx', variables('foo')))]", | ||
"abc": "[format('{0}', guid('blah'))]", | ||
"def": { | ||
"[format('{0}', 1234)]": "[format('{0}', 1234)]", | ||
"[format('{0}', guid('blah'))]": "[format('{0}', guid('blah'))]" | ||
} | ||
} | ||
} |
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
Oops, something went wrong.