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

Fix for issue 13531 #13532

Merged
merged 1 commit into from Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/Bicep.Core.IntegrationTests/ScenarioTests.cs
Expand Up @@ -5622,6 +5622,27 @@ public void Test_Issue12908()
});
}

// https://github.com/Azure/bicep/issues/13531
[TestMethod]
public void Test_Issue13531()
{
var result = CompilationHelper.CompileParams(
("parameters.bicepparam", """
using 'main.bicep'

param location = location
"""),
("main.bicep", """
#disable-next-line no-unused-params
param location string
"""));

result.Should().HaveDiagnostics(new[]
{
("BCP079", DiagnosticLevel.Error, """This expression is referencing its own declaration, which is not allowed."""),
});
}

[TestMethod]
public void Functions_can_be_imported_in_bicepparam_files()
{
Expand Down
14 changes: 7 additions & 7 deletions src/Bicep.Core/Emit/EmitLimitationCalculator.cs
Expand Up @@ -513,6 +513,13 @@ private static void BlockCyclicAggregateTypeReferences(SemanticModel model, IDia

foreach (var symbol in GetTopologicallySortedSymbols(referencesInValues))
{
if (symbol.Type is ErrorType)
{
// no point evaluating if we're already reporting an error
erroredSymbols.Add(symbol);
continue;
}

var referencedValueHasError = false;
foreach (var referenced in referencesInValues[symbol])
{
Expand Down Expand Up @@ -547,13 +554,6 @@ private static void BlockCyclicAggregateTypeReferences(SemanticModel model, IDia
continue;
}

if (parameter.Type is ErrorType)
{
// no point evaluating if we're already reporting an error
erroredSymbols.Add(parameter);
continue;
}

// We may emit duplicate errors here - type checking will also execute some ARM functions and generate errors
// This is something we should improve before the first release.
var result = evaluator.EvaluateParameter(parameter);
Expand Down