@@ -756,29 +756,33 @@ let AddUnionCases2 bulkAddMode (eUnqualifiedItems: UnqualifiedItems) (ucrefs: Un
756756 let item = Item.UnionCase( GeneralizeUnionCaseRef ucref, false )
757757 acc.Add ( ucref.CaseName, item))
758758
759- let AddStaticContentOfTyconRefToNameEnv ( g : TcGlobals ) ( amap : Import.ImportMap ) m ( nenv : NameResolutionEnv ) ( tcref : TyconRef ) =
760- let ty = generalizedTyconRef tcref
761- let infoReader = InfoReader( g, amap)
762- let items =
763- [| let methGroups =
764- AllMethInfosOfTypeInScope ResultCollectionSettings.AllResults infoReader nenv None AccessorDomain.AccessibleFromSomeFSharpCode PreferOverrides m ty
765- |> List.groupBy ( fun m -> m.LogicalName)
766-
767- for ( methName, methGroup) in methGroups do
768- let methGroup = methGroup |> List.filter ( fun m -> not m.IsInstance && not m.IsClassConstructor)
769- if not methGroup.IsEmpty then
770- yield KeyValuePair( methName, Item.MethodGroup( methName, methGroup, None))
759+ let AddStaticContentOfTyconRefToNameEnv ( g : TcGlobals ) ( amap : Import.ImportMap ) m ( nenv : NameResolutionEnv ) ( tcref : TyconRef ) =
760+ // If OpenStaticClasses is not enabled then don't do this
761+ if amap.g.langVersion.SupportsFeature LanguageFeature.OpenStaticClasses then
762+ let ty = generalizedTyconRef tcref
763+ let infoReader = InfoReader( g, amap)
764+ let items =
765+ [| let methGroups =
766+ AllMethInfosOfTypeInScope ResultCollectionSettings.AllResults infoReader nenv None AccessorDomain.AccessibleFromSomeFSharpCode PreferOverrides m ty
767+ |> List.groupBy ( fun m -> m.LogicalName)
768+
769+ for ( methName, methGroup) in methGroups do
770+ let methGroup = methGroup |> List.filter ( fun m -> not m.IsInstance && not m.IsClassConstructor)
771+ if not methGroup.IsEmpty then
772+ yield KeyValuePair( methName, Item.MethodGroup( methName, methGroup, None))
771773
772- let propInfos =
773- AllPropInfosOfTypeInScope ResultCollectionSettings.AllResults infoReader nenv None AccessorDomain.AccessibleFromSomeFSharpCode PreferOverrides m ty
774- |> List.groupBy ( fun m -> m.PropertyName)
774+ let propInfos =
775+ AllPropInfosOfTypeInScope ResultCollectionSettings.AllResults infoReader nenv None AccessorDomain.AccessibleFromSomeFSharpCode PreferOverrides m ty
776+ |> List.groupBy ( fun m -> m.PropertyName)
775777
776- for ( propName, propInfos) in propInfos do
777- let propInfos = propInfos |> List.filter ( fun m -> m.IsStatic)
778- for propInfo in propInfos do
779- yield KeyValuePair( propName , Item.Property( propName,[ propInfo])) |]
778+ for ( propName, propInfos) in propInfos do
779+ let propInfos = propInfos |> List.filter ( fun m -> m.IsStatic)
780+ for propInfo in propInfos do
781+ yield KeyValuePair( propName , Item.Property( propName,[ propInfo])) |]
780782
781- { nenv with eUnqualifiedItems = nenv.eUnqualifiedItems.AddAndMarkAsCollapsible items }
783+ { nenv with eUnqualifiedItems = nenv.eUnqualifiedItems.AddAndMarkAsCollapsible items }
784+ else
785+ nenv
782786
783787/// Add any implied contents of a type definition to the environment.
784788let private AddPartsOfTyconRefToNameEnv bulkAddMode ownDefinition ( g : TcGlobals ) amap m nenv ( tcref : TyconRef ) =
@@ -1992,7 +1996,10 @@ let CheckForTypeLegitimacyAndMultipleGenericTypeAmbiguities
19921996//-------------------------------------------------------------------------
19931997
19941998/// Perform name resolution for an identifier which must resolve to be a namespace or module.
1995- let rec ResolveLongIndentAsModuleOrNamespaceOrStaticClass sink ( atMostOne : ResultCollectionSettings ) amap m allowStaticClasses first fullyQualified ( nenv : NameResolutionEnv ) ad ( id : Ident ) ( rest : Ident list ) isOpenDecl =
1999+ let rec ResolveLongIndentAsModuleOrNamespaceOrStaticClass sink ( atMostOne : ResultCollectionSettings ) ( amap : Import.ImportMap ) m allowStaticClasses first fullyQualified ( nenv : NameResolutionEnv ) ad ( id : Ident ) ( rest : Ident list ) isOpenDecl =
2000+
2001+ // If the selected language version doesn't support open static classes then turn them off.
2002+ let allowStaticClasses = allowStaticClasses && amap.g.langVersion.SupportsFeature LanguageFeature.OpenStaticClasses
19962003 if first && id.idText = MangledGlobalName then
19972004 match rest with
19982005 | [] ->
0 commit comments