@@ -758,14 +758,14 @@ let AddUnionCases2 bulkAddMode (eUnqualifiedItems: UnqualifiedItems) (ucrefs: Un
758758 let item = Item.UnionCase( GeneralizeUnionCaseRef ucref, false )
759759 acc.Add ( ucref.CaseName, item))
760760
761- let AddStaticContentOfTyconRefToNameEnv ( g : TcGlobals ) ( amap : Import.ImportMap ) m ( nenv : NameResolutionEnv ) ( tcref : TyconRef ) =
761+ let AddStaticContentOfTyconRefToNameEnv ( g : TcGlobals ) ( amap : Import.ImportMap ) ad m ( nenv : NameResolutionEnv ) ( tcref : TyconRef ) =
762762 // If OpenStaticClasses is not enabled then don't do this
763763 if amap.g.langVersion.SupportsFeature LanguageFeature.OpenStaticClasses then
764764 let ty = generalizedTyconRef tcref
765765 let infoReader = InfoReader( g, amap)
766766 let items =
767767 [| let methGroups =
768- AllMethInfosOfTypeInScope ResultCollectionSettings.AllResults infoReader nenv None AccessorDomain.AccessibleFromSomeFSharpCode PreferOverrides m ty
768+ AllMethInfosOfTypeInScope ResultCollectionSettings.AllResults infoReader nenv None ad PreferOverrides m ty
769769 |> List.groupBy ( fun m -> m.LogicalName)
770770
771771 for ( methName, methGroup) in methGroups do
@@ -774,20 +774,30 @@ let AddStaticContentOfTyconRefToNameEnv (g:TcGlobals) (amap: Import.ImportMap) m
774774 yield KeyValuePair( methName, Item.MethodGroup( methName, methGroup, None))
775775
776776 let propInfos =
777- AllPropInfosOfTypeInScope ResultCollectionSettings.AllResults infoReader nenv None AccessorDomain.AccessibleFromSomeFSharpCode PreferOverrides m ty
777+ AllPropInfosOfTypeInScope ResultCollectionSettings.AllResults infoReader nenv None ad PreferOverrides m ty
778778 |> List.groupBy ( fun m -> m.PropertyName)
779779
780780 for ( propName, propInfos) in propInfos do
781781 let propInfos = propInfos |> List.filter ( fun m -> m.IsStatic)
782782 for propInfo in propInfos do
783- yield KeyValuePair( propName , Item.Property( propName,[ propInfo])) |]
783+ yield KeyValuePair( propName , Item.Property( propName,[ propInfo]))
784+
785+ let fields =
786+ infoReader.GetILFieldInfosOfType( None, ad, m, ty)
787+ |> List.groupBy ( fun f -> f.FieldName)
788+
789+ for ( fieldName, fieldInfos) in fields do
790+ let fieldInfos = fieldInfos |> List.filter ( fun fi -> fi.IsStatic)
791+ for fieldInfo in fieldInfos do
792+ yield KeyValuePair( fieldName, Item.ILField( fieldInfo))
793+ |]
784794
785795 { nenv with eUnqualifiedItems = nenv.eUnqualifiedItems.AddAndMarkAsCollapsible items }
786796 else
787797 nenv
788798
789799/// Add any implied contents of a type definition to the environment.
790- let private AddPartsOfTyconRefToNameEnv bulkAddMode ownDefinition ( g : TcGlobals ) amap m nenv ( tcref : TyconRef ) =
800+ let private AddPartsOfTyconRefToNameEnv bulkAddMode ownDefinition ( g : TcGlobals ) amap ad m nenv ( tcref : TyconRef ) =
791801
792802 let isIL = tcref.IsILTycon
793803 let ucrefs = if isIL then [] else tcref.UnionCasesAsList |> List.map tcref.MakeNestedUnionCaseRef
@@ -860,16 +870,16 @@ let private AddPartsOfTyconRefToNameEnv bulkAddMode ownDefinition (g: TcGlobals)
860870
861871 let nenv =
862872 if TryFindFSharpBoolAttribute g g.attrib_ AutoOpenAttribute tcref.Attribs = Some true && isStaticClass g tcref then
863- AddStaticContentOfTyconRefToNameEnv g amap m nenv tcref
873+ AddStaticContentOfTyconRefToNameEnv g amap ad m nenv tcref
864874 else
865875 nenv
866876
867877 nenv
868878
869879/// Add a set of type definitions to the name resolution environment
870- let AddTyconRefsToNameEnv bulkAddMode ownDefinition g amap m root nenv tcrefs =
880+ let AddTyconRefsToNameEnv bulkAddMode ownDefinition g amap ad m root nenv tcrefs =
871881 if isNil tcrefs then nenv else
872- let env = List.fold ( AddPartsOfTyconRefToNameEnv bulkAddMode ownDefinition g amap m) nenv tcrefs
882+ let env = List.fold ( AddPartsOfTyconRefToNameEnv bulkAddMode ownDefinition g amap ad m) nenv tcrefs
873883 // Add most of the contents of the tycons en-masse, then flatten the tables if we're opening a module or namespace
874884 let tcrefs = Array.ofList tcrefs
875885 { env with
@@ -968,7 +978,7 @@ and AddModuleOrNamespaceContentsToNameEnv (g: TcGlobals) amap (ad: AccessorDomai
968978 let tcref = modref.NestedTyconRef tycon
969979 if IsEntityAccessible amap m ad tcref then Some tcref else None)
970980
971- let nenv = ( nenv, tcrefs) ||> AddTyconRefsToNameEnv BulkAdd.Yes false g amap m false
981+ let nenv = ( nenv, tcrefs) ||> AddTyconRefsToNameEnv BulkAdd.Yes false g amap ad m false
972982 let vrefs =
973983 mty.AllValsAndMembers.ToList()
974984 |> List.choose ( fun x -> if IsAccessible ad x.Accessibility then TryMkValRefInModRef modref x else None)
@@ -993,7 +1003,7 @@ and AddEntityContentsToNameEnv g amap ad m root nenv (modref: EntityRef) =
9931003 if modref.IsModuleOrNamespace then
9941004 AddModuleOrNamespaceContentsToNameEnv g amap ad m root nenv modref
9951005 else
996- AddStaticContentOfTyconRefToNameEnv g amap m nenv modref
1006+ AddStaticContentOfTyconRefToNameEnv g amap ad m nenv modref
9971007
9981008/// Add a single modules or namespace to the name resolution environment
9991009let AddModuleOrNamespaceRefToNameEnv g amap m root ad nenv ( modref : EntityRef ) =
0 commit comments