@@ -1031,7 +1031,7 @@ let ResolveProvidedTypeNameInEntity (amap, m, typeName, modref: ModuleOrNamespac
10311031#endif
10321032
10331033/// Lookup a type name in an entity.
1034- let LookupTypeNameInEntityMaybeHaveArity ( amap , m , nm , staticResInfo : TypeNameResolutionStaticArgsInfo , modref : ModuleOrNamespaceRef ) =
1034+ let LookupTypeNameInEntityMaybeHaveArity ( amap , m , ad , nm , staticResInfo : TypeNameResolutionStaticArgsInfo , modref : ModuleOrNamespaceRef ) =
10351035 let mtyp = modref.ModuleOrNamespaceType
10361036 let tcrefs =
10371037 match staticResInfo with
@@ -1051,6 +1051,7 @@ let LookupTypeNameInEntityMaybeHaveArity (amap, m, nm, staticResInfo:TypeNameRes
10511051#else
10521052 amap |> ignore
10531053#endif
1054+ let tcrefs = tcrefs |> List.filter ( IsEntityAccessible amap m ad)
10541055 tcrefs
10551056
10561057
@@ -1081,15 +1082,15 @@ let GetNestedTypesOfType (ad, ncenv:NameResolver, optFilter, staticResInfo, chec
10811082
10821083 match optFilter with
10831084 | Some nm ->
1084- LookupTypeNameInEntityMaybeHaveArity ( ncenv.amap, m, nm, staticResInfo, tcref)
1085- |> List.map ( MakeNestedType ncenv tinst m)
1085+ let tcrefs = LookupTypeNameInEntityMaybeHaveArity ( ncenv.amap, m, ad , nm, staticResInfo, tcref)
1086+ tcrefs |> List.map ( MakeNestedType ncenv tinst m)
10861087 | None ->
10871088#if EXTENSIONTYPING
10881089 match tycon.TypeReprInfo with
10891090 | TProvidedTypeExtensionPoint info ->
10901091 [ for nestedType in info.ProvidedType.PApplyArray(( fun sty -> sty.GetNestedTypes()), " GetNestedTypes" , m) do
10911092 let nestedTypeName = nestedType.PUntaint(( fun t -> t.Name), m)
1092- for nestedTcref in LookupTypeNameInEntityMaybeHaveArity ( ncenv.amap, m, nestedTypeName, staticResInfo, tcref) do
1093+ for nestedTcref in LookupTypeNameInEntityMaybeHaveArity ( ncenv.amap, m, ad , nestedTypeName, staticResInfo, tcref) do
10931094 yield MakeNestedType ncenv tinst m nestedTcref ]
10941095
10951096 | _ ->
@@ -1980,7 +1981,7 @@ let rec ResolveExprLongIdentInModuleOrNamespace (ncenv:NameResolver) nenv (typeN
19801981
19811982 // Something in a type?
19821983 let tyconSearch =
1983- let tcrefs = LookupTypeNameInEntityMaybeHaveArity ( ncenv.amap, id.idRange, id.idText, ( if isNil rest then typeNameResInfo.StaticArgsInfo else TypeNameResolutionStaticArgsInfo.Indefinite), modref)
1984+ let tcrefs = LookupTypeNameInEntityMaybeHaveArity ( ncenv.amap, id.idRange, ad , id.idText, ( if isNil rest then typeNameResInfo.StaticArgsInfo else TypeNameResolutionStaticArgsInfo.Indefinite), modref)
19841985 let tcrefs = tcrefs |> List.map ( fun tcref -> ( resInfo, tcref))
19851986 if nonNil rest then
19861987 let tcrefs = CheckForTypeLegitimacyAndMultipleGenericTypeAmbiguities ( tcrefs, TypeNameResolutionInfo ( ResolveTypeNamesToTypeRefs, TypeNameResolutionStaticArgsInfo.Indefinite), PermitDirectReferenceToGeneratedType.No, unionRanges m id.idRange)
@@ -2190,7 +2191,7 @@ let rec ResolvePatternLongIdentInModuleOrNamespace (ncenv:NameResolver) nenv num
21902191 success( resInfo, Item.Value ( mkNestedValRef modref vspec), rest)
21912192 | _ ->
21922193 // Something in a type? e.g. a literal field
2193- let tcrefs = LookupTypeNameInEntityMaybeHaveArity ( ncenv.amap, id.idRange, id.idText, TypeNameResolutionStaticArgsInfo.Indefinite, modref)
2194+ let tcrefs = LookupTypeNameInEntityMaybeHaveArity ( ncenv.amap, id.idRange, ad , id.idText, TypeNameResolutionStaticArgsInfo.Indefinite, modref)
21942195 let tcrefs = tcrefs |> List.map ( fun tcref -> ( resInfo, tcref))
21952196 let tyconSearch =
21962197 match lid with
@@ -2309,7 +2310,7 @@ let rec ResolveTypeLongIdentInTyconRefPrim (ncenv:NameResolver) (typeNameResInfo
23092310 CheckForDirectReferenceToGeneratedType ( tcref, PermitDirectReferenceToGeneratedType.No, m)
23102311#endif
23112312 let m = unionRanges m id.idRange
2312- let tcrefs = LookupTypeNameInEntityMaybeHaveArity ( ncenv.amap, id.idRange, id.idText, typeNameResInfo.StaticArgsInfo, tcref)
2313+ let tcrefs = LookupTypeNameInEntityMaybeHaveArity ( ncenv.amap, id.idRange, ad , id.idText, typeNameResInfo.StaticArgsInfo, tcref)
23132314 let tcrefs = tcrefs |> List.map ( fun tcref -> ( resInfo, tcref))
23142315 let tcrefs = CheckForTypeLegitimacyAndMultipleGenericTypeAmbiguities ( tcrefs, typeNameResInfo, genOk, m)
23152316 match tcrefs with
@@ -2323,7 +2324,7 @@ let rec ResolveTypeLongIdentInTyconRefPrim (ncenv:NameResolver) (typeNameResInfo
23232324 let m = unionRanges m id.idRange
23242325 // Search nested types
23252326 let tyconSearch =
2326- let tcrefs = LookupTypeNameInEntityMaybeHaveArity ( ncenv.amap, id.idRange, id.idText, TypeNameResolutionStaticArgsInfo.Indefinite, tcref)
2327+ let tcrefs = LookupTypeNameInEntityMaybeHaveArity ( ncenv.amap, id.idRange, ad , id.idText, TypeNameResolutionStaticArgsInfo.Indefinite, tcref)
23272328 let tcrefs = tcrefs |> List.map ( fun tcref -> ( resInfo, tcref))
23282329 let tcrefs = CheckForTypeLegitimacyAndMultipleGenericTypeAmbiguities ( tcrefs, typeNameResInfo.DropStaticArgsInfo, genOk, m)
23292330 match tcrefs with
@@ -2356,7 +2357,7 @@ let rec private ResolveTypeLongIdentInModuleOrNamespace (ncenv:NameResolver) (ty
23562357 | [] -> error( Error( FSComp.SR.nrUnexpectedEmptyLongId(), m))
23572358 | [ id] ->
23582359 // On all paths except error reporting we have isSome(staticResInfo), hence get at most one result back
2359- let tcrefs = LookupTypeNameInEntityMaybeHaveArity ( ncenv.amap, id.idRange, id.idText, typeNameResInfo.StaticArgsInfo, modref)
2360+ let tcrefs = LookupTypeNameInEntityMaybeHaveArity ( ncenv.amap, id.idRange, ad , id.idText, typeNameResInfo.StaticArgsInfo, modref)
23602361 match tcrefs with
23612362 | _ :: _ -> tcrefs |> CollectResults ( fun tcref -> success( resInfo, tcref))
23622363 | [] -> raze ( SuggestTypeLongIdentInModuleOrNamespace depth modref id)
@@ -2370,7 +2371,7 @@ let rec private ResolveTypeLongIdentInModuleOrNamespace (ncenv:NameResolver) (ty
23702371 | _ ->
23712372 raze ( UndefinedName( depth, FSComp.SR.undefinedNameNamespaceOrModule, id, NoPredictions))
23722373 let tyconSearch =
2373- let tcrefs = LookupTypeNameInEntityMaybeHaveArity ( ncenv.amap, id.idRange, id.idText, TypeNameResolutionStaticArgsInfo.Indefinite, modref)
2374+ let tcrefs = LookupTypeNameInEntityMaybeHaveArity ( ncenv.amap, id.idRange, ad , id.idText, TypeNameResolutionStaticArgsInfo.Indefinite, modref)
23742375 match tcrefs with
23752376 | _ :: _ -> tcrefs |> CollectResults ( fun tcref -> ResolveTypeLongIdentInTyconRefPrim ncenv typeNameResInfo ad resInfo genOk ( depth+ 1 ) m tcref rest)
23762377 | [] -> raze ( UndefinedName( depth, FSComp.SR.undefinedNameType, id, NoPredictions))
@@ -2424,8 +2425,9 @@ let rec ResolveTypeLongIdentPrim (ncenv:NameResolver) fullyQualified m nenv ad (
24242425
24252426 let modulSearchFailed () =
24262427 ResolveLongIndentAsModuleOrNamespaceThen ncenv.amap m fullyQualified nenv AccessibleFromSomeFSharpCode lid
2427- ( ResolveTypeLongIdentInModuleOrNamespace ncenv typeNameResInfo.DropStaticArgsInfo ad genOk)
2428+ ( ResolveTypeLongIdentInModuleOrNamespace ncenv typeNameResInfo.DropStaticArgsInfo AccessibleFromSomeFSharpCode genOk)
24282429 |?> List.concat
2430+
24292431 match tyconSearch +++ modulSearch with
24302432 | Result results ->
24312433 // NOTE: we delay checking the CheckForTypeLegitimacyAndMultipleGenericTypeAmbiguities condition until right at the end after we've
@@ -2478,7 +2480,7 @@ let rec ResolveFieldInModuleOrNamespace (ncenv:NameResolver) nenv ad (resInfo:Re
24782480 let tyconSearch =
24792481 match lid with
24802482 | _ tn:: rest when nonNil rest ->
2481- let tcrefs = LookupTypeNameInEntityMaybeHaveArity ( ncenv.amap, id.idRange, id.idText, TypeNameResolutionStaticArgsInfo.Indefinite, modref)
2483+ let tcrefs = LookupTypeNameInEntityMaybeHaveArity ( ncenv.amap, id.idRange, ad , id.idText, TypeNameResolutionStaticArgsInfo.Indefinite, modref)
24822484 let tcrefs = tcrefs |> List.map ( fun tcref -> ( ResolutionInfo.Empty, tcref))
24832485 let tyconSearch = ResolveLongIdentInTyconRefs ncenv nenv LookupKind.RecdField ( depth+ 1 ) m ad rest typeNameResInfo id.idRange tcrefs
24842486 // choose only fields
0 commit comments