Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/release-notes/.FSharp.Compiler.Service/11.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

### Added

* Add FSharpCodeCompletionOptions ([PR #19030](https://github.com/dotnet/fsharp/pull/19030))

### Changed

* Parallel compilation stabilised and enabled by default ([PR #18998](https://github.com/dotnet/fsharp/pull/18998))
Expand Down
24 changes: 11 additions & 13 deletions src/Compiler/Checking/AttributeChecking.fs
Original file line number Diff line number Diff line change
Expand Up @@ -478,13 +478,11 @@ let CheckFSharpAttributesForObsolete (g:TcGlobals) attribs =
// like Span and ReadOnlySpan in completion lists due to their dual attributes.
not (HasFSharpAttributeOpt g g.attrib_IsByRefLikeAttribute_opt attribs)

/// Indicate if a list of F# attributes contains 'ObsoleteAttribute'. Used to suppress the item in intellisense.
/// Also check the attributes for CompilerMessageAttribute, which has an IsHidden argument that allows
/// items to be suppressed from intellisense.
let CheckFSharpAttributesForUnseen g attribs _m =
/// Indicates if a list of F# attributes contains 'ObsoleteAttribute' or CompilerMessageAttribute', which has an IsHidden argument
/// May be used to suppress items from intellisense.
let CheckFSharpAttributesForUnseen g attribs _m allowObsolete =
not (isNil attribs) &&
(CheckFSharpAttributesForObsolete g attribs ||
CheckFSharpAttributesForHidden g attribs)
(not allowObsolete && CheckFSharpAttributesForObsolete g attribs || CheckFSharpAttributesForHidden g attribs)

#if !NO_TYPEPROVIDERS
/// Indicate if a list of provided attributes contains 'ObsoleteAttribute'. Used to suppress the item in intellisense.
Expand Down Expand Up @@ -577,13 +575,13 @@ let CheckMethInfoAttributes g m tyargsOpt (minfo: MethInfo) =

/// Indicate if a method has 'Obsolete', 'CompilerMessageAttribute' or 'TypeProviderEditorHideMethodsAttribute'.
/// Used to suppress the item in intellisense.
let MethInfoIsUnseen g (m: range) (ty: TType) minfo =
let isUnseenByObsoleteAttrib () =
let MethInfoIsUnseen g (m: range) (ty: TType) minfo allowObsolete =
let isUnseenByObsoleteAttrib () =
match BindMethInfoAttributes m minfo
(fun ilAttribs -> Some(CheckILAttributesForUnseen g ilAttribs m))
(fun fsAttribs -> Some(CheckFSharpAttributesForUnseen g fsAttribs m))
(fun ilAttribs -> Some(not allowObsolete && CheckILAttributesForUnseen g ilAttribs m))
(fun fsAttribs -> Some(CheckFSharpAttributesForUnseen g fsAttribs m allowObsolete))
#if !NO_TYPEPROVIDERS
(fun provAttribs -> Some(CheckProvidedAttributesForUnseen provAttribs m))
(fun provAttribs -> Some(not allowObsolete && CheckProvidedAttributesForUnseen provAttribs m))
#else
(fun _provAttribs -> None)
#endif
Expand Down Expand Up @@ -620,14 +618,14 @@ let MethInfoIsUnseen g (m: range) (ty: TType) minfo =

/// Indicate if a property has 'Obsolete' or 'CompilerMessageAttribute'.
/// Used to suppress the item in intellisense.
let PropInfoIsUnseen m pinfo =
let PropInfoIsUnseen m allowObsolete pinfo =
match pinfo with
| ILProp (ILPropInfo(_, pdef) as ilpinfo) ->
// Properties on .NET tuple types are resolvable but unseen
isAnyTupleTy pinfo.TcGlobals ilpinfo.ILTypeInfo.ToType ||
CheckILAttributesForUnseen pinfo.TcGlobals pdef.CustomAttrs m
| FSProp (g, _, Some vref, _)
| FSProp (g, _, _, Some vref) -> CheckFSharpAttributesForUnseen g vref.Attribs m
| FSProp (g, _, _, Some vref) -> CheckFSharpAttributesForUnseen g vref.Attribs m allowObsolete
| FSProp _ -> failwith "CheckPropInfoAttributes: unreachable"
#if !NO_TYPEPROVIDERS
| ProvidedProp (_amap, pi, m) ->
Expand Down
6 changes: 3 additions & 3 deletions src/Compiler/Checking/AttributeChecking.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ val CheckFSharpAttributesForHidden: g: TcGlobals -> attribs: Attrib list -> bool

val CheckFSharpAttributesForObsolete: g: TcGlobals -> attribs: Attrib list -> bool

val CheckFSharpAttributesForUnseen: g: TcGlobals -> attribs: Attrib list -> _m: 'a -> bool
val CheckFSharpAttributesForUnseen: g: TcGlobals -> attribs: Attrib list -> _m: 'a -> allowObsolete: bool -> bool

val CheckPropInfoAttributes: pinfo: PropInfo -> m: range -> OperationResult<unit>

Expand All @@ -77,9 +77,9 @@ val CheckILFieldAttributes: g: TcGlobals -> finfo: ILFieldInfo -> m: range -> un
val CheckMethInfoAttributes:
g: TcGlobals -> m: range -> tyargsOpt: 'a option -> minfo: MethInfo -> OperationResult<unit>

val MethInfoIsUnseen: g: TcGlobals -> m: range -> ty: TType -> minfo: MethInfo -> bool
val MethInfoIsUnseen: g: TcGlobals -> m: range -> ty: TType -> minfo: MethInfo -> allowObsolete: bool -> bool

val PropInfoIsUnseen: m: 'a -> pinfo: PropInfo -> bool
val PropInfoIsUnseen: m: 'a -> allowObsolete: bool -> pinfo: PropInfo -> bool

val CheckEntityAttributes: g: TcGlobals -> tcref: TyconRef -> m: range -> OperationResult<unit>

Expand Down
Loading
Loading