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

decompile generates incorrect code for empty concat string #2569

Closed
NeilMacMullen opened this issue May 7, 2021 · 3 comments · Fixed by #5887
Closed

decompile generates incorrect code for empty concat string #2569

NeilMacMullen opened this issue May 7, 2021 · 3 comments · Fixed by #5887
Labels
bug Something isn't working story: decompiler

Comments

@NeilMacMullen
Copy link

Bicep version
2.23.0
Describe the bug

When concatenating an empty string, BICEP decompiler gets very confused and generates invalid BICEP...

Source ARM

 "variables": {
    "apiSiteName": "[concat(parameters('siteName'), '')]",
    "apiAppInsightsName": "[concat(parameters('siteName'), 'Insights')]"
  },

Output BICEP

var apiSiteName_var = 'siteName${
var apiAppInsightsName_var = '${siteName}Insights'
@ghost ghost added the Needs: Triage 🔍 label May 7, 2021
@alex-frankel
Copy link
Collaborator

Interesting - first can you double check the version number? Bicep's latest release is 0.3.255.

What is the scenario in which you'd want to concat an empty string? isn't that a no-op?

@NeilMacMullen
Copy link
Author

➜ az bicep version
Bicep CLI version 0.3.255 (589f0375df)

What is the scenario in which you'd want to concat an empty string? isn't that a no-op?

Yes it is. It was just a manual tweak to an ARM template that was originally catting some text to a parameter. I wanted to temporary sidestep the catting and it was quicker to cat an empty string than remove the entire concat call.

It's a fairly unlikely case in practice but may indicate a more general problem with empty strings....

@alex-frankel alex-frankel added bug Something isn't working story: decompiler and removed awaiting response labels May 7, 2021
@majastrz
Copy link
Member

majastrz commented May 8, 2021

I think we should fix this regardless of the validity of the scenario. Most likely a super simple fix.

@ghost ghost locked as resolved and limited conversation to collaborators May 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working story: decompiler
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants