@@ -82,12 +82,14 @@ let emptyTyparInst = ([] : TyparInst)
8282type Remap =
8383 { tpinst : TyparInst ;
8484 valRemap: ValRemap ;
85- tyconRefRemap : TyconRefRemap }
85+ tyconRefRemap : TyconRefRemap ;
86+ removeTraitSolutions: bool }
8687
8788let emptyRemap =
8889 { tpinst = emptyTyparInst;
8990 tyconRefRemap = emptyTyconRefRemap;
90- valRemap = ValMap.Empty }
91+ valRemap = ValMap.Empty;
92+ removeTraitSolutions = false }
9193
9294type Remap with
9395 static member Empty = emptyRemap
@@ -228,6 +230,7 @@ and remapTraitAux tyenv (TTrait(typs,nm,mf,argtys,rty,slnCell)) =
228230 let slnCell =
229231 match ! slnCell with
230232 | None -> None
233+ | _ when tyenv.removeTraitSolutions -> None
231234 | Some sln ->
232235 let sln =
233236 match sln with
@@ -343,7 +346,8 @@ let remapSlotSig remapAttrib tyenv (TSlotSig(nm,typ, ctps,methTypars,paraml, rty
343346let mkInstRemap tpinst =
344347 { tyconRefRemap = emptyTyconRefRemap;
345348 tpinst = tpinst;
346- valRemap = ValMap.Empty }
349+ valRemap = ValMap.Empty;
350+ removeTraitSolutions = false }
347351
348352// entry points for "typar -> TType" instantiation
349353let instType tpinst x = if List.isEmpty tpinst then x else remapTypeAux ( mkInstRemap tpinst) x
@@ -1264,6 +1268,8 @@ let tryRescopeEntity viewedCcu (entity:Entity) : EntityRef option =
12641268let tryRescopeVal viewedCcu ( entityRemap : Remap ) ( vspec : Val ) : ValRef option =
12651269 match vspec.PublicPath with
12661270 | Some ( ValPubPath( p, fullLinkageKey)) ->
1271+ // The type information in the val linkage doesn't need to keep any information to trait solutions.
1272+ let entityRemap = { entityRemap with removeTraitSolutions = true }
12671273 let fullLinkageKey = remapValLinkage entityRemap fullLinkageKey
12681274 let vref =
12691275 // This compensates for the somewhat poor design decision in the F# compiler and metadata where
@@ -3482,7 +3488,8 @@ let addValRemap v v' tmenv =
34823488let mkRepackageRemapping mrpi =
34833489 { valRemap = ValMap.OfList ( mrpi.mrpiVals |> List.map ( fun ( vref , x ) -> vref.Deref, x));
34843490 tpinst = emptyTyparInst;
3485- tyconRefRemap = TyconRefMap.OfList mrpi.mrpiEntities }
3491+ tyconRefRemap = TyconRefMap.OfList mrpi.mrpiEntities
3492+ removeTraitSolutions = false }
34863493
34873494//--------------------------------------------------------------------------
34883495// Compute instances of the above for mty -> mty
0 commit comments