Skip to content

Commit 432d19f

Browse files
authored
Remove isAppTy (#9246)
1 parent ac9485f commit 432d19f

File tree

4 files changed

+17
-12
lines changed

4 files changed

+17
-12
lines changed

src/fsharp/AccessibilityLogic.fs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,13 @@ and IsTypeInstAccessible g amap m ad tinst =
208208
/// Indicate if a provided member is accessible
209209
let IsProvidedMemberAccessible (amap:Import.ImportMap) m ad ty access =
210210
let g = amap.g
211-
let isTyAccessible = IsTypeAccessible g amap m ad ty
212-
if not isTyAccessible then false
211+
if IsTypeAccessible g amap m ad ty then
212+
match tryTcrefOfAppTy g ty with
213+
| ValueNone -> true
214+
| ValueSome tcrefOfViewedItem ->
215+
IsILMemberAccessible g amap m tcrefOfViewedItem ad access
213216
else
214-
not (isAppTy g ty) ||
215-
let tcrefOfViewedItem = tcrefOfAppTy g ty
216-
IsILMemberAccessible g amap m tcrefOfViewedItem ad access
217+
false
217218

218219
/// Compute the accessibility of a provided member
219220
let ComputeILAccess isPublic isFamily isFamilyOrAssembly isFamilyAndAssembly =

src/fsharp/LowerCallsAndSeqs.fs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,11 @@ let ConvertSequenceExprToObject g amap overallExpr =
542542
// printfn "FAILED - not worth compiling an unrecognized immediate yield! %s " (stringOfRange m)
543543
None
544544
else
545-
let tyConfirmsToSeq g ty = isAppTy g ty && tyconRefEq g (tcrefOfAppTy g ty) g.tcref_System_Collections_Generic_IEnumerable
545+
let tyConfirmsToSeq g ty =
546+
match tryTcrefOfAppTy g ty with
547+
| ValueSome tcref ->
548+
tyconRefEq g tcref g.tcref_System_Collections_Generic_IEnumerable
549+
| _ -> false
546550
match SearchEntireHierarchyOfType (tyConfirmsToSeq g) g amap m (tyOfExpr g arbitrarySeqExpr) with
547551
| None ->
548552
// printfn "FAILED - yield! did not yield a sequence! %s" (stringOfRange m)

src/fsharp/MethodCalls.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -848,8 +848,8 @@ let MakeMethInfoCall amap m minfo minst args =
848848
let TryImportProvidedMethodBaseAsLibraryIntrinsic (amap: Import.ImportMap, m: range, mbase: Tainted<ProvidedMethodBase>) =
849849
let methodName = mbase.PUntaint((fun x -> x.Name), m)
850850
let declaringType = Import.ImportProvidedType amap m (mbase.PApply((fun x -> x.DeclaringType), m))
851-
if isAppTy amap.g declaringType then
852-
let declaringEntity = tcrefOfAppTy amap.g declaringType
851+
match tryTcrefOfAppTy amap.g declaringType with
852+
| ValueSome declaringEntity ->
853853
if not declaringEntity.IsLocalRef && ccuEq declaringEntity.nlr.Ccu amap.g.fslibCcu then
854854
match amap.g.knownIntrinsics.TryGetValue ((declaringEntity.LogicalName, methodName)) with
855855
| true, vref -> Some vref
@@ -861,7 +861,7 @@ let TryImportProvidedMethodBaseAsLibraryIntrinsic (amap: Import.ImportMap, m: ra
861861
| _ -> None
862862
else
863863
None
864-
else
864+
| _ ->
865865
None
866866
#endif
867867

src/fsharp/NameResolution.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2398,10 +2398,10 @@ let rec ResolveLongIdentInTypePrim (ncenv: NameResolver) nenv lookupKind (resInf
23982398
| _ -> ()
23992399

24002400
let errorTextF s =
2401-
if isAppTy g ty then
2402-
let tcref = tcrefOfAppTy g ty
2401+
match tryTcrefOfAppTy g ty with
2402+
| ValueSome tcref ->
24032403
FSComp.SR.undefinedNameFieldConstructorOrMemberWhenTypeIsKnown(tcref.DisplayNameWithStaticParametersAndTypars, s)
2404-
else
2404+
| _ ->
24052405
FSComp.SR.undefinedNameFieldConstructorOrMember(s)
24062406

24072407
raze (UndefinedName (depth, errorTextF, id, suggestMembers))

0 commit comments

Comments
 (0)