@@ -135,7 +135,7 @@ type Item =
135135/// Represents the resolution of a name to an F# value or function.
136136| Valueof ValRef
137137/// Represents the resolution of a name to an F# union case.
138- | UnionCaseof UnionCaseInfo
138+ | UnionCaseof UnionCaseInfo * bool
139139/// Represents the resolution of a name to an F# active pattern result.
140140| ActivePatternResultof ActivePatternInfo * TType * int * range
141141/// Represents the resolution of a name to an F# active pattern case within the body of an active pattern.
@@ -197,7 +197,7 @@ type Item =
197197match dwith
198198| Item.Value v-> v.DisplayName
199199| Item.ActivePatternCase apref-> apref.Name
200- | Item.UnionCase uinfo-> DecompileOpName uinfo.UnionCase.DisplayName
200+ | Item.UnionCase( uinfo,_) -> DecompileOpName uinfo.UnionCase.DisplayName
201201| Item.ExnCase tcref-> tcref.LogicalName
202202| Item.RecdField rfinfo-> DecompileOpName rfinfo.RecdField.Name
203203| Item.NewDef id-> id.idText
@@ -521,7 +521,7 @@ let AddRecdField (rfref:RecdFieldRef) tab = NameMultiMap.add rfref.FieldName rfr
521521/// Add a set of union cases to the corresponding sub-table of the environment
522522let AddUnionCases1 ( tab : Map < _ , _ >) ( ucrefs : UnionCaseRef list )=
523523( tab, ucrefs) ||> List.fold( fun acc ucref ->
524- let item = Item.UnionCase( GeneralizeUnionCaseRef ucref)
524+ let item = Item.UnionCase( GeneralizeUnionCaseRef ucref, false )
525525 acc.Add( ucref.CaseName, item))
526526
527527/// Add a set of union cases to the corresponding sub-table of the environment
@@ -530,13 +530,13 @@ let AddUnionCases2 bulkAddMode (eUnqualifiedItems: LayeredMap<_,_>) (ucrefs :Uni
530530| BulkAdd.Yes->
531531let items =
532532 ucrefs|> Array.ofList|> Array.map( fun ucref ->
533- let item = Item.UnionCase( GeneralizeUnionCaseRef ucref)
533+ let item = Item.UnionCase( GeneralizeUnionCaseRef ucref, false )
534534 KeyValuePair( ucref.CaseName, item))
535535 eUnqualifiedItems.AddAndMarkAsCollapsible items
536536
537537| BulkAdd.No->
538538( eUnqualifiedItems, ucrefs) ||> List.fold( fun acc ucref ->
539- let item = Item.UnionCase( GeneralizeUnionCaseRef ucref)
539+ let item = Item.UnionCase( GeneralizeUnionCaseRef ucref, false )
540540 acc.Add( ucref.CaseName, item))
541541
542542/// Add any implied contents of a type definition to the environment.
@@ -754,7 +754,7 @@ let FreshenUnionCaseRef (ncenv: NameResolver) m (ucref:UnionCaseRef) =
754754/// This must be called after fetching unqualified items that may need to be freshened
755755let FreshenUnqualifiedItem ( ncenv : NameResolver ) m res =
756756match reswith
757- | Item.UnionCase( UnionCaseInfo(_, ucref)) -> Item.UnionCase( FreshenUnionCaseRef ncenv m ucref)
757+ | Item.UnionCase( UnionCaseInfo(_, ucref),_ ) -> Item.UnionCase( FreshenUnionCaseRef ncenv m ucref, false )
758758| _ -> res
759759
760760
@@ -1549,7 +1549,7 @@ let rec ResolveLongIdentInTypePrim (ncenv:NameResolver) nenv lookupKind (resInfo
15491549// Lookup: datatype constructors take precedence
15501550match unionCaseSearchwith
15511551| Some ucase->
1552- success( resInfo, Item.UnionCase( ucase), rest)
1552+ success( resInfo, Item.UnionCase( ucase, false ), rest)
15531553| None->
15541554match TryFindIntrinsicNamedItemOfType ncenv.InfoReader( nm, ad) findFlag m typwith
15551555| Some( PropertyItem psets) when ( match lookupKindwith LookupKind.Expr-> true | _ -> false ) ->
@@ -1652,8 +1652,9 @@ let rec ResolveExprLongIdentInModuleOrNamespace (ncenv:NameResolver) nenv (typeN
16521652match TryFindTypeWithUnionCase modref idwith
16531653| Some tyconwhen IsTyconReprAccessible ncenv.amap m ad( modref.MkNestedTyconRef tycon) ->
16541654let ucref = mkUnionCaseRef( modref.MkNestedTyconRef tycon) id.idText
1655+ let showDeprecated = HasFSharpAttribute ncenv.g ncenv.g.attrib_ RequireQualifiedAccessAttribute tycon.Attribs
16551656let ucinfo = FreshenUnionCaseRef ncenv m ucref
1656- success( resInfo, Item.UnionCase ucinfo, rest)
1657+ success( resInfo, Item.UnionCase( ucinfo, showDeprecated ) , rest)
16571658| _ ->
16581659match mty.ExceptionDefinitionsByDemangledName.TryFind( id.idText) with
16591660| Some exconwhen IsTyconReprAccessible ncenv.amap m ad( modref.MkNestedTyconRef excon) ->
@@ -1854,8 +1855,9 @@ let rec ResolvePatternLongIdentInModuleOrNamespace (ncenv:NameResolver) nenv num
18541855| Some tyconwhen IsTyconReprAccessible ncenv.amap m ad( modref.MkNestedTyconRef tycon) ->
18551856let tcref = modref.MkNestedTyconRef tycon
18561857let ucref = mkUnionCaseRef tcref id.idText
1858+ let showDeprecated = HasFSharpAttribute ncenv.g ncenv.g.attrib_ RequireQualifiedAccessAttribute tycon.Attribs
18571859let ucinfo = FreshenUnionCaseRef ncenv m ucref
1858- success( resInfo, Item.UnionCase ucinfo, rest)
1860+ success( resInfo, Item.UnionCase( ucinfo, showDeprecated ) , rest)
18591861| _ ->
18601862match mty.ExceptionDefinitionsByDemangledName.TryFind( id.idText) with
18611863| Some exncwhen IsEntityAccessible ncenv.amap m ad( modref.MkNestedTyconRef exnc) ->
@@ -2411,7 +2413,7 @@ let IsUnionCaseUnseen ad g amap m (ucref:UnionCaseRef) =
24112413let ItemIsUnseen ad g amap m item =
24122414match itemwith
24132415| Item.Value x-> IsValUnseen ad g m x
2414- | Item.UnionCase x -> IsUnionCaseUnseen ad g amap m x.UnionCaseRef
2416+ | Item.UnionCase( x ,_) -> IsUnionCaseUnseen ad g amap m x.UnionCaseRef
24152417| Item.ExnCase x-> IsTyconUnseen ad g amap m x
24162418| _ -> false
24172419
@@ -2466,7 +2468,7 @@ let ResolveCompletionsInType (ncenv: NameResolver) nenv isApplicableMeth m ad st
24662468let tc , tinst = destAppTy g typ
24672469 tc.UnionCasesAsRefList
24682470|> List.filter( IsUnionCaseUnseen ad g ncenv.amap m>> not )
2469- |> List.map( fun ucref -> Item.UnionCase( UnionCaseInfo( tinst, ucref)))
2471+ |> List.map( fun ucref -> Item.UnionCase( UnionCaseInfo( tinst, ucref), false ))
24702472else []
24712473
24722474let einfos =
@@ -2738,7 +2740,7 @@ let rec ResolvePartialLongIdentInModuleOrNamespace (ncenv: NameResolver) nenv is
27382740@ ( UnionCaseRefsInModuleOrNamespace modref
27392741|> List.filter( IsUnionCaseUnseen ad g ncenv.amap m>> not )
27402742|> List.map GeneralizeUnionCaseRef
2741- |> List.map Item.UnionCase)
2743+ |> List.map( fun x -> Item.UnionCase( x , false )) )
27422744
27432745// Collect up the accessible active patterns in the module
27442746@ ( ActivePatternElemsOfModuleOrNamespace modref