Created
March 3, 2020 14:08
-
-
Save dsyme/f26e78adeadbf7d3802ba162300d33fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let checkMethodImplIsPartialMatchForInterfaceMethod (minfo: MethInfo) (mimpl: ILMethodImpl) = | |
minfo.IsFinal && | |
minfo.IsInterfaceMethod && | |
mimpl.OverrideBy.ArgCount = List.sum minfo.NumArgs && | |
mimpl.OverrideBy.GenericArity = minfo.GenericArity | |
let GetIntrinsicInterfaceOverrideMethodSetsUncached ((optFilter, ad, allowMultiIntfInst), m, ty) = | |
assert optFIlter.IsSome | |
assert isInterfaceTy g ty | |
// Collect all the relevant method impls related to methods of this name | |
(ty,[]) ||> FoldPrimaryHierarchyOfType (fun ty (acc: MethInfo list) -> | |
// Currently, F# supports DIMs from IL types, not F# defined types. | |
match tryAppTy g ty with | |
| ValueSome (tcref, _) when tcref.IsILTycon -> | |
// MethodImpls contains a list of methods that override. | |
// OverrideBy is the method that does the overriding. | |
// Overrides is the method being overriden. | |
// Find the Overrides method first with optFilter, then search for the OverrideBy method. | |
// If the OverrideBy method is found, add it to the method set for that type in the hierarchy. | |
tcref.ILTyconRawMetadata.MethodImpls.AsList | |
|> List.concat (fun mimpl -> | |
if optFilter.Value = mimpl.Overrides.MethodRef.Name then | |
let ovbyName = mimpl.OverrideBy.Name | |
GetImmediateIntrinsicMethInfosOfType (Some ovbyName, ad) g amap m ty | |
|> List.filter (checkMethodImplIsPartialMatchForInterfaceMethod mimpl) | |
else | |
[]) @ acc | |
| _ -> acc | |
) g amap m allowMultiIntfInst | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment