@@ -2496,29 +2496,6 @@ exception ObsoleteError of string * range
24962496/// formats.
24972497module AttributeChecking =
24982498
2499- /// Analyze three cases for attributes declared on type definitions: IL-declared attributes, F#-declared attributes and
2500- /// provided attributes.
2501- //
2502- // This is used for AttributeUsageAttribute, DefaultMemberAttribute and ConditionalAttribute (on attribute types)
2503- let TryBindTyconRefAttribute g m ( AttribInfo ( atref , _ ) as args ) ( tcref : TyconRef ) f1 f2 f3 =
2504- ignore m; ignore f3
2505- match metadataOfTycon tcref.Derefwith
2506- #if EXTENSIONTYPING
2507- | ProvidedTypeMetadata info->
2508- let provAttribs = info.ProvidedType.PApply(( fun a -> ( a:> IProvidedCustomAttributeProvider)), m)
2509- match provAttribs.PUntaint(( fun a -> a.GetAttributeConstructorArgs( provAttribs.TypeProvider.PUntaintNoFailure( id), atref.FullName)), m) with
2510- | Some args-> f3 args
2511- | None-> None
2512- #endif
2513- | ILTypeMetadata(_, tdef) ->
2514- match TryDecodeILAttribute g atref( Some( atref.Scope)) tdef.CustomAttrswith
2515- | Some attr-> f1 attr
2516- | _ -> None
2517- | FSharpOrArrayOrByrefOrTupleOrExnTypeMetadata->
2518- match TryFindFSharpAttribute g args tcref.Attribswith
2519- | Some attr-> f2 attr
2520- | _ -> None
2521-
25222499/// Analyze three cases for attributes declared on methods: IL-declared attributes, F#-declared attributes and
25232500/// provided attributes.
25242501let BindMethInfoAttributes m minfo f1 f2 f3 =
@@ -2553,7 +2530,7 @@ module AttributeChecking =
25532530 TryBindMethInfoAttribute g m attribSpec minfo
25542531( function ([ ILAttribElem.String( Some msg) ],_) -> Some msg| _ -> None)
25552532( function ( Attrib(_,_,[ AttribStringArg msg],_,_,_,_)) -> Some msg| _ -> None)
2556- ( function [ Some((:? stringas msg) : obj) ] -> Some msg| _ -> None)
2533+ ( function ( [ Some((:? stringas msg) : obj) ],_) -> Some msg| _ -> None)
25572534
25582535/// Check if a method has a specific attribute.
25592536let MethInfoHasAttribute g m attribSpec minfo =
@@ -2563,22 +2540,6 @@ module AttributeChecking =
25632540( fun _ -> Some())
25642541|> Option.isSome
25652542
2566- /// Try to find a specific attribute on a type definition, where the attribute accepts a string argument.
2567- ///
2568- /// This is used to detect the 'DefaultMemberAttribute' and 'ConditionalAttribute' attributes (on type definitions)
2569- let TryFindTyconRefStringAttribute g m attribSpec tcref =
2570- TryBindTyconRefAttribute g m attribSpec tcref
2571- ( function ([ ILAttribElem.String( Some( msg)) ],_) -> Some msg| _ -> None)
2572- ( function ( Attrib(_,_,[ AttribStringArg( msg) ],_,_,_,_)) -> Some msg| _ -> None)
2573- ( function [ Some((:? stringas msg) : obj) ] -> Some msg| _ -> None)
2574-
2575- /// Check if a type definition has a specific attribute
2576- let TyconRefHasAttribute g m attribSpec tcref =
2577- TryBindTyconRefAttribute g m attribSpec tcref
2578- ( fun _ -> Some())
2579- ( fun _ -> Some())
2580- ( fun _ -> Some())
2581- |> Option.isSome
25822543
25832544
25842545/// Check IL attributes for 'ObsoleteAttribute', returning errors and warnings as data
@@ -2652,13 +2613,13 @@ module AttributeChecking =
26522613let private CheckProvidedAttributes g m ( provAttribs : Tainted < IProvidedCustomAttributeProvider >) =
26532614let ( AttribInfo ( tref , _ )) = g.attrib_ SystemObsolete
26542615match provAttribs.PUntaint(( fun a -> a.GetAttributeConstructorArgs( provAttribs.TypeProvider.PUntaintNoFailure( id), tref.FullName)), m) with
2655- | Some[ Some(:? stringas msg) ] -> WarnD( ObsoleteWarning( msg, m))
2656- | Some[ Some(:? stringas msg); Some(:? boolas isError) ] ->
2616+ | Some( [ Some(:? stringas msg) ], _) -> WarnD( ObsoleteWarning( msg, m))
2617+ | Some( [ Some(:? stringas msg); Some(:? boolas isError) ], _) ->
26572618if isErrorthen
26582619 ErrorD( ObsoleteError( msg, m))
26592620else
26602621 WarnD( ObsoleteWarning( msg, m))
2661- | Some[ None] ->
2622+ | Some( [ None], _) ->
26622623 WarnD( ObsoleteWarning( " " , m))
26632624| Some_ ->
26642625 WarnD( ObsoleteWarning( " " , m))