Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More tryTcrefOfAppTy optimizations #9246

Merged
merged 1 commit into from
May 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/fsharp/AccessibilityLogic.fs
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,13 @@ and IsTypeInstAccessible g amap m ad tinst =
/// Indicate if a provided member is accessible
let IsProvidedMemberAccessible (amap:Import.ImportMap) m ad ty access =
let g = amap.g
let isTyAccessible = IsTypeAccessible g amap m ad ty
if not isTyAccessible then false
if IsTypeAccessible g amap m ad ty then
match tryTcrefOfAppTy g ty with
| ValueNone -> true
| ValueSome tcrefOfViewedItem ->
IsILMemberAccessible g amap m tcrefOfViewedItem ad access
else
not (isAppTy g ty) ||
let tcrefOfViewedItem = tcrefOfAppTy g ty
IsILMemberAccessible g amap m tcrefOfViewedItem ad access
false

/// Compute the accessibility of a provided member
let ComputeILAccess isPublic isFamily isFamilyOrAssembly isFamilyAndAssembly =
Expand Down
6 changes: 5 additions & 1 deletion src/fsharp/LowerCallsAndSeqs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,11 @@ let ConvertSequenceExprToObject g amap overallExpr =
// printfn "FAILED - not worth compiling an unrecognized immediate yield! %s " (stringOfRange m)
None
else
let tyConfirmsToSeq g ty = isAppTy g ty && tyconRefEq g (tcrefOfAppTy g ty) g.tcref_System_Collections_Generic_IEnumerable
let tyConfirmsToSeq g ty =
match tryTcrefOfAppTy g ty with
| ValueSome tcref ->
tyconRefEq g tcref g.tcref_System_Collections_Generic_IEnumerable
| _ -> false
match SearchEntireHierarchyOfType (tyConfirmsToSeq g) g amap m (tyOfExpr g arbitrarySeqExpr) with
| None ->
// printfn "FAILED - yield! did not yield a sequence! %s" (stringOfRange m)
Expand Down
6 changes: 3 additions & 3 deletions src/fsharp/MethodCalls.fs
Original file line number Diff line number Diff line change
Expand Up @@ -848,8 +848,8 @@ let MakeMethInfoCall amap m minfo minst args =
let TryImportProvidedMethodBaseAsLibraryIntrinsic (amap: Import.ImportMap, m: range, mbase: Tainted<ProvidedMethodBase>) =
let methodName = mbase.PUntaint((fun x -> x.Name), m)
let declaringType = Import.ImportProvidedType amap m (mbase.PApply((fun x -> x.DeclaringType), m))
if isAppTy amap.g declaringType then
let declaringEntity = tcrefOfAppTy amap.g declaringType
match tryTcrefOfAppTy amap.g declaringType with
| ValueSome declaringEntity ->
if not declaringEntity.IsLocalRef && ccuEq declaringEntity.nlr.Ccu amap.g.fslibCcu then
match amap.g.knownIntrinsics.TryGetValue ((declaringEntity.LogicalName, methodName)) with
| true, vref -> Some vref
Expand All @@ -861,7 +861,7 @@ let TryImportProvidedMethodBaseAsLibraryIntrinsic (amap: Import.ImportMap, m: ra
| _ -> None
else
None
else
| _ ->
None
#endif

Expand Down
6 changes: 3 additions & 3 deletions src/fsharp/NameResolution.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2398,10 +2398,10 @@ let rec ResolveLongIdentInTypePrim (ncenv: NameResolver) nenv lookupKind (resInf
| _ -> ()

let errorTextF s =
if isAppTy g ty then
let tcref = tcrefOfAppTy g ty
match tryTcrefOfAppTy g ty with
| ValueSome tcref ->
FSComp.SR.undefinedNameFieldConstructorOrMemberWhenTypeIsKnown(tcref.DisplayNameWithStaticParametersAndTypars, s)
else
| _ ->
FSComp.SR.undefinedNameFieldConstructorOrMember(s)

raze (UndefinedName (depth, errorTextF, id, suggestMembers))
Expand Down