diff --git a/src/Compiler/Driver/CompilerImports.fs b/src/Compiler/Driver/CompilerImports.fs index f0868919ad0..46a3b83b604 100644 --- a/src/Compiler/Driver/CompilerImports.fs +++ b/src/Compiler/Driver/CompilerImports.fs @@ -2341,6 +2341,12 @@ and [] TcImports let! ccuinfos = phase2s |> runMethod if importsBase.IsSome then + let addConstraintSources (ia: ImportedAssembly) = + // Only an F# assembly can carry a trait constraint to label. + // Prevent force-reading of the whole assembly namespace tree for other assemblies. + if ia.FSharpViewOfMetadata.IsFSharp then + addConstraintSources ia + importsBase.Value.CcuTable.Values |> Seq.iter addConstraintSources ccuTable.Values |> Seq.iter addConstraintSources