Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/QsCompiler/Tests.Compiler/CallGraphTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ type CallGraphTests (output:ITestOutputHelper) =
AssertNotInConcreteGraph graph FooEmpty
AssertNotInConcreteGraph graph BarEmpty

[<Fact>]
[<Fact(Skip="Workaround for Issue #757 means specialization pruning is disabled.")>]
[<Trait("Category","Populate Call Graph")>]
member this.``Concrete Graph Trims Specializations`` () =
let graph = PopulateCallGraphWithExe 10 |> ConcreteCallGraph
Expand Down
2 changes: 1 addition & 1 deletion src/QsCompiler/Tests.Compiler/LinkingTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ type LinkingTests (output:ITestOutputHelper) =
"Callables originally public should remain public if all arguments are public.")


[<Fact>]
[<Fact(Skip="Workaround for Issue #757 means this test will fail due to unpruned specializations.")>]
[<Trait("Category","Monomorphization")>]
member this.``Monomorphization Basic Implementation`` () =

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,27 +198,33 @@ internal override void AddDependency(QsQualifiedName identifier)

void AddEdge(QsSpecializationKind kind) => this.AddEdge(identifier, kind, typeRes, referenceRange);

if (this.IsInCall)
{
if (this.HasAdjointDependency && this.HasControlledDependency)
{
AddEdge(QsSpecializationKind.QsControlledAdjoint);
}
else if (this.HasAdjointDependency)
{
AddEdge(QsSpecializationKind.QsAdjoint);
}
else if (this.HasControlledDependency)
{
AddEdge(QsSpecializationKind.QsControlled);
}
else
{
AddEdge(QsSpecializationKind.QsBody);
}
}
else
{
// Work around for Issue #757: Because the below code means specializations that are not explicitly
// called don't get an edge, any dependencies specific to those specializations don't get included
// in the graph and may end up getting pruned out. This can cause compilation failures,
// because specializations are not pruned but the dependecies are, leaving behind usage
// of types that don't exist.
// if (this.IsInCall)
// {
// if (this.HasAdjointDependency && this.HasControlledDependency)
// {
// AddEdge(QsSpecializationKind.QsControlledAdjoint);
// }
// else if (this.HasAdjointDependency)
// {
// AddEdge(QsSpecializationKind.QsAdjoint);
// }
// else if (this.HasControlledDependency)
// {
// AddEdge(QsSpecializationKind.QsControlled);
// }
// else
// {
// AddEdge(QsSpecializationKind.QsBody);
// }
// }
// else
// {

// The callable is being used in a non-call context, such as being
// assigned to a variable or passed as an argument to another callable,
// which means it could get a functor applied at some later time.
Expand All @@ -227,7 +233,8 @@ internal override void AddDependency(QsQualifiedName identifier)
{
AddEdge(kind);
}
}

// }
}

/// <summary>
Expand Down