diff --git a/src/QsCompiler/Tests.Compiler/CallGraphTests.fs b/src/QsCompiler/Tests.Compiler/CallGraphTests.fs index 49e5567df7..05eb315638 100644 --- a/src/QsCompiler/Tests.Compiler/CallGraphTests.fs +++ b/src/QsCompiler/Tests.Compiler/CallGraphTests.fs @@ -334,7 +334,7 @@ type CallGraphTests (output:ITestOutputHelper) = AssertNotInConcreteGraph graph FooEmpty AssertNotInConcreteGraph graph BarEmpty - [] + [] [] member this.``Concrete Graph Trims Specializations`` () = let graph = PopulateCallGraphWithExe 10 |> ConcreteCallGraph diff --git a/src/QsCompiler/Tests.Compiler/LinkingTests.fs b/src/QsCompiler/Tests.Compiler/LinkingTests.fs index c1fc888bff..1698c92f6d 100644 --- a/src/QsCompiler/Tests.Compiler/LinkingTests.fs +++ b/src/QsCompiler/Tests.Compiler/LinkingTests.fs @@ -207,7 +207,7 @@ type LinkingTests (output:ITestOutputHelper) = "Callables originally public should remain public if all arguments are public.") - [] + [] [] member this.``Monomorphization Basic Implementation`` () = diff --git a/src/QsCompiler/Transformations/CallGraph/ConcreteCallGraphWalker.cs b/src/QsCompiler/Transformations/CallGraph/ConcreteCallGraphWalker.cs index c7f8727031..ec24a4b3be 100644 --- a/src/QsCompiler/Transformations/CallGraph/ConcreteCallGraphWalker.cs +++ b/src/QsCompiler/Transformations/CallGraph/ConcreteCallGraphWalker.cs @@ -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. @@ -227,7 +233,8 @@ internal override void AddDependency(QsQualifiedName identifier) { AddEdge(kind); } - } + + // } } ///