Skip to content

Commit

Permalink
Use the correct bitwise operator for combining flags (#10325)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeskew authored Apr 5, 2023
1 parent d77dcc7 commit de7fdd2
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
33 changes: 32 additions & 1 deletion src/Bicep.Core.IntegrationTests/ScenarioTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4545,5 +4545,36 @@ param workspaceName string

result.Should().NotHaveAnyDiagnostics();
}

// https://github.com/Azure/bicep/issues/10321
[TestMethod]
public void Test_Issue10321()
{
var result = CompilationHelper.Compile(
("main.bicep", @"
module mod 'mod.json' = {
name: 'mod'
params: {
secret: kv.getSecret('secret')
}
}
resource kv 'Microsoft.KeyVault/vaults@2019-09-01' existing = {
name: 'kv'
}
"),
("mod.json", @"{
""$schema"": ""https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#"",
""contentVersion"": ""1.0.0.0"",
""parameters"": {
""secret"": {
""type"": ""secureString""
}
}
},
""resources"": []
}"));

result.ExcludingLinterDiagnostics().Should().NotHaveAnyDiagnostics();
}
}
}
2 changes: 1 addition & 1 deletion src/Bicep.Core/Semantics/ArmTemplateSemanticModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ TemplateParameterType.String when TryCreateUnboundResourceTypeParameter(resolved
TemplateParameterType.Array => GetArrayType(resolved),
TemplateParameterType.Object => GetObjectType(SourceFile.Template!, resolved),
TemplateParameterType.SecureString => GetStringType(resolved,
TypeSymbolValidationFlags.IsSecure & (allowLooseAssignment ? TypeSymbolValidationFlags.AllowLooseAssignment : TypeSymbolValidationFlags.Default)),
TypeSymbolValidationFlags.IsSecure | (allowLooseAssignment ? TypeSymbolValidationFlags.AllowLooseAssignment : TypeSymbolValidationFlags.Default)),
TemplateParameterType.SecureObject => GetObjectType(SourceFile.Template!, resolved, TypeSymbolValidationFlags.IsSecure),
_ => ErrorType.Empty(),
};
Expand Down

0 comments on commit de7fdd2

Please sign in to comment.