From 42b1f1d89fc4f64fedfcaaed7738aaa98251c648 Mon Sep 17 00:00:00 2001 From: kevmal Date: Fri, 15 Mar 2019 16:23:48 -0600 Subject: [PATCH] append extension methods in GetRelevantMethodsForTrait --- src/fsharp/ConstraintSolver.fs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/fsharp/ConstraintSolver.fs b/src/fsharp/ConstraintSolver.fs index eed577215c2..27139f79172 100644 --- a/src/fsharp/ConstraintSolver.fs +++ b/src/fsharp/ConstraintSolver.fs @@ -1536,6 +1536,17 @@ and GetRelevantMethodsForTrait (csenv:ConstraintSolverEnv) permitWeakResolution // We merge based on whether minfos use identical metadata or not. let minfos = List.reduce (ListSet.unionFavourLeft MethInfo.MethInfosUseIdenticalDefinitions) minfos + // Get the extension method that may be relevant to solving the constraint as MethInfo objects. + // Extension members are not used when canonicalizing prior to generalization (permitWeakResolution=true) + let extMInfos = + if MemberConstraintSupportIsReadyForDeterminingOverloads csenv traitInfo then + GetRelevantExtensionMethodsForTrait csenv.m csenv.amap traitInfo + else [] + + let extMInfos = extMInfos |> ListSet.setify MethInfo.MethInfosUseIdenticalDefinitions + + let minfos = minfos @ extMInfos + /// Check that the available members aren't hiding a member from the parent (depth 1 only) let relevantMinfos = minfos |> List.filter(fun minfo -> not minfo.IsDispatchSlot && not minfo.IsVirtual && minfo.IsInstance) minfos