diff --git a/docs/release-notes/.FSharp.Compiler.Service/8.0.400.md b/docs/release-notes/.FSharp.Compiler.Service/8.0.400.md index 9033ff771f8..16c0efeac6b 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/8.0.400.md +++ b/docs/release-notes/.FSharp.Compiler.Service/8.0.400.md @@ -22,6 +22,7 @@ * Generate new `Equals` overload to avoid boxing for structural comparison ([PR #16857](https://github.com/dotnet/fsharp/pull/16857)) * Parser: better recovery for unfinished patterns ([PR #17231](https://github.com/dotnet/fsharp/pull/17231)) * Parser: recover on empty match clause ([PR #17233](https://github.com/dotnet/fsharp/pull/17233)) +* Support Generic Attributes ([PR #17258](https://github.com/dotnet/fsharp/pull/17258)) ### Changed * Enforce `AttributeTargets.Interface` ([PR #17173](https://github.com/dotnet/fsharp/pull/17173)) diff --git a/docs/release-notes/.Language/preview.md b/docs/release-notes/.Language/preview.md index cf6d75d04f0..8f0c0de47f6 100644 --- a/docs/release-notes/.Language/preview.md +++ b/docs/release-notes/.Language/preview.md @@ -6,6 +6,7 @@ * Bidirectional F#/C# interop for 'unmanaged' constraint. ([PR #12154](https://github.com/dotnet/fsharp/pull/12154)) * Make `.Is*` discriminated union properties visible. ([Language suggestion #222](https://github.com/fsharp/fslang-suggestions/issues/222), [PR #16341](https://github.com/dotnet/fsharp/pull/16341)) * Allow returning bool instead of unit option for partial active patterns. ([Language suggestion #1041](https://github.com/fsharp/fslang-suggestions/issues/1041), [PR #16473](https://github.com/dotnet/fsharp/pull/16473)) +* Support for Generic Attributes ([PR #17258](https://github.com/dotnet/fsharp/pull/17258)) ### Fixed diff --git a/src/Compiler/AbstractIL/il.fs b/src/Compiler/AbstractIL/il.fs index 48cee265fdc..019068d7603 100644 --- a/src/Compiler/AbstractIL/il.fs +++ b/src/Compiler/AbstractIL/il.fs @@ -4851,6 +4851,16 @@ let encodeCustomAttrNamedArg (nm, ty, prop, elem) = yield! encodeCustomAttrValue ty elem |] +/// +/// Generate the syntax of a custom attribute per ECMA-335 II.23.3 +/// Prolog (always 01 00) +/// FixedArgs - the implicit arguments, i.e. the ctor arguments +/// NumNamed - the number of named arguments used in this instance of an attribute +/// NamedArgs - the actual named arguments used in this instance of an attribute +/// +/// +/// +/// let encodeCustomAttrArgs (mspec: ILMethodSpec) (fixedArgs: _ list) (namedArgs: _ list) = let argTys = mspec.MethodRef.ArgTypes diff --git a/src/Compiler/AbstractIL/ilwrite.fs b/src/Compiler/AbstractIL/ilwrite.fs index f41c8aaa08d..7463247e7da 100644 --- a/src/Compiler/AbstractIL/ilwrite.fs +++ b/src/Compiler/AbstractIL/ilwrite.fs @@ -353,7 +353,7 @@ type UnsharedRow(elems: RowElement[]) = type ILTypeWriterEnv = { EnclosingTyparCount: int } let envForTypeDef (tdef: ILTypeDef) = { EnclosingTyparCount=tdef.GenericParams.Length } let envForMethodRef env (ty: ILType) = { EnclosingTyparCount=(match ty with ILType.Array _ -> env.EnclosingTyparCount | _ -> ty.GenericArgs.Length) } -let envForNonGenericMethodRef _mref = { EnclosingTyparCount=Int32.MaxValue } +//let envForNonGenericMethodRef _mref = { EnclosingTyparCount=Int32.MaxValue } do we need this for attributes? It doesn't appear so let envForFieldSpec (fspec: ILFieldSpec) = { EnclosingTyparCount=fspec.DeclaringType.GenericArgs.Length } let envForOverrideSpec (ospec: ILOverridesSpec) = { EnclosingTyparCount=ospec.DeclaringType.GenericArgs.Length } @@ -1454,15 +1454,28 @@ let rec GetMethodRefAsMemberRefIdx cenv env fenv (mref: ILMethodRef) = let row = MethodRefInfoAsMemberRefRow cenv env fenv (mref.Name, mkILNonGenericBoxedTy mref.DeclaringTypeRef, mref.CallingConv, mref.ArgTypes, mref.ReturnType, None, mref.GenericArity) FindOrAddSharedRow cenv TableNames.MemberRef row -and GetMethodRefAsCustomAttribType cenv (mref: ILMethodRef) = - let fenv = envForNonGenericMethodRef mref - let tref = mref.DeclaringTypeRef - if isTypeRefLocal tref then - try (cat_MethodDef, GetMethodRefAsMethodDefIdx cenv mref) - with MethodDefNotFound -> (cat_MemberRef, GetMethodRefAsMemberRefIdx cenv fenv fenv mref) +/// MethodRef Index for an Attribute *with* type arguments +and GetMemberRefAsCustomGenericAttribType cenv env fenv (mspec: ILMethodSpec) = + let typeSpec = (tdor_TypeSpec, GetTypeAsTypeSpecIdx cenv env mspec.DeclaringType) + let memberRef = MemberRefParent (mrp_TypeSpec, snd typeSpec) + let memberRow = MemberRefRow( memberRef, + GetStringHeapIdx cenv mspec.Name, + GetMethodRefInfoAsBlobIdx cenv fenv (mspec.CallingConv, mspec.MethodRef.ArgTypes, mspec.MethodRef.ReturnType, None, mspec.MethodRef.GenericArity) + ) + (cat_MemberRef, FindOrAddSharedRow cenv TableNames.MemberRef memberRow) + +/// MethodRef Index for an Attribute without type arguments +and GetMethodRefAsCustomAttribType cenv _env fenv (mspec: ILMethodSpec) = + + let tref = mspec.MethodRef.DeclaringTypeRef + + if isTypeRefLocal tref && mspec.DeclaringType.GenericArgs.Length = 0 then + try (cat_MethodDef, GetMethodRefAsMethodDefIdx cenv mspec.MethodRef) + with MethodDefNotFound -> + (cat_MemberRef, GetMethodRefAsMemberRefIdx cenv fenv fenv mspec.MethodRef) else - (cat_MemberRef, GetMethodRefAsMemberRefIdx cenv fenv fenv mref) - + (cat_MemberRef, GetMethodRefAsMemberRefIdx cenv fenv fenv mspec.MethodRef) + // -------------------------------------------------------------------- // ILAttributes --> CustomAttribute rows // -------------------------------------------------------------------- @@ -1470,26 +1483,32 @@ and GetMethodRefAsCustomAttribType cenv (mref: ILMethodRef) = let rec GetCustomAttrDataAsBlobIdx cenv (data: byte[]) = if data.Length = 0 then 0 else GetBytesAsBlobIdx cenv data -and GetCustomAttrRow cenv hca (attr: ILAttribute) = - let cat = GetMethodRefAsCustomAttribType cenv attr.Method.MethodRef +and GetCustomAttrRow cenv env hca (attr: ILAttribute) = + let cat = + let fenv = envForMethodRef env attr.Method.DeclaringType + if attr.Method.DeclaringType.GenericArgs.Length = 0 + then GetMethodRefAsCustomAttribType cenv env fenv attr.Method + else GetMemberRefAsCustomGenericAttribType cenv env fenv attr.Method let data = getCustomAttrData attr + for element in attr.Elements do match element with | ILAttribElem.Type (Some ty) when ty.IsNominal -> GetTypeRefAsTypeRefIdx cenv ty.TypeRef |> ignore | ILAttribElem.TypeRef (Some tref) -> GetTypeRefAsTypeRefIdx cenv tref |> ignore | _ -> () - + UnsharedRow - [| HasCustomAttribute (fst hca, snd hca) - CustomAttributeType (fst cat, snd cat) - Blob (GetCustomAttrDataAsBlobIdx cenv data) + [| + HasCustomAttribute (fst hca, snd hca) + CustomAttributeType (fst cat, snd cat) + Blob (GetCustomAttrDataAsBlobIdx cenv data) |] -and GenCustomAttrPass3Or4 cenv hca attr = - AddUnsharedRow cenv TableNames.CustomAttribute (GetCustomAttrRow cenv hca attr) |> ignore +and GenCustomAttrPass3Or4 cenv env hca attr = + AddUnsharedRow cenv TableNames.CustomAttribute (GetCustomAttrRow cenv env hca attr) |> ignore -and GenCustomAttrsPass3Or4 cenv hca (attrs: ILAttributes) = - attrs.AsArray() |> Array.iter (GenCustomAttrPass3Or4 cenv hca) +and GenCustomAttrsPass3Or4 cenv env hca (attrs: ILAttributes) = + attrs.AsArray() |> Array.iter (GenCustomAttrPass3Or4 cenv env hca) // -------------------------------------------------------------------- // ILSecurityDecl --> DeclSecurity rows @@ -2347,14 +2366,14 @@ let rec GenPdbImports (cenv: cenv) (input: ILDebugImports option) = let GenILMethodBody mname cenv env (il: ILMethodBody) = let localSigs = - if cenv.generatePdb then - il.Locals |> List.toArray |> Array.map (fun l -> - // Write a fake entry for the local signature headed by e_IMAGE_CEE_CS_CALLCONV_FIELD. This is referenced by the PDB file - ignore (FindOrAddSharedRow cenv TableNames.StandAloneSig (SharedRow [| Blob (GetFieldDefTypeAsBlobIdx cenv env l.Type) |])) - // Now write the type - GetTypeOfLocalAsBytes cenv env l) - else - [| |] + if cenv.generatePdb then + il.Locals |> List.toArray |> Array.map (fun l -> + // Write a fake entry for the local signature headed by e_IMAGE_CEE_CS_CALLCONV_FIELD. This is referenced by the PDB file + ignore (FindOrAddSharedRow cenv TableNames.StandAloneSig (SharedRow [| Blob (GetFieldDefTypeAsBlobIdx cenv env l.Type) |])) + // Now write the type + GetTypeOfLocalAsBytes cenv env l) + else + [| |] let imports = GenPdbImports cenv il.DebugImports let requiredStringFixups, seh, code, seqpoints, scopes = Codebuf.EmitMethodCode cenv imports localSigs env mname il.Code @@ -2461,7 +2480,7 @@ and GetFieldDefSigAsBlobIdx cenv env fd = GetFieldDefTypeAsBlobIdx cenv env fd.F and GenFieldDefPass3 tdef cenv env fd = if canGenFieldDef tdef cenv fd then let fidx = AddUnsharedRow cenv TableNames.Field (GetFieldDefAsFieldDefRow cenv env fd) - GenCustomAttrsPass3Or4 cenv (hca_FieldDef, fidx) fd.CustomAttrs + GenCustomAttrsPass3Or4 cenv env (hca_FieldDef, fidx) fd.CustomAttrs // Write FieldRVA table - fixups into data section done later match fd.Data with | None -> () @@ -2542,7 +2561,7 @@ and GenGenericParamPass3 cenv env idx owner gp = and GenGenericParamPass4 cenv env idx owner gp = let gpidx = FindOrAddSharedRow cenv TableNames.GenericParam (GetGenericParamAsGenericParamRow cenv env idx owner gp) - GenCustomAttrsPass3Or4 cenv (hca_GenericParam, gpidx) gp.CustomAttrs + GenCustomAttrsPass3Or4 cenv env (hca_GenericParam, gpidx) gp.CustomAttrs gp.Constraints |> List.iter (GenGenericParamConstraintPass4 cenv env gpidx) // -------------------------------------------------------------------- @@ -2567,7 +2586,7 @@ and GenParamPass3 cenv env seq (param: ILParameter) = then () else let pidx = AddUnsharedRow cenv TableNames.Param (GetParamAsParamRow cenv env seq param) - GenCustomAttrsPass3Or4 cenv (hca_ParamDef, pidx) param.CustomAttrs + GenCustomAttrsPass3Or4 cenv env (hca_ParamDef, pidx) param.CustomAttrs // Write FieldRVA table - fixups into data section done later match param.Marshal with | None -> () @@ -2594,7 +2613,7 @@ let GenReturnAsParamRow (returnv : ILReturn) = let GenReturnPass3 cenv (returnv: ILReturn) = if Option.isSome returnv.Marshal || not (Array.isEmpty (returnv.CustomAttrs.AsArray())) then let pidx = AddUnsharedRow cenv TableNames.Param (GenReturnAsParamRow returnv) - GenCustomAttrsPass3Or4 cenv (hca_ParamDef, pidx) returnv.CustomAttrs + GenCustomAttrsPass3Or4 cenv {EnclosingTyparCount = 0} (hca_ParamDef, pidx) returnv.CustomAttrs match returnv.Marshal with | None -> () | Some ntyp -> @@ -2706,7 +2725,7 @@ let GenMethodDefPass3 tdef cenv env (mdef: ILMethodDef) = if midx <> idx2 then failwith "index of method def on pass 3 does not match index on pass 2" GenReturnPass3 cenv mdef.Return mdef.Parameters |> List.iteri (fun n param -> GenParamPass3 cenv env (n+1) param) - mdef.CustomAttrs |> GenCustomAttrsPass3Or4 cenv (hca_MethodDef, midx) + mdef.CustomAttrs |> GenCustomAttrsPass3Or4 cenv env (hca_MethodDef, midx) mdef.SecurityDecls.AsList() |> GenSecurityDeclsPass3 cenv (hds_MethodDef, midx) mdef.GenericParams |> List.iteri (fun n gp -> GenGenericParamPass3 cenv env n (tomd_MethodDef, midx) gp) match mdef.Body with @@ -2796,7 +2815,7 @@ and GenPropertyPass3 cenv env (prop: ILPropertyDef) = [| GetFieldInitFlags i HasConstant (hc_Property, pidx) Blob (GetFieldInitAsBlobIdx cenv i) |]) |> ignore - GenCustomAttrsPass3Or4 cenv (hca_Property, pidx) prop.CustomAttrs + GenCustomAttrsPass3Or4 cenv env (hca_Property, pidx) prop.CustomAttrs let rec GenEventMethodSemanticsPass3 cenv eidx kind mref = let addIdx = try GetMethodRefAsMethodDefIdx cenv mref with MethodDefNotFound -> 1 @@ -2822,7 +2841,7 @@ and GenEventPass3 cenv env (edef: ILEventDef) = edef.RemoveMethod |> GenEventMethodSemanticsPass3 cenv eidx 0x0010 Option.iter (GenEventMethodSemanticsPass3 cenv eidx 0x0020) edef.FireMethod List.iter (GenEventMethodSemanticsPass3 cenv eidx 0x0004) edef.OtherMethods - GenCustomAttrsPass3Or4 cenv (hca_Event, eidx) edef.CustomAttrs + GenCustomAttrsPass3Or4 cenv env (hca_Event, eidx) edef.CustomAttrs // -------------------------------------------------------------------- @@ -2856,7 +2875,7 @@ let rec GetResourceAsManifestResourceRow cenv rdef = and GenResourcePass3 cenv rdef = let idx = AddUnsharedRow cenv TableNames.ManifestResource (GetResourceAsManifestResourceRow cenv rdef) - GenCustomAttrsPass3Or4 cenv (hca_ManifestResource, idx) rdef.CustomAttrs + GenCustomAttrsPass3Or4 cenv {EnclosingTyparCount = 0} (hca_ManifestResource, idx) rdef.CustomAttrs // -------------------------------------------------------------------- // ILTypeDef --> generate ILFieldDef, ILMethodDef, ILPropertyDef etc. rows @@ -2883,7 +2902,7 @@ let rec GenTypeDefPass3 enc cenv (tdef: ILTypeDef) = SimpleIndex (TableNames.TypeDef, tidx) |]) |> ignore tdef.SecurityDecls.AsList() |> GenSecurityDeclsPass3 cenv (hds_TypeDef, tidx) - tdef.CustomAttrs |> GenCustomAttrsPass3Or4 cenv (hca_TypeDef, tidx) + tdef.CustomAttrs |> GenCustomAttrsPass3Or4 cenv env (hca_TypeDef, tidx) tdef.GenericParams |> List.iteri (fun n gp -> GenGenericParamPass3 cenv env n (tomd_TypeDef, tidx) gp) tdef.NestedTypes.AsList() |> GenTypeDefsPass3 (enc@[tdef.Name]) cenv with exn -> @@ -2928,7 +2947,7 @@ let rec GenNestedExportedTypePass3 cenv cidx (ce: ILNestedExportedType) = StringE (GetStringHeapIdx cenv ce.Name) StringE 0 Implementation (i_ExportedType, cidx) |]) - GenCustomAttrsPass3Or4 cenv (hca_ExportedType, nidx) ce.CustomAttrs + GenCustomAttrsPass3Or4 cenv {EnclosingTyparCount = 0} (hca_ExportedType, nidx) ce.CustomAttrs GenNestedExportedTypesPass3 cenv nidx ce.Nested and GenNestedExportedTypesPass3 cenv nidx (nce: ILNestedExportedTypes) = @@ -2946,7 +2965,7 @@ and GenExportedTypePass3 cenv (ce: ILExportedTypeOrForwarder) = nelem nselem Implementation (fst impl, snd impl) |]) - GenCustomAttrsPass3Or4 cenv (hca_ExportedType, cidx) ce.CustomAttrs + GenCustomAttrsPass3Or4 cenv {EnclosingTyparCount = 0} (hca_ExportedType, cidx) ce.CustomAttrs GenNestedExportedTypesPass3 cenv cidx ce.Nested and GenExportedTypesPass3 cenv (ce: ILExportedTypesAndForwarders) = @@ -2983,7 +3002,7 @@ and GetManifestAsAssemblyRow cenv m = and GenManifestPass3 cenv m = let aidx = AddUnsharedRow cenv TableNames.Assembly (GetManifestAsAssemblyRow cenv m) GenSecurityDeclsPass3 cenv (hds_Assembly, aidx) (m.SecurityDecls.AsList()) - GenCustomAttrsPass3Or4 cenv (hca_Assembly, aidx) m.CustomAttrs + GenCustomAttrsPass3Or4 cenv {EnclosingTyparCount = 0} (hca_Assembly, aidx) m.CustomAttrs GenExportedTypesPass3 cenv m.ExportedTypes // Record the entrypoint decl if needed. match m.EntrypointElsewhere with @@ -3045,7 +3064,7 @@ let GenModule (cenv : cenv) (modul: ILModuleDef) = (match modul.Manifest with None -> () | Some m -> GenManifestPass3 cenv m) GenTypeDefsPass3 [] cenv tdefs reportTime "Module Generation Pass 3" - GenCustomAttrsPass3Or4 cenv (hca_Module, midx) modul.CustomAttrs + GenCustomAttrsPass3Or4 cenv {EnclosingTyparCount = 0} (hca_Module, midx) modul.CustomAttrs // GenericParam is the only sorted table indexed by Columns in other tables (GenericParamConstraint\CustomAttributes). // Hence we need to sort it before we emit any entries in GenericParamConstraint\CustomAttributes that are attached to generic params. // Note this mutates the rows in a table. 'SetRowsOfTable' clears diff --git a/src/Compiler/Checking/AttributeChecking.fs b/src/Compiler/Checking/AttributeChecking.fs index 2564a54bdd3..867555ac6d6 100644 --- a/src/Compiler/Checking/AttributeChecking.fs +++ b/src/Compiler/Checking/AttributeChecking.fs @@ -88,14 +88,21 @@ type AttribInfo = member x.TyconRef = match x with - | FSAttribInfo(_g, Attrib(tcref, _, _, _, _, _, _)) -> tcref + | FSAttribInfo(_g, Attrib(tcref, _, _, _, _, _, _, _)) -> tcref | ILAttribInfo (g, amap, scoref, a, m) -> let ty = RescopeAndImportILType scoref amap m [] a.Method.DeclaringType tcrefOfAppTy g ty + + member x.TypeArgs : TypeInst = + match x with + | FSAttribInfo(_g, Attrib(_, _, typeArgs, _, _, _, _, _)) -> typeArgs + | ILAttribInfo (g, amap, scoref, a, m) -> + let ty = RescopeAndImportILType scoref amap m [] a.Method.DeclaringType + argsOfAppTy g ty member x.ConstructorArguments = match x with - | FSAttribInfo(g, Attrib(_, _, unnamedArgs, _, _, _, _)) -> + | FSAttribInfo(g, Attrib(_, _, _, unnamedArgs, _, _, _, _)) -> unnamedArgs |> List.map (fun (AttribExpr(origExpr, evaluatedExpr)) -> let ty = tyOfExpr g origExpr @@ -110,7 +117,7 @@ type AttribInfo = member x.NamedArguments = match x with - | FSAttribInfo(g, Attrib(_, _, _, namedArgs, _, _, _)) -> + | FSAttribInfo(g, Attrib(_, _, _, _, namedArgs, _, _, _)) -> namedArgs |> List.map (fun (AttribNamedArg(nm, _, isField, AttribExpr(origExpr, evaluatedExpr))) -> let ty = tyOfExpr g origExpr @@ -218,7 +225,7 @@ let TryBindMethInfoAttribute g (m: range) (AttribInfo(atref, _) as attribSpec) m let TryFindMethInfoStringAttribute g (m: range) attribSpec minfo = TryBindMethInfoAttribute g m attribSpec minfo (function [ILAttribElem.String (Some msg) ], _ -> Some msg | _ -> None) - (function Attrib(_, _, [ AttribStringArg msg ], _, _, _, _) -> Some msg | _ -> None) + (function Attrib(_, _, _, [ AttribStringArg msg ], _, _, _, _) -> Some msg | _ -> None) (function [ Some (:? string as msg : obj) ], _ -> Some msg | _ -> None) /// Check if a method has a specific attribute. @@ -271,9 +278,9 @@ let CheckFSharpAttributes (g:TcGlobals) attribs m = else trackErrors { match TryFindFSharpAttribute g g.attrib_SystemObsolete attribs with - | Some(Attrib(_, _, [ AttribStringArg s ], _, _, _, _)) -> + | Some(Attrib(_, _, _, [ AttribStringArg s ], _, _, _, _)) -> do! WarnD(ObsoleteWarning(s, m)) - | Some(Attrib(_, _, [ AttribStringArg s; AttribBoolArg(isError) ], _, _, _, _)) -> + | Some(Attrib(_, _, _, [ AttribStringArg s; AttribBoolArg(isError) ], _, _, _, _)) -> if isError then do! ErrorD (ObsoleteError(s, m)) else @@ -284,7 +291,7 @@ let CheckFSharpAttributes (g:TcGlobals) attribs m = () match TryFindFSharpAttribute g g.attrib_CompilerMessageAttribute attribs with - | Some(Attrib(_, _, [ AttribStringArg s ; AttribInt32Arg n ], namedArgs, _, _, _)) -> + | Some(Attrib(_, _, _, [ AttribStringArg s ; AttribInt32Arg n ], namedArgs, _, _, _)) -> let msg = UserCompilerMessage(s, n, m) let isError = match namedArgs with @@ -302,7 +309,7 @@ let CheckFSharpAttributes (g:TcGlobals) attribs m = () match TryFindFSharpAttribute g g.attrib_ExperimentalAttribute attribs with - | Some(Attrib(_, _, [ AttribStringArg(s) ], _, _, _, _)) -> + | Some(Attrib(_, _, _, [ AttribStringArg(s) ], _, _, _, _)) -> let isExperimentalAttributeDisabled (s:string) = if g.compilingFSharpCore then true @@ -351,7 +358,7 @@ let CheckILAttributesForUnseen (g: TcGlobals) cattrs _m = let CheckFSharpAttributesForHidden g attribs = not (isNil attribs) && (match TryFindFSharpAttribute g g.attrib_CompilerMessageAttribute attribs with - | Some(Attrib(_, _, [AttribStringArg _; AttribInt32Arg messageNumber], + | Some(Attrib(_, _, _, [AttribStringArg _; AttribInt32Arg messageNumber], ExtractAttribNamedArg "IsHidden" (AttribBoolArg v), _, _, _)) -> // Message number 62 is for "ML Compatibility". Items labelled with this are visible in intellisense // when mlCompatibility is set. @@ -359,7 +366,7 @@ let CheckFSharpAttributesForHidden g attribs = | _ -> false) || (match TryFindFSharpAttribute g g.attrib_ComponentModelEditorBrowsableAttribute attribs with - | Some(Attrib(_, _, [AttribInt32Arg state], _, _, _, _)) -> state = int System.ComponentModel.EditorBrowsableState.Never + | Some(Attrib(_, _, _, [AttribInt32Arg state], _, _, _, _)) -> state = int System.ComponentModel.EditorBrowsableState.Never | _ -> false) /// Indicate if a list of F# attributes contains 'ObsoleteAttribute'. Used to suppress the item in intellisense. @@ -526,7 +533,7 @@ let CheckRecdFieldInfoAttributes g (x:RecdFieldInfo) m = CheckRecdFieldAttributes g x.RecdFieldRef m // Identify any security attributes -let IsSecurityAttribute (g: TcGlobals) amap (casmap : IDictionary) (Attrib(tcref, _, _, _, _, _, _)) m = +let IsSecurityAttribute (g: TcGlobals) amap (casmap : IDictionary) (Attrib(tcref, _, typeArgs, _, _, _, _, _)) m = // There's no CAS on Silverlight, so we have to be careful here match g.attrib_SecurityAttribute with | None -> false @@ -537,16 +544,16 @@ let IsSecurityAttribute (g: TcGlobals) amap (casmap : IDictionary) match casmap.TryGetValue tcs with | true, c -> c | _ -> - let exists = ExistsInEntireHierarchyOfType (fun t -> typeEquiv g t (mkAppTy attr.TyconRef [])) g amap m AllowMultiIntfInstantiations.Yes (mkAppTy tcref []) + let exists = ExistsInEntireHierarchyOfType (fun t -> typeEquiv g t (mkAppTy attr.TyconRef [])) g amap m AllowMultiIntfInstantiations.Yes (mkAppTy tcref typeArgs) casmap[tcs] <- exists exists | ValueNone -> false -let IsSecurityCriticalAttribute g (Attrib(tcref, _, _, _, _, _, _)) = +let IsSecurityCriticalAttribute g (Attrib(tcref, _, _, _, _, _, _, _)) = (tyconRefEq g tcref g.attrib_SecurityCriticalAttribute.TyconRef || tyconRefEq g tcref g.attrib_SecuritySafeCriticalAttribute.TyconRef) // Identify any AssemblyVersion attributes -let IsAssemblyVersionAttribute (g: TcGlobals) (Attrib(tcref, _, _, _, _, _, _)) = +let IsAssemblyVersionAttribute (g: TcGlobals) (Attrib(tcref, _, _, _, _, _, _, _)) = match g.TryFindSysAttrib("System.Reflection.AssemblyVersionAttribute") with | None -> false diff --git a/src/Compiler/Checking/AttributeChecking.fsi b/src/Compiler/Checking/AttributeChecking.fsi index b4a608ef1d1..a9b419d779d 100644 --- a/src/Compiler/Checking/AttributeChecking.fsi +++ b/src/Compiler/Checking/AttributeChecking.fsi @@ -22,6 +22,7 @@ type AttribInfo = | ILAttribInfo of TcGlobals * Import.ImportMap * ILScopeRef * ILAttribute * range member ConstructorArguments: (TType * obj) list + member TypeArgs: TypeInst member NamedArguments: (TType * string * bool * obj) list member Range: range member TyconRef: TyconRef diff --git a/src/Compiler/Checking/CheckDeclarations.fs b/src/Compiler/Checking/CheckDeclarations.fs index be083e74871..3ec30a82723 100644 --- a/src/Compiler/Checking/CheckDeclarations.fs +++ b/src/Compiler/Checking/CheckDeclarations.fs @@ -5780,7 +5780,7 @@ let CheckOneImplFile with RecoverableException exn -> errorRecovery exn m) - // We ALWAYS run the PostTypeCheckSemanticChecks phase, though we if we have already encountered some + // We ALWAYS run the PostTypeCheckSemanticChecks phase, though if we have already encountered some // errors we turn off error reporting. This is because it performs various fixups over the TAST, e.g. // assigning nice names for inference variables. let hasExplicitEntryPoint, anonRecdTypes = @@ -5808,7 +5808,7 @@ let CheckOneImplFile // Warn on version attributes. topAttrs.assemblyAttrs |> List.iter (function - | Attrib(tref, _, [ AttribExpr(Expr.Const (Const.String version, range, _), _) ], _, _, _, _) -> + | Attrib(tref, _, _, [ AttribExpr(Expr.Const (Const.String version, range, _), _) ], _, _, _, _) -> let attrName = tref.CompiledRepresentationForNamedType.FullName let isValid() = try parseILVersion version |> ignore; true diff --git a/src/Compiler/Checking/CheckExpressions.fs b/src/Compiler/Checking/CheckExpressions.fs index 89253bd6783..0155d213fa6 100644 --- a/src/Compiler/Checking/CheckExpressions.fs +++ b/src/Compiler/Checking/CheckExpressions.fs @@ -962,6 +962,7 @@ let TranslateTopArgSynInfo (cenv: cenv) isArg m tcAttributes (SynArgInfo(Attribu let optAttrs = if isOpt then [ ( { TypeName=SynLongIdent(pathToSynLid m ["Microsoft";"FSharp";"Core";"OptionalArgument"], [], [None;None;None;None]) + TypeArgs = [] ArgExpr=mkSynUnit m Target=None AppliesToGetterAndSetter=false @@ -1277,7 +1278,7 @@ let CheckRequiredProperties (g:TcGlobals) (env: TcEnv) (cenv: TcFileState) (minf let private HasMethodImplNoInliningAttribute g attrs = match TryFindFSharpAttribute g g.attrib_MethodImplAttribute attrs with // NO_INLINING = 8 - | Some (Attrib(_, _, [ AttribInt32Arg flags ], _, _, _, _)) -> (flags &&& 0x8) <> 0x0 + | Some (Attrib(_, _, _, [ AttribInt32Arg flags ], _, _, _, _)) -> (flags &&& 0x8) <> 0x0 | _ -> false let MakeAndPublishVal (cenv: cenv) env (altActualParent, inSig, declKind, valRecInfo, vscheme, attrs, xmlDoc, konst, isGeneratedEventVal) = @@ -10784,7 +10785,7 @@ and TcNormalizedBinding declKind (cenv: cenv) env tpenv overallTy safeThisValOpt if attribs.Length <> attrs.Length then [], [], attribs else attribs |> List.zip attrs - |> List.partition(function | _, Attrib(_, _, _, _, _, Some ts, _) -> ts &&& AttributeTargets.ReturnValue <> enum 0 | _ -> false) + |> List.partition(function | _, Attrib(_, _, _, _, _, _, Some ts, _) -> ts &&& AttributeTargets.ReturnValue <> enum 0 | _ -> false) |> fun (r, v) -> (List.map fst r, List.map snd r, List.map snd v) let retAttribs = match rtyOpt with @@ -11093,13 +11094,13 @@ and TcAttributeEx canFail (cenv: cenv) (env: TcEnv) attrTgt attrEx (synAttr: Syn let (SynLongIdent(tycon, _, _)) = synAttr.TypeName let arg = synAttr.ArgExpr + let paramSynTypes = synAttr.TypeArgs let targetIndicator = synAttr.Target let isAppliedToGetterOrSetter = synAttr.AppliesToGetterAndSetter let mAttr = synAttr.Range let typath, tyid = List.frontAndBack tycon let tpenv = emptyUnscopedTyparEnv let ad = env.eAccessRights - // if we're checking an attribute that was applied directly to a getter or a setter, then // what we're really checking against is a method, not a property let attrTgt = if isAppliedToGetterOrSetter then ((attrTgt ^^^ AttributeTargets.Property) ||| AttributeTargets.Method) else attrTgt @@ -11108,9 +11109,10 @@ and TcAttributeEx canFail (cenv: cenv) (env: TcEnv) attrTgt attrEx (synAttr: Syn let tyid = mkSynId tyid.idRange n let tycon = (typath @ [tyid]) - match ResolveTypeLongIdent cenv.tcSink cenv.nameResolver ItemOccurence.UseInAttribute OpenQualified env.eNameResEnv ad tycon TypeNameResolutionStaticArgsInfo.DefiniteEmpty PermitDirectReferenceToGeneratedType.No with + + match ResolveTypeLongIdent cenv.tcSink cenv.nameResolver ItemOccurence.UseInAttribute OpenQualified env.eNameResEnv ad tycon (TypeNameResolutionStaticArgsInfo.FromTyArgs paramSynTypes.Length) PermitDirectReferenceToGeneratedType.No with | Exception err -> raze err - | Result(tinstEnclosing, tcref, inst) -> success(TcTypeApp cenv NoNewTypars CheckCxs ItemOccurence.UseInAttribute env tpenv mAttr tcref tinstEnclosing [] inst) + | Result(tinstEnclosing, tcref, inst) -> success(TcTypeApp cenv NoNewTypars CheckCxs ItemOccurence.UseInAttribute env tpenv mAttr tcref tinstEnclosing paramSynTypes inst) ForceRaise ((try1 (tyid.idText + "Attribute")) |> otherwise (fun () -> (try1 tyid.idText))) @@ -11145,11 +11147,11 @@ and TcAttributeEx canFail (cenv: cenv) (env: TcEnv) attrTgt attrEx (synAttr: Syn (validOnDefault, inheritedDefault) else match (TryFindFSharpAttribute g g.attrib_AttributeUsageAttribute tcref.Attribs) with - | Some(Attrib(_, _, [ AttribInt32Arg validOn ], _, _, _, _)) -> + | Some(Attrib(_, _, _, [ AttribInt32Arg validOn ], _, _, _, _)) -> (validOn, inheritedDefault) - | Some(Attrib(_, _, [ AttribInt32Arg validOn - AttribBoolArg(_allowMultiple) - AttribBoolArg inherited], _, _, _, _)) -> + | Some(Attrib(_, _, _, [ AttribInt32Arg validOn + AttribBoolArg(_allowMultiple) + AttribBoolArg inherited], _, _, _, _)) -> (validOn, inherited) | Some _ -> warning(Error(FSComp.SR.tcUnexpectedConditionInImportedAssembly(), mAttr)) @@ -11240,11 +11242,11 @@ and TcAttributeEx canFail (cenv: cenv) (env: TcEnv) attrTgt attrEx (synAttr: Syn if isStruct then error (Error(FSComp.SR.tcCustomAttributeMustBeReferenceType(), m)) if args.Length <> ilMethRef.ArgTypes.Length then error (Error(FSComp.SR.tcCustomAttributeArgumentMismatch(), m)) let args = args |> List.map mkAttribExpr - Attrib(tcref, ILAttrib ilMethRef, args, namedAttribArgMap, isAppliedToGetterOrSetter, Some constrainedTgts, m) + Attrib(tcref, ILAttrib ilMethRef, [], args, namedAttribArgMap, isAppliedToGetterOrSetter, Some constrainedTgts, m) - | Expr.App (InnerExprPat(ExprValWithPossibleTypeInst(vref, _, _, _)), _, _, args, _) -> + | Expr.App (InnerExprPat(ExprValWithPossibleTypeInst(vref, _, _, _)), _, typeArgs, args, _) -> let args = args |> List.collect (function Expr.Const (Const.Unit, _, _) -> [] | expr -> tryDestRefTupleExpr expr) |> List.map mkAttribExpr - Attrib(tcref, FSAttrib vref, args, namedAttribArgMap, isAppliedToGetterOrSetter, Some constrainedTgts, mAttr) + Attrib(tcref, FSAttrib vref, typeArgs, args, namedAttribArgMap, isAppliedToGetterOrSetter, Some constrainedTgts, mAttr) | _ -> error (Error(FSComp.SR.tcCustomAttributeMustInvokeConstructor(), mAttr)) @@ -11323,7 +11325,7 @@ and TcLetBinding (cenv: cenv) isUse env containerInfo declKind tpenv (synBinds, let (ExplicitTyparInfo(_, declaredTypars, canInferTypars)) = explicitTyparInfo let allDeclaredTypars = enclosingDeclaredTypars @ declaredTypars let generalizedTypars, prelimValSchemes2 = - let canInferTypars = GeneralizationHelpers. ComputeCanInferExtraGeneralizableTypars (containerInfo.ParentRef, canInferTypars, None) + let canInferTypars = GeneralizationHelpers.ComputeCanInferExtraGeneralizableTypars (containerInfo.ParentRef, canInferTypars, None) let maxInferredTypars = freeInTypeLeftToRight g false tauTy diff --git a/src/Compiler/Checking/FindUnsolved.fs b/src/Compiler/Checking/FindUnsolved.fs index 10eb7ab672c..aa66f64a8ad 100644 --- a/src/Compiler/Checking/FindUnsolved.fs +++ b/src/Compiler/Checking/FindUnsolved.fs @@ -226,7 +226,7 @@ and accDiscrim cenv env d mFallback = | DecisionTreeTest.Error _ -> () /// Walk an attribute, collecting type variables -and accAttrib cenv env (Attrib(_, _k, args, props, _, _, m)) = +and accAttrib cenv env (Attrib(_, _k, _, args, props, _, _, m)) = args |> List.iter (fun (AttribExpr(expr1, expr2)) -> accExpr cenv env expr1 accExpr cenv env expr2) diff --git a/src/Compiler/Checking/NicePrint.fs b/src/Compiler/Checking/NicePrint.fs index cec9d12f6ac..be7872881e4 100644 --- a/src/Compiler/Checking/NicePrint.fs +++ b/src/Compiler/Checking/NicePrint.fs @@ -583,7 +583,7 @@ module PrintTypes = sepListL RightL.comma (argsL @ propsL) /// Layout an attribute 'Type(arg1, ..., argN)' - and layoutAttrib denv (Attrib(tcref, _, args, props, _, _, _)) = + and layoutAttrib denv (Attrib(tcref, _, _, args, props, _, _, _)) = let tcrefL = layoutTyconRefImpl true denv tcref None let argsL = bracketL (layoutAttribArgs denv args props) if List.isEmpty args && List.isEmpty props then diff --git a/src/Compiler/Checking/PostInferenceChecks.fs b/src/Compiler/Checking/PostInferenceChecks.fs index c7090709cca..fa137532d0e 100644 --- a/src/Compiler/Checking/PostInferenceChecks.fs +++ b/src/Compiler/Checking/PostInferenceChecks.fs @@ -1871,7 +1871,7 @@ and CheckDecisionTreeTest cenv env m discrim = | DecisionTreeTest.ActivePatternCase (exp, _, _, _, _, _) -> CheckExprNoByrefs cenv env exp | DecisionTreeTest.Error _ -> () -and CheckAttrib cenv env (Attrib(tcref, _, args, props, _, _, m)) = +and CheckAttrib cenv env (Attrib(tcref, _, _, args, props, _, _, m)) = if List.exists (tyconRefEq cenv.g tcref) cenv.g.attribs_Unsupported then warning(Error(FSComp.SR.unsupportedAttribute(), m)) props |> List.iter (fun (AttribNamedArg(_, _, _, expr)) -> CheckAttribExpr cenv env expr) @@ -1928,7 +1928,7 @@ and CheckAttribArgExpr cenv env expr = and CheckAttribs cenv env (attribs: Attribs) = if isNil attribs then () else - let tcrefs = [ for Attrib(tcref, _, _, _, gs, _, m) in attribs -> (tcref, gs, m) ] + let tcrefs = [ for Attrib(tcref, _, _, _, _, gs, _, m) in attribs -> (tcref, gs, m) ] // Check for violations of allowMultiple = false let duplicates = @@ -2112,7 +2112,7 @@ let CheckModuleBinding cenv env (TBind(v, e, _) as bind) = IsSimpleSyntacticConstantExpr g e && // Check the thing is actually compiled as a property IsCompiledAsStaticProperty g v || - (g.compilingFSharpCore && v.Attribs |> List.exists(fun (Attrib(tc, _, _, _, _, _, _)) -> tc.CompiledName = "ValueAsStaticPropertyAttribute")) + (g.compilingFSharpCore && v.Attribs |> List.exists(fun (Attrib(tc, _, _, _, _, _, _, _)) -> tc.CompiledName = "ValueAsStaticPropertyAttribute")) then v.SetIsCompiledAsStaticPropertyWithoutField() @@ -2132,7 +2132,7 @@ let CheckModuleBinding cenv env (TBind(v, e, _) as bind) = let hasDefaultAugmentation = tcref.IsUnionTycon && match TryFindFSharpAttribute g g.attrib_DefaultAugmentationAttribute tcref.Attribs with - | Some(Attrib(_, _, [ AttribBoolArg b ], _, _, _, _)) -> b + | Some(Attrib(_, _, _, [ AttribBoolArg b ], _, _, _, _)) -> b | _ -> true (* not hiddenRepr *) let kind = (if v.IsMember then "member" else "value") diff --git a/src/Compiler/Checking/SignatureConformance.fs b/src/Compiler/Checking/SignatureConformance.fs index 08a3be709b4..7c1afc7e7fe 100644 --- a/src/Compiler/Checking/SignatureConformance.fs +++ b/src/Compiler/Checking/SignatureConformance.fs @@ -84,15 +84,15 @@ type Checker(g, amap, denv, remapInfo: SignatureRepackageInfo, checkingSig) = attribExprEq e1 e2 let attribsEq attrib1 attrib2 = - let (Attrib(implTcref, _, implArgs, implNamedArgs, _, _, _implRange)) = attrib1 - let (Attrib(signTcref, _, signArgs, signNamedArgs, _, _, _signRange)) = attrib2 + let (Attrib(implTcref, _, _, implArgs, implNamedArgs, _, _, _implRange)) = attrib1 + let (Attrib(signTcref, _, _,signArgs, signNamedArgs, _, _, _signRange)) = attrib2 tyconRefEq g signTcref implTcref && (implArgs, signArgs) ||> List.lengthsEqAndForall2 attribExprEq && (implNamedArgs, signNamedArgs) ||> List.lengthsEqAndForall2 attribNamedArgEq let attribsHaveSameTycon attrib1 attrib2 = - let (Attrib(implTcref, _, _, _, _, _, _)) = attrib1 - let (Attrib(signTcref, _, _, _, _, _, _)) = attrib2 + let (Attrib(implTcref, _, _, _, _, _, _, _)) = attrib1 + let (Attrib(signTcref, _, _, _, _, _, _, _)) = attrib2 tyconRefEq g signTcref implTcref // For each implementation attribute, only keep if it is not mentioned in the signature. @@ -113,7 +113,7 @@ type Checker(g, amap, denv, remapInfo: SignatureRepackageInfo, checkingSig) = let existsSimilarAttrib = sigAttribs |> List.exists (attribsHaveSameTycon implAttrib) if existsSimilarAttrib then - let (Attrib(implTcref, _, _, _, _, _, implRange)) = implAttrib + let (Attrib(implTcref, _, _, _, _, _, _, implRange)) = implAttrib warning(Error(FSComp.SR.tcAttribArgsDiffer(implTcref.DisplayName), implRange)) check keptImplAttribsRev remainingImplAttribs sigAttribs else diff --git a/src/Compiler/Checking/infos.fs b/src/Compiler/Checking/infos.fs index c90d49f3dcc..87306316a88 100644 --- a/src/Compiler/Checking/infos.fs +++ b/src/Compiler/Checking/infos.fs @@ -222,7 +222,7 @@ type OptionalArgInfo = else NotOptional - static member ValueOfDefaultParameterValueAttrib (Attrib (_, _, exprs, _, _, _, _)) = + static member ValueOfDefaultParameterValueAttrib (Attrib (_, _, _, exprs, _, _, _, _)) = let (AttribExpr (_, defaultValueExpr)) = List.head exprs match defaultValueExpr with | Expr.Const _ -> Some defaultValueExpr @@ -324,7 +324,7 @@ let CrackParamAttribsInfo g (ty: TType, argInfo: ArgReprInfo) = | false, false, true -> CallerMemberName | false, true, true -> match TryFindFSharpAttribute g g.attrib_CallerMemberNameAttribute argInfo.Attribs with - | Some(Attrib(_, _, _, _, _, _, callerMemberNameAttributeRange)) -> + | Some(Attrib(_, _, _, _, _, _, _, callerMemberNameAttributeRange)) -> warning(Error(FSComp.SR.CallerMemberNameIsOverriden(argInfo.Name.Value.idText), callerMemberNameAttributeRange)) CallerFilePath | _ -> failwith "Impossible" diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index 9be96f680b7..379e36a43a0 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -754,8 +754,8 @@ and ComputeUnionHasHelpers g (tcref: TyconRef) = SpecialFSharpOptionHelpers else match TryFindFSharpAttribute g g.attrib_DefaultAugmentationAttribute tcref.Attribs with - | Some(Attrib(_, _, [ AttribBoolArg b ], _, _, _, _)) -> if b then AllHelpers else NoHelpers - | Some(Attrib(_, _, _, _, _, _, m)) -> + | Some(Attrib(_, _, _, [ AttribBoolArg b ], _, _, _, _)) -> if b then AllHelpers else NoHelpers + | Some(Attrib(_, _, _, _, _, _, _, m)) -> errorR (Error(FSComp.SR.ilDefaultAugmentationAttributeCouldNotBeDecoded (), m)) AllHelpers | _ -> AllHelpers (* not hiddenRepr *) @@ -8538,7 +8538,7 @@ and GenBindingAfterDebugPoint cenv cgbuf eenv bind isStateVar startMarkOpt = let ilAttribs = if not hasLiteralAttr then vspec.Attribs - |> List.filter (fun (Attrib(_, _, _, _, _, targets, _)) -> canTarget (targets, System.AttributeTargets.Field)) + |> List.filter (fun (Attrib(_, _, _, _, _, _, targets, _)) -> canTarget (targets, System.AttributeTargets.Field)) |> GenAttrs cenv eenv // backing field only gets attributes that target fields else GenAttrs cenv eenv vspec.Attribs // literals have no property, so preserve all the attributes on the field itself @@ -8562,7 +8562,7 @@ and GenBindingAfterDebugPoint cenv cgbuf eenv bind isStateVar startMarkOpt = else let ilAttribs = vspec.Attribs - |> List.filter (fun (Attrib(_, _, _, _, _, targets, _)) -> canTarget (targets, System.AttributeTargets.Property)) + |> List.filter (fun (Attrib(_, _, _, _, _, _, targets, _)) -> canTarget (targets, System.AttributeTargets.Property)) |> GenAttrs cenv eenv // property only gets attributes that target properties let ilPropDef = @@ -8660,7 +8660,7 @@ and GenMarshal cenv attribs = |> List.filter (IsMatchingFSharpAttributeOpt g g.attrib_MarshalAsAttribute >> not) match TryFindFSharpAttributeOpt g g.attrib_MarshalAsAttribute attribs with - | Some(Attrib(_, _, [ AttribInt32Arg unmanagedType ], namedArgs, _, _, m)) -> + | Some(Attrib(_, _, _, [ AttribInt32Arg unmanagedType ], namedArgs, _, _, m)) -> let decoder = AttributeDecoder namedArgs let rec decodeUnmanagedType unmanagedType = @@ -8780,7 +8780,7 @@ and GenMarshal cenv attribs = | _ -> ILNativeType.Empty Some(decodeUnmanagedType unmanagedType), otherAttribs - | Some(Attrib(_, _, _, _, _, _, m)) -> + | Some(Attrib(_, _, _, _, _, _, _, m)) -> errorR (Error(FSComp.SR.ilMarshalAsAttributeCannotBeDecoded (), m)) None, attribs | _ -> @@ -8998,7 +8998,7 @@ and ComputeMethodImplAttribs cenv (_v: Val) attrs = let implflags = match TryFindFSharpAttribute g g.attrib_MethodImplAttribute attrs with - | Some(Attrib(_, _, [ AttribInt32Arg flags ], _, _, _, _)) -> flags + | Some(Attrib(_, _, _, [ AttribInt32Arg flags ], _, _, _, _)) -> flags | _ -> 0x0 let hasPreserveSigAttr = @@ -9143,7 +9143,7 @@ and GenMethodForBinding // Now generate the code. let hasPreserveSigNamedArg, ilMethodBody, hasDllImport = match TryFindFSharpAttributeOpt g g.attrib_DllImportAttribute v.Attribs with - | Some(Attrib(_, _, [ AttribStringArg dll ], namedArgs, _, _, m)) -> + | Some(Attrib(_, _, _, [ AttribStringArg dll ], namedArgs, _, _, m)) -> if not (isNil methLambdaTypars) then error (Error(FSComp.SR.ilSignatureForExternalFunctionContainsTypeParameters (), m)) @@ -9152,7 +9152,7 @@ and GenMethodForBinding hasPreserveSigNamedArg, mbody, true - | Some(Attrib(_, _, _, _, _, _, m)) -> error (Error(FSComp.SR.ilDllImportAttributeCouldNotBeDecoded (), m)) + | Some(Attrib(_, _, _, _, _, _, _, m)) -> error (Error(FSComp.SR.ilDllImportAttributeCouldNotBeDecoded (), m)) | _ -> // Replace the body of ValInline.PseudoVal "must inline" methods with a 'throw' @@ -9192,14 +9192,14 @@ and GenMethodForBinding |> List.filter (IsMatchingFSharpAttribute g g.attrib_CompiledNameAttribute >> not) let attrsAppliedToGetterOrSetter, attrs = - List.partition (fun (Attrib(_, _, _, _, isAppliedToGetterOrSetter, _, _)) -> isAppliedToGetterOrSetter) attrs + List.partition (fun (Attrib(_, _, _, _, _, isAppliedToGetterOrSetter, _, _)) -> isAppliedToGetterOrSetter) attrs let sourceNameAttribs, compiledName = match v.Attribs |> List.tryFind (IsMatchingFSharpAttribute g g.attrib_CompiledNameAttribute) with - | Some(Attrib(_, _, [ AttribStringArg b ], _, _, _, _)) -> [ mkCompilationSourceNameAttr g v.LogicalName ], Some b + | Some(Attrib(_, _, _, [ AttribStringArg b ], _, _, _, _)) -> [ mkCompilationSourceNameAttr g v.LogicalName ], Some b | _ -> [], None // check if the hasPreserveSigNamedArg and hasSynchronizedImplFlag implementation flags have been specified @@ -9958,7 +9958,7 @@ and GenAttribArg amap g eenv x (ilArgTy: ILType) = // Other expressions are not valid custom attribute values | _ -> error (InternalError("invalid custom attribute value (not a constant): " + showL (exprL x), x.Range)) -and GenAttr cenv g eenv (Attrib(_, k, args, props, _, _, _)) = +and GenAttr cenv g eenv (Attrib(_, k, typeArgs, args, props, _, _, m)) = let props = props |> List.map (fun (AttribNamedArg(s, ty, fld, AttribExpr(_, expr))) -> @@ -9967,16 +9967,33 @@ and GenAttr cenv g eenv (Attrib(_, k, args, props, _, _, _)) = let cval = GenAttribArg cenv g eenv expr ilTy (s, ilTy, fld, cval)) + let ilTyArgs = GenTypeArgs cenv m eenv.tyenv typeArgs + let mspec = match k with - | ILAttrib mref -> mkILMethSpec (mref, AsObject, [], []) + | ILAttrib mref -> mkILMethSpec (mref, AsObject, ilTyArgs, []) | FSAttrib vref -> assert vref.IsMember let mspec, _, _, _, _, _, _, _, _, _ = GetMethodSpecForMemberVal cenv (Option.get vref.MemberInfo) vref - mspec + //numEnclILTypeArgs will include unit-of-measure args, unfortunately. For now, just cut-and-paste code from GetMemberCallInfo + //@REVIEW: refactor this + let numEnclILTypeArgs = + match vref.MemberInfo with + | Some _ when not vref.IsExtensionMember -> List.length (vref.MemberApparentEntity.TyparsNoRange |> DropErasedTypars) + | _ -> 0 + + let ilEnclArgTys, ilMethArgTys = + if ilTyArgs.Length < numEnclILTypeArgs then + error (InternalError("length mismatch", m)) + + List.splitAt numEnclILTypeArgs ilTyArgs + + let boxity = mspec.DeclaringType.Boxity + + mkILMethSpec (mspec.MethodRef, boxity, ilEnclArgTys, ilMethArgTys) let ilArgs = List.map2 (fun (AttribExpr(_, vexpr)) ty -> GenAttribArg cenv g eenv vexpr ty) args mspec.FormalArgTypes @@ -10008,7 +10025,7 @@ and CreatePermissionSets cenv eenv (securityAttributes: Attrib list) = let g = cenv.g [ - for Attrib(tcref, _, actions, _, _, _, _) as attr in securityAttributes do + for Attrib(tcref, _, _, actions, _, _, _, _) as attr in securityAttributes do let action = match actions with | [ AttribInt32Arg act ] -> act @@ -10978,7 +10995,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option let ilFieldOffset = match TryFindFSharpAttribute g g.attrib_FieldOffsetAttribute fspec.FieldAttribs with - | Some(Attrib(_, _, [ AttribInt32Arg fieldOffset ], _, _, _, _)) -> Some fieldOffset + | Some(Attrib(_, _, _, [ AttribInt32Arg fieldOffset ], _, _, _, _)) -> Some fieldOffset | Some attrib -> errorR (Error(FSComp.SR.ilFieldOffsetAttributeCouldNotBeDecoded (), attrib.Range)) None @@ -11393,7 +11410,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option let tdLayout, tdEncoding = match TryFindFSharpAttribute g g.attrib_StructLayoutAttribute tycon.Attribs with - | Some(Attrib(_, _, [ AttribInt32Arg layoutKind ], namedArgs, _, _, _)) -> + | Some(Attrib(_, _, _, [ AttribInt32Arg layoutKind ], namedArgs, _, _, _)) -> let decoder = AttributeDecoder namedArgs let ilPack = decoder.FindInt32 "Pack" 0x0 let ilSize = decoder.FindInt32 "Size" 0x0 @@ -11422,7 +11439,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option | _ -> ILTypeDefLayout.Auto tdLayout, tdEncoding - | Some(Attrib(_, _, _, _, _, _, m)) -> + | Some(Attrib(_, _, _, _, _, _, _, m)) -> errorR (Error(FSComp.SR.ilStructLayoutAttributeCouldNotBeDecoded (), m)) ILTypeDefLayout.Auto, ILDefaultPInvokeEncoding.Ansi diff --git a/src/Compiler/Driver/CompilerDiagnostics.fs b/src/Compiler/Driver/CompilerDiagnostics.fs index 823eb4ccbf1..27e0bcb8a07 100644 --- a/src/Compiler/Driver/CompilerDiagnostics.fs +++ b/src/Compiler/Driver/CompilerDiagnostics.fs @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. -/// Contains logic to prepare, post-process, filter and emit compiler diagnsotics +/// Contains logic to prepare, post-process, filter and emit compiler diagnostics module internal FSharp.Compiler.CompilerDiagnostics open System diff --git a/src/Compiler/Driver/CreateILModule.fs b/src/Compiler/Driver/CreateILModule.fs index 506171ed0ef..048b7226c5e 100644 --- a/src/Compiler/Driver/CreateILModule.fs +++ b/src/Compiler/Driver/CreateILModule.fs @@ -35,7 +35,7 @@ module AttributeHelpers = | None -> None | Some attribRef -> match TryFindFSharpAttribute g attribRef attribs with - | Some(Attrib(_, _, [ AttribStringArg s ], _, _, _, _)) -> Some s + | Some(Attrib(_, _, _, [ AttribStringArg s ], _, _, _, _)) -> Some s | _ -> None let TryFindIntAttribute (g: TcGlobals) attrib attribs = @@ -43,7 +43,7 @@ module AttributeHelpers = | None -> None | Some attribRef -> match TryFindFSharpAttribute g attribRef attribs with - | Some(Attrib(_, _, [ AttribInt32Arg i ], _, _, _, _)) -> Some i + | Some(Attrib(_, _, _, [ AttribInt32Arg i ], _, _, _, _)) -> Some i | _ -> None let TryFindBoolAttribute (g: TcGlobals) attrib attribs = @@ -51,7 +51,7 @@ module AttributeHelpers = | None -> None | Some attribRef -> match TryFindFSharpAttribute g attribRef attribs with - | Some(Attrib(_, _, [ AttribBoolArg p ], _, _, _, _)) -> Some p + | Some(Attrib(_, _, _, [ AttribBoolArg p ], _, _, _, _)) -> Some p | _ -> None [] diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index 25047f08e39..15b5a8b0747 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -1752,3 +1752,4 @@ featureReuseSameFieldsInStructUnions,"Share underlying fields in a [] di 3868,tcActivePatternArgsCountNotMatchOnlyPat,"This active pattern expects exactly one pattern argument, e.g., '%s pat'." 3868,tcActivePatternArgsCountNotMatchArgs,"This active pattern expects %d expression argument(s), e.g., '%s%s'." 3868,tcActivePatternArgsCountNotMatchArgsAndPat,"This active pattern expects %d expression argument(s) and a pattern argument, e.g., '%s%s pat'." +featureGenericAttributes,"Permit Type Arguments in Attributes." \ No newline at end of file diff --git a/src/Compiler/Facilities/LanguageFeatures.fs b/src/Compiler/Facilities/LanguageFeatures.fs index 50b891335da..2b86b010661 100644 --- a/src/Compiler/Facilities/LanguageFeatures.fs +++ b/src/Compiler/Facilities/LanguageFeatures.fs @@ -89,6 +89,7 @@ type LanguageFeature = | LowerInterpolatedStringToConcat | LowerIntegralRangesToFastLoops | LowerSimpleMappingsInComprehensionsToDirectCallsToMap + | GenericAttributes /// LanguageVersion management type LanguageVersion(versionText) = @@ -205,6 +206,7 @@ type LanguageVersion(versionText) = LanguageFeature.LowerInterpolatedStringToConcat, previewVersion LanguageFeature.LowerIntegralRangesToFastLoops, previewVersion LanguageFeature.LowerSimpleMappingsInComprehensionsToDirectCallsToMap, previewVersion + LanguageFeature.GenericAttributes, previewVersion ] static let defaultLanguageVersion = LanguageVersion("default") @@ -353,6 +355,7 @@ type LanguageVersion(versionText) = | LanguageFeature.LowerIntegralRangesToFastLoops -> FSComp.SR.featureLowerIntegralRangesToFastLoops () | LanguageFeature.LowerSimpleMappingsInComprehensionsToDirectCallsToMap -> FSComp.SR.featureLowerSimpleMappingsInComprehensionsToDirectCallsToMap () + | LanguageFeature.GenericAttributes -> FSComp.SR.featureGenericAttributes () /// Get a version string associated with the given feature. static member GetFeatureVersionString feature = diff --git a/src/Compiler/Facilities/LanguageFeatures.fsi b/src/Compiler/Facilities/LanguageFeatures.fsi index 5cf1520db7f..e9a3de7c760 100644 --- a/src/Compiler/Facilities/LanguageFeatures.fsi +++ b/src/Compiler/Facilities/LanguageFeatures.fsi @@ -80,6 +80,7 @@ type LanguageFeature = | LowerInterpolatedStringToConcat | LowerIntegralRangesToFastLoops | LowerSimpleMappingsInComprehensionsToDirectCallsToMap + | GenericAttributes /// LanguageVersion management type LanguageVersion = diff --git a/src/Compiler/Service/IncrementalBuild.fs b/src/Compiler/Service/IncrementalBuild.fs index 76056026c1d..a40df53f6ef 100644 --- a/src/Compiler/Service/IncrementalBuild.fs +++ b/src/Compiler/Service/IncrementalBuild.fs @@ -594,7 +594,7 @@ type PartialCheckResults (boundModel: BoundModel, timeStamp: DateTime, projectTi module Utilities = let TryFindFSharpStringAttribute tcGlobals attribSpec attribs = match TryFindFSharpAttribute tcGlobals attribSpec attribs with - | Some (Attrib(_, _, [ AttribStringArg s ], _, _, _, _)) -> Some s + | Some (Attrib(_, _, _, [ AttribStringArg s ], _, _, _, _)) -> Some s | _ -> None /// The implementation of the information needed by TcImports in CompileOps.fs for an F# assembly reference. @@ -804,7 +804,7 @@ module IncrementalBuilderHelpers = // Assemblies containing type provider components can not successfully be used via cross-assembly references. // We return 'None' for the assembly portion of the cross-assembly reference let hasTypeProviderAssemblyAttrib = - topAttrs.assemblyAttrs |> List.exists (fun (Attrib(tcref, _, _, _, _, _, _)) -> + topAttrs.assemblyAttrs |> List.exists (fun (Attrib(tcref, _, _, _, _, _, _, _)) -> let nm = tcref.CompiledRepresentationForNamedType.BasicQualifiedName nm = typeof.FullName) diff --git a/src/Compiler/Service/TransparentCompiler.fs b/src/Compiler/Service/TransparentCompiler.fs index f2af93736e3..5d5363309e9 100644 --- a/src/Compiler/Service/TransparentCompiler.fs +++ b/src/Compiler/Service/TransparentCompiler.fs @@ -1742,7 +1742,7 @@ type internal TransparentCompiler // We return 'None' for the assembly portion of the cross-assembly reference let hasTypeProviderAssemblyAttrib = topAttrs.assemblyAttrs - |> List.exists (fun (Attrib(tcref, _, _, _, _, _, _)) -> + |> List.exists (fun (Attrib(tcref, _, _, _, _, _, _, _)) -> let nm = tcref.CompiledRepresentationForNamedType.BasicQualifiedName nm = typeof.FullName) diff --git a/src/Compiler/Symbols/Symbols.fs b/src/Compiler/Symbols/Symbols.fs index 19fbfe9306b..e7803b3627a 100644 --- a/src/Compiler/Symbols/Symbols.fs +++ b/src/Compiler/Symbols/Symbols.fs @@ -2718,7 +2718,7 @@ type FSharpAttribute(cenv: SymbolEnv, attrib: AttribInfo) = | _ -> arg member _.AttributeType = - FSharpEntity(cenv, attrib.TyconRef) + FSharpEntity(cenv, attrib.TyconRef, []) member _.IsUnresolved = entityIsUnresolved(attrib.TyconRef) @@ -2727,6 +2727,11 @@ type FSharpAttribute(cenv: SymbolEnv, attrib: AttribInfo) = |> List.map (fun (ty, obj) -> FSharpType(cenv, ty), resolveArgObj obj) |> makeReadOnlyCollection + member _.TypeArgs = + attrib.TypeArgs + |> List.map (fun (ty) -> FSharpType(cenv, ty)) + |> makeReadOnlyCollection + member _.NamedArguments = attrib.NamedArguments |> List.map (fun (ty, nm, isField, obj) -> FSharpType(cenv, ty), nm, isField, resolveArgObj obj) diff --git a/src/Compiler/Symbols/Symbols.fsi b/src/Compiler/Symbols/Symbols.fsi index 5530ba53ec5..3933048e956 100644 --- a/src/Compiler/Symbols/Symbols.fsi +++ b/src/Compiler/Symbols/Symbols.fsi @@ -1185,6 +1185,8 @@ type FSharpAttribute = /// The arguments to the constructor for the attribute member ConstructorArguments: IList + member TypeArgs: IList + /// The named arguments for the attribute member NamedArguments: IList diff --git a/src/Compiler/SyntaxTree/LexFilter.fs b/src/Compiler/SyntaxTree/LexFilter.fs index 79afdca04c3..cf2f03b87ec 100644 --- a/src/Compiler/SyntaxTree/LexFilter.fs +++ b/src/Compiler/SyntaxTree/LexFilter.fs @@ -1063,6 +1063,12 @@ type LexFilterImpl ( | LPAREN -> isAdjacent tokenTup lookaheadTokenTup | _ -> false + let nextTokenIsAdjacentRBrack (tokenTup: TokenTup) = + let lookaheadTokenTup = peekNextTokenTup() + match lookaheadTokenTup.Token with + | RBRACK -> isAdjacent tokenTup lookaheadTokenTup + | _ -> false + let nextTokenIsAdjacent firstTokenTup = let lookaheadTokenTup = peekNextTokenTup() isAdjacent firstTokenTup lookaheadTokenTup @@ -1107,7 +1113,7 @@ type LexFilterImpl ( let dotTokenTup = peekNextTokenTup() stack <- (pool.UseLocation(dotTokenTup, HIGH_PRECEDENCE_PAREN_APP), false) :: stack true - | INFIX_COMPARE_OP (TyparsCloseOp(greaters, afterOp)) -> + | INFIX_COMPARE_OP (TyparsCloseOp(greaters, afterOp) as opString) -> let nParen = nParen - greaters.Length if nParen > 0 then // Don't smash the token if there is an after op and we're in a nested paren @@ -1120,7 +1126,18 @@ type LexFilterImpl ( if afterOp.IsNone && nextTokenIsAdjacentLParen lookaheadTokenTup then let dotTokenTup = peekNextTokenTup() stack <- (pool.UseLocation(dotTokenTup, HIGH_PRECEDENCE_PAREN_APP), false) :: stack - true + true + // On succesful parse of a set of type parameters, and when nParen < 0 look for an adjavent ], e.g. + // Attr>] + // nParen = -1 here will indicate that the lexer has captured an extra '<' that isn't apart of the typar. + else if afterOp.IsNone && nextTokenIsAdjacentRBrack lookaheadTokenTup && nParen = -1 then + let dotTokenTop = popNextTokenTup() + //this might be a good candidate for a lex rule, but FSLex doesn't appear to support negative look ahead + stack <- (pool.UseShiftedLocation(lookaheadTokenTup, INFIX_COMPARE_OP (opString.Remove(opString.Length - 1)), 0, -1), true) :: stack.Tail + stack <- (pool.UseShiftedLocation(dotTokenTop, GREATER_RBRACK, -1, 0), false) :: stack + false + else + true | LPAREN | LESS _ | LBRACK diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fs b/src/Compiler/SyntaxTree/SyntaxTree.fs index 69cd067ddfe..6c8a90b1545 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fs +++ b/src/Compiler/SyntaxTree/SyntaxTree.fs @@ -1043,6 +1043,8 @@ type SynAttribute = { TypeName: SynLongIdent + TypeArgs: SynType list + ArgExpr: SynExpr Target: Ident option diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fsi b/src/Compiler/SyntaxTree/SyntaxTree.fsi index 363ddf55a1d..0af340740f2 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTree.fsi @@ -1170,6 +1170,9 @@ type SynAttribute = /// The name of the type for the attribute TypeName: SynLongIdent + /// The type parameters of the attribute. + TypeArgs: SynType list + /// The argument of the attribute, perhaps a tuple ArgExpr: SynExpr diff --git a/src/Compiler/TypedTree/TcGlobals.fs b/src/Compiler/TypedTree/TcGlobals.fs index 69a99dfe119..8c5bb87dd95 100644 --- a/src/Compiler/TypedTree/TcGlobals.fs +++ b/src/Compiler/TypedTree/TcGlobals.fs @@ -919,9 +919,9 @@ type TcGlobals( let addValGeneratedAttrs (v: Val) m = if not noDebugAttributes then let attrs = [ - Attrib(v_CompilerGeneratedAttribute_tcr, ILAttrib compilerGeneratedAttribute.Method.MethodRef, [], [], false, None, m) - Attrib(v_DebuggerNonUserCodeAttribute_tcr, ILAttrib debuggerNonUserCodeAttribute.Method.MethodRef, [], [], false, None, m) - Attrib(v_DebuggerNonUserCodeAttribute_tcr, ILAttrib debuggerNonUserCodeAttribute.Method.MethodRef, [], [], true, None, m) + Attrib(v_CompilerGeneratedAttribute_tcr, ILAttrib compilerGeneratedAttribute.Method.MethodRef, [], [], [], false, None, m) + Attrib(v_DebuggerNonUserCodeAttribute_tcr, ILAttrib debuggerNonUserCodeAttribute.Method.MethodRef, [], [], [], false, None, m) + Attrib(v_DebuggerNonUserCodeAttribute_tcr, ILAttrib debuggerNonUserCodeAttribute.Method.MethodRef, [], [], [], true, None, m) ] match v.Attribs with diff --git a/src/Compiler/TypedTree/TypedTree.fs b/src/Compiler/TypedTree/TypedTree.fs index ec455fcbee8..1d9b4c4ba65 100644 --- a/src/Compiler/TypedTree/TypedTree.fs +++ b/src/Compiler/TypedTree/TypedTree.fs @@ -2926,7 +2926,7 @@ type Val = /// Indicates if the backing field for a static value is suppressed. member x.IsCompiledAsStaticPropertyWithoutField = - let hasValueAsStaticProperty = x.Attribs |> List.exists(fun (Attrib(tc, _, _, _, _, _, _)) -> tc.CompiledName = "ValueAsStaticPropertyAttribute") + let hasValueAsStaticProperty = x.Attribs |> List.exists(fun (Attrib(tc, _, _, _,_, _, _, _)) -> tc.CompiledName = "ValueAsStaticPropertyAttribute") x.val_flags.IsCompiledAsStaticPropertyWithoutField || hasValueAsStaticProperty /// Indicates if the value is pinned/fixed @@ -4496,6 +4496,7 @@ type Attrib = | Attrib of tyconRef: TyconRef * kind: AttribKind * + typeArgs: TypeInst * unnamedArgs: AttribExpr list * propVal: AttribNamedArg list * appliedToAGetterOrSetter: bool * @@ -4505,9 +4506,9 @@ type Attrib = [] member x.DebugText = x.ToString() - member x.TyconRef = (let (Attrib(tcref, _, _, _, _, _, _)) = x in tcref) + member x.TyconRef = (let (Attrib(tcref, _, _, _, _, _, _, _)) = x in tcref) - member x.Range = (let (Attrib(_, _, _, _, _, _, m)) = x in m) + member x.Range = (let (Attrib(_, _, _, _, _, _, _, m)) = x in m) override x.ToString() = "attrib" + x.TyconRef.ToString() diff --git a/src/Compiler/TypedTree/TypedTree.fsi b/src/Compiler/TypedTree/TypedTree.fsi index ca766220265..572823d3bbc 100644 --- a/src/Compiler/TypedTree/TypedTree.fsi +++ b/src/Compiler/TypedTree/TypedTree.fsi @@ -3178,6 +3178,7 @@ type Attrib = | Attrib of tyconRef: TyconRef * kind: AttribKind * + typeArgs: TypeInst * unnamedArgs: AttribExpr list * propVal: AttribNamedArg list * appliedToAGetterOrSetter: bool * diff --git a/src/Compiler/TypedTree/TypedTreeOps.fs b/src/Compiler/TypedTree/TypedTreeOps.fs index 120baae8461..cbc7f482fe5 100644 --- a/src/Compiler/TypedTree/TypedTreeOps.fs +++ b/src/Compiler/TypedTree/TypedTreeOps.fs @@ -3421,13 +3421,13 @@ let TryDecodeILAttribute tref (attrs: ILAttributes) = attrs.AsArray() |> Array.tryPick (fun x -> if isILAttrib tref x then Some(decodeILAttribData x) else None) // F# view of attributes (these get converted to AbsIL attributes in ilxgen) -let IsMatchingFSharpAttribute g (AttribInfo(_, tcref)) (Attrib(tcref2, _, _, _, _, _, _)) = tyconRefEq g tcref tcref2 +let IsMatchingFSharpAttribute g (AttribInfo(_, tcref)) (Attrib(tcref2, _, _, _, _, _, _, _)) = tyconRefEq g tcref tcref2 let HasFSharpAttribute g tref attrs = List.exists (IsMatchingFSharpAttribute g tref) attrs let TryFindFSharpAttribute g tref attrs = List.tryFind (IsMatchingFSharpAttribute g tref) attrs let TryFindFSharpAttributeOpt g tref attrs = match tref with None -> None | Some tref -> List.tryFind (IsMatchingFSharpAttribute g tref) attrs let HasFSharpAttributeOpt g trefOpt attrs = match trefOpt with Some tref -> List.exists (IsMatchingFSharpAttribute g tref) attrs | _ -> false -let IsMatchingFSharpAttributeOpt g attrOpt (Attrib(tcref2, _, _, _, _, _, _)) = match attrOpt with Some (AttribInfo(_, tcref)) -> tyconRefEq g tcref tcref2 | _ -> false +let IsMatchingFSharpAttributeOpt g attrOpt (Attrib(tcref2, _, _, _, _, _, _, _)) = match attrOpt with Some (AttribInfo(_, tcref)) -> tyconRefEq g tcref tcref2 | _ -> false [] let (|ExtractAttribNamedArg|_|) nm args = @@ -3450,8 +3450,8 @@ let (|AttribStringArg|_|) = function AttribExpr(_, Expr.Const (Const.String n, _ let TryFindFSharpBoolAttributeWithDefault dflt g nm attrs = match TryFindFSharpAttribute g nm attrs with - | Some(Attrib(_, _, [ ], _, _, _, _)) -> Some dflt - | Some(Attrib(_, _, [ AttribBoolArg b ], _, _, _, _)) -> Some b + | Some(Attrib(_, _, _, [ ], _, _, _, _)) -> Some dflt + | Some(Attrib(_, _, _, [ AttribBoolArg b ], _, _, _, _)) -> Some b | _ -> None let TryFindFSharpBoolAttribute g nm attrs = TryFindFSharpBoolAttributeWithDefault true g nm attrs @@ -3459,12 +3459,12 @@ let TryFindFSharpBoolAttributeAssumeFalse g nm attrs = TryFindFSharpBoolAttribut let TryFindFSharpInt32Attribute g nm attrs = match TryFindFSharpAttribute g nm attrs with - | Some(Attrib(_, _, [ AttribInt32Arg b ], _, _, _, _)) -> Some b + | Some(Attrib(_, _, _, [ AttribInt32Arg b ], _, _, _, _)) -> Some b | _ -> None let TryFindFSharpStringAttribute g nm attrs = match TryFindFSharpAttribute g nm attrs with - | Some(Attrib(_, _, [ AttribStringArg b ], _, _, _, _)) -> Some b + | Some(Attrib(_, _, _, [ AttribStringArg b ], _, _, _, _)) -> Some b | _ -> None let TryFindILAttribute (AttribInfo (atref, _)) attrs = @@ -3505,8 +3505,8 @@ let TryFindTyconRefBoolAttribute g m attribSpec tcref = | [ILAttribElem.Bool v ], _ -> Some v | _ -> None) (function - | Attrib(_, _, [ ], _, _, _, _) -> Some true - | Attrib(_, _, [ AttribBoolArg v ], _, _, _, _) -> Some v + | Attrib(_, _, _, [ ], _, _, _, _) -> Some true + | Attrib(_, _, _, [ AttribBoolArg v ], _, _, _, _) -> Some v | _ -> None) (function | [ ], _ -> Some true @@ -3520,7 +3520,7 @@ let TryFindAttributeUsageAttribute g m tcref = |> Array.tryPick (fun tcref -> TryBindTyconRefAttribute g m g.attrib_AttributeUsageAttribute tcref (fun (_, named) -> named |> List.tryPick (function "AllowMultiple", _, _, ILAttribElem.Bool res -> Some res | _ -> None)) - (fun (Attrib(_, _, _, named, _, _, _)) -> named |> List.tryPick (function AttribNamedArg("AllowMultiple", _, _, AttribBoolArg res ) -> Some res | _ -> None)) + (fun (Attrib(_, _, _, _, named, _, _, _)) -> named |> List.tryPick (function AttribNamedArg("AllowMultiple", _, _, AttribBoolArg res ) -> Some res | _ -> None)) (fun (_, named) -> named |> List.tryPick (function "AllowMultiple", Some (:? bool as res : obj) -> Some res | _ -> None)) ) @@ -3530,7 +3530,7 @@ let TryFindAttributeUsageAttribute g m tcref = let TryFindTyconRefStringAttribute g m attribSpec tcref = TryBindTyconRefAttribute g m attribSpec tcref (function [ILAttribElem.String (Some msg) ], _ -> Some msg | _ -> None) - (function Attrib(_, _, [ AttribStringArg msg ], _, _, _, _) -> Some msg | _ -> None) + (function Attrib(_, _, _, [ AttribStringArg msg ], _, _, _, _) -> Some msg | _ -> None) (function [ Some (:? string as msg : obj) ], _ -> Some msg | _ -> None) /// Check if a type definition has a specific attribute @@ -3543,8 +3543,8 @@ let TyconRefHasAttribute g m attribSpec tcref = let HasDefaultAugmentationAttribute g (tcref: TyconRef) = match TryFindFSharpAttribute g g.attrib_DefaultAugmentationAttribute tcref.Attribs with - | Some(Attrib(_, _, [ AttribBoolArg b ], _, _, _, _)) -> b - | Some (Attrib(_, _, _, _, _, _, m)) -> + | Some(Attrib(_, _, _, [ AttribBoolArg b ], _, _, _, _)) -> b + | Some (Attrib(_, _, _, _, _, _, _, m)) -> errorR(Error(FSComp.SR.ilDefaultAugmentationAttributeCouldNotBeDecoded(), m)) true | _ -> true @@ -4182,7 +4182,7 @@ module DebugPrint = let valRefL (vr: ValRef) = wordL (tagText vr.LogicalName) |> stampL vr.Stamp - let layoutAttrib (Attrib(_, k, _, _, _, _, _)) = + let layoutAttrib (Attrib(_, k, _, _, _, _, _, _)) = leftL (tagText "[<") ^^ (match k with | ILAttrib ilmeth -> wordL (tagText ilmeth.Name) @@ -5767,10 +5767,11 @@ type RemapContext = { g: TcGlobals stackGuard: StackGuard } -let rec remapAttribImpl ctxt tmenv (Attrib (tcref, kind, args, props, isGetOrSetAttr, targets, m)) = +let rec remapAttribImpl ctxt tmenv (Attrib (tcref, kind, typeArgs, args, props, isGetOrSetAttr, targets, m)) = Attrib( remapTyconRef tmenv.tyconRefRemap tcref, remapAttribKind tmenv kind, + typeArgs, args |> List.map (remapAttribExpr ctxt tmenv), props |> List.map (fun (AttribNamedArg(nm, ty, flg, expr)) -> AttribNamedArg(nm, remapType tmenv ty, flg, remapAttribExpr ctxt tmenv expr)), isGetOrSetAttr, diff --git a/src/Compiler/TypedTree/TypedTreePickle.fs b/src/Compiler/TypedTree/TypedTreePickle.fs index 038909659ce..1e93701c20b 100644 --- a/src/Compiler/TypedTree/TypedTreePickle.fs +++ b/src/Compiler/TypedTree/TypedTreePickle.fs @@ -259,6 +259,9 @@ let inline p_tup5 p1 p2 p3 p4 p5 (a, b, c, d, e) (st: WriterState) = let inline p_tup6 p1 p2 p3 p4 p5 p6 (a, b, c, d, e, f) (st: WriterState) = (p1 a st : unit); (p2 b st : unit); (p3 c st : unit); (p4 d st : unit); (p5 e st : unit); (p6 f st : unit) +let inline _p_tup7 p1 p2 p3 p4 p5 p6 p7 (a, b, c, d, e, f, x7) (st: WriterState) = + (p1 a st : unit); (p2 b st : unit); (p3 c st : unit); (p4 d st : unit); (p5 e st : unit); (p6 f st : unit); (p7 x7 st : unit) + let inline p_tup9 p1 p2 p3 p4 p5 p6 p7 p8 p9 (a, b, c, d, e, f, x7, x8, x9) (st: WriterState) = (p1 a st : unit); (p2 b st : unit); (p3 c st : unit); (p4 d st : unit); (p5 e st : unit); (p6 f st : unit); (p7 x7 st : unit); (p8 x8 st : unit); (p9 x9 st : unit) @@ -357,6 +360,9 @@ let inline u_tup5 p1 p2 p3 p4 p5 (st: ReaderState) = let inline u_tup6 p1 p2 p3 p4 p5 p6 (st: ReaderState) = let a = p1 st in let b = p2 st in let c = p3 st in let d = p4 st in let e = p5 st in let f = p6 st in (a, b, c, d, e, f) +let inline _u_tup7 p1 p2 p3 p4 p5 p6 p7 (st: ReaderState) = + let a = p1 st in let b = p2 st in let c = p3 st in let d = p4 st in let e = p5 st in let f = p6 st in let x7 = p7 st in (a, b, c, d, e, f, x7) + let inline u_tup8 p1 p2 p3 p4 p5 p6 p7 p8 (st: ReaderState) = let a = p1 st in let b = p2 st in let c = p3 st in let d = p4 st in let e = p5 st in let f = p6 st in let x7 = p7 st in let x8 = p8 st in (a, b, c, d, e, f, x7, x8) @@ -1941,8 +1947,8 @@ and p_attribkind x st = | ILAttrib x -> p_byte 0 st; p_ILMethodRef x st | FSAttrib x -> p_byte 1 st; p_vref "attrib" x st -and p_attrib (Attrib (a, b, c, d, e, _targets, f)) st = // AttributeTargets are not preserved - p_tup6 (p_tcref "attrib") p_attribkind (p_list p_attrib_expr) (p_list p_attrib_arg) p_bool p_dummy_range (a, b, c, d, e, f) st +and p_attrib (Attrib (a, b, _tyArgs, c, d, e, _targets, f)) st = // AttributeTargets are not preserved (p_list p_ty) + p_tup6 (p_tcref "attrib") p_attribkind (p_list p_attrib_expr) (p_list p_attrib_arg) p_bool p_dummy_range (a, b, c, d, e, f) st and p_attrib_expr (AttribExpr(e1, e2)) st = p_tup2 p_expr p_expr (e1, e2) st @@ -2252,7 +2258,7 @@ and u_attribkind st = and u_attrib st : Attrib = let a, b, c, d, e, f = u_tup6 u_tcref u_attribkind (u_list u_attrib_expr) (u_list u_attrib_arg) u_bool u_dummy_range st - Attrib(a, b, c, d, e, None, f) // AttributeTargets are not preserved + Attrib(a, b, [], c, d, e, None, f) // AttributeTargets are not preserved (u_list u_ty) and u_attrib_expr st = let a, b = u_tup2 u_expr u_expr st diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index 96dccbc1353..a27f083b49c 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -1506,26 +1506,52 @@ attributeListElements: /* One custom attribute */ -attribute: +attribute: /* A custom attribute */ | path opt_HIGH_PRECEDENCE_APP opt_atomicExprAfterType { let arg = match $3 with None -> mkSynUnit $1.Range | Some e -> e let m = unionRanges $1.Range arg.Range - ({ TypeName = $1; ArgExpr = arg; Target = None; AppliesToGetterAndSetter = false; Range = m }: SynAttribute) } + ({ TypeName = $1; ArgExpr = arg; TypeArgs = []; Target = None; AppliesToGetterAndSetter = false; Range = m }: SynAttribute) } + + /* A custom attribute with type arguments */ + | path opt_HIGH_PRECEDENCE_TYAPP typeArgsActual opt_HIGH_PRECEDENCE_APP opt_atomicExprAfterType + { + let mLessThan, mGreaterThan, _, args, commas, mAll = $3 + let arg = match $5 with None -> mkSynUnit (unionRanges $1.Range mAll) | Some e -> e + let m = unionRanges $1.Range arg.Range + ({ TypeName = $1; ArgExpr = arg; TypeArgs = args; Target = None; AppliesToGetterAndSetter = false; Range = m }: SynAttribute) } /* A custom attribute with an attribute target */ | attributeTarget path opt_HIGH_PRECEDENCE_APP opt_atomicExprAfterType { let arg = match $4 with None -> mkSynUnit $2.Range | Some e -> e let startRange = match $1 with Some(ident:Ident) -> ident.idRange | None -> $2.Range let m = unionRanges startRange arg.Range - ({ TypeName = $2; ArgExpr = arg; Target = $1; AppliesToGetterAndSetter = false; Range = m }: SynAttribute) } - + ({ TypeName = $2; ArgExpr = arg; TypeArgs = []; Target = $1; AppliesToGetterAndSetter = false; Range = m }: SynAttribute) } + + /* A custom attribute with an attribute target and type arguments*/ + | attributeTarget path opt_HIGH_PRECEDENCE_TYAPP typeArgsActual opt_HIGH_PRECEDENCE_APP opt_atomicExprAfterType + { + let mLessThan, mGreaterThan, _, args, commas, mAll = $4 + let arg = match $6 with None -> mkSynUnit (unionRanges $2.Range mAll) | Some e -> e + let startRange = match $1 with Some(ident:Ident) -> ident.idRange | None -> $2.Range + let m = unionRanges startRange arg.Range + ({ TypeName = $2; ArgExpr = arg; TypeArgs = args; Target = $1; AppliesToGetterAndSetter = false; Range = m }: SynAttribute) } + /* A custom attribute with an attribute target */ | attributeTarget OBLOCKBEGIN path oblockend opt_HIGH_PRECEDENCE_APP opt_atomicExprAfterType { let arg = match $6 with None -> mkSynUnit $3.Range | Some e -> e let startRange = match $1 with Some ident -> ident.idRange | None -> $3.Range let m = unionRanges startRange arg.Range - ({ TypeName = $3; ArgExpr = arg; Target = $1; AppliesToGetterAndSetter = false; Range = m }: SynAttribute) } + ({ TypeName = $3; ArgExpr = arg; TypeArgs = []; Target = $1; AppliesToGetterAndSetter = false; Range = m }: SynAttribute) } + + /* A custom attribute with an attribute target and type arguments */ + | attributeTarget OBLOCKBEGIN path oblockend opt_HIGH_PRECEDENCE_TYAPP typeArgsActual opt_HIGH_PRECEDENCE_APP opt_atomicExprAfterType + { + let mLessThan, mGreaterThan, _, args, commas, mAll = $6 + let arg = match $8 with None -> mkSynUnit (unionRanges $3.Range mAll) | Some e -> e + let startRange = match $1 with Some(ident:Ident) -> ident.idRange | None -> $3.Range + let m = unionRanges startRange arg.Range + ({ TypeName = $3; ArgExpr = arg; TypeArgs = args; Target = $1; AppliesToGetterAndSetter = false; Range = m }: SynAttribute) } /* The target of a custom attribute */ @@ -6348,6 +6374,8 @@ typeArgsNoHpaDeprecated: { let mLessThan, mGreaterThan, _, args, commas, mAll = $2 mLessThan, mGreaterThan, args, commas, mAll } + + typeArgsActual: | LESS typeArgActualOrDummyIfEmpty COMMA typeArgActualOrDummyIfEmpty typeArgListElements GREATER { let typeArgs, commas = $5 @@ -6747,7 +6775,7 @@ opt_equals: { let mEquals = rhs parseState 1 Some mEquals } | /* EMPTY */ { None } - + opt_OBLOCKSEP: | OBLOCKSEP { } | /* EMPTY */ { } diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index a4e8e281866..ffb9e6bcd76 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -352,6 +352,11 @@ řez od konce + + Permit Type Arguments in Attributes. + Permit Type Arguments in Attributes. + + implicit yield implicitní yield diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index f920991d5f4..cfc57e3fbec 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -352,6 +352,11 @@ Segmentierung ab Ende + + Permit Type Arguments in Attributes. + Permit Type Arguments in Attributes. + + implicit yield implizite yield-Anweisung diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index f6054605ffa..10a34b2f401 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -352,6 +352,11 @@ segmentación desde el final + + Permit Type Arguments in Attributes. + Permit Type Arguments in Attributes. + + implicit yield elemento yield implícito diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index 5e9349ac3ae..93200053918 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -352,6 +352,11 @@ découpage depuis la fin + + Permit Type Arguments in Attributes. + Permit Type Arguments in Attributes. + + implicit yield yield implicite diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index b936cdc3642..d79cbef56b2 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -352,6 +352,11 @@ sezionamento dalla fine + + Permit Type Arguments in Attributes. + Permit Type Arguments in Attributes. + + implicit yield istruzione yield implicita diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index add97ebcbee..5ca9373cbf3 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -352,6 +352,11 @@ 開始と終了を指定したスライス + + Permit Type Arguments in Attributes. + Permit Type Arguments in Attributes. + + implicit yield 暗黙的な yield diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index 005109642a3..f58e75b61d7 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -352,6 +352,11 @@ 끝에서부터 조각화 + + Permit Type Arguments in Attributes. + Permit Type Arguments in Attributes. + + implicit yield 암시적 yield diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index b11a525807f..4c7e1db2cce 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -352,6 +352,11 @@ wycinanie od końca + + Permit Type Arguments in Attributes. + Permit Type Arguments in Attributes. + + implicit yield niejawne słowo kluczowe yield diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index 78b23fc160d..4cf2e4cfe2b 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -352,6 +352,11 @@ divisão começando no final + + Permit Type Arguments in Attributes. + Permit Type Arguments in Attributes. + + implicit yield yield implícito diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index 670b03ce32a..5a415174e90 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -352,6 +352,11 @@ срезы от конца + + Permit Type Arguments in Attributes. + Permit Type Arguments in Attributes. + + implicit yield неявное использование yield diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index e0552438c26..d2e51415a67 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -352,6 +352,11 @@ uçtan dilimleme + + Permit Type Arguments in Attributes. + Permit Type Arguments in Attributes. + + implicit yield örtük yield diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index f53a45b0200..93cc4713fb7 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -352,6 +352,11 @@ 从端切片 + + Permit Type Arguments in Attributes. + Permit Type Arguments in Attributes. + + implicit yield 隐式 yield diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index a80e8852c30..9121f4a14f6 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -352,6 +352,11 @@ 從尾端切割 + + Permit Type Arguments in Attributes. + Permit Type Arguments in Attributes. + + implicit yield 隱含 yield diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/AliasedGenericAttribute.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/AliasedGenericAttribute.fs new file mode 100644 index 00000000000..db64717a229 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/AliasedGenericAttribute.fs @@ -0,0 +1,10 @@ +module M +open System + +type MyAttribute<^T>() = + inherit Attribute() + +type AliasedAttribute = MyAttribute + +[] +let x = 1 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/AliasedGenericAttribute.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/AliasedGenericAttribute.fs.RealInternalSignatureOff.il.bsl new file mode 100644 index 00000000000..a27ecb99d45 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/AliasedGenericAttribute.fs.RealInternalSignatureOff.il.bsl @@ -0,0 +1,103 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed M + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable nested public beforefieldinit MyAttribute`1 + extends [runtime]System.Attribute + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .method public specialname rtspecialname instance void .ctor() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ret + } + + } + + .method public specialname static int32 get_x() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldc.i4.1 + IL_0001: ret + } + + .property int32 x() + { + .custom instance void class M/MyAttribute`1::.ctor() = ( 01 00 00 00 ) + .get int32 M::get_x() + } +} + +.class private abstract auto ansi sealed ''.$M + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 3 + .locals init (int32 V_0) + IL_0000: call int32 M::get_x() + IL_0005: stloc.0 + IL_0006: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/AliasedGenericAttribute.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/AliasedGenericAttribute.fs.RealInternalSignatureOn.il.bsl new file mode 100644 index 00000000000..4e6f8da6208 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/AliasedGenericAttribute.fs.RealInternalSignatureOn.il.bsl @@ -0,0 +1,89 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed M + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable nested public beforefieldinit MyAttribute`1 + extends [runtime]System.Attribute + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .method public specialname rtspecialname instance void .ctor() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ret + } + + } + + .method public specialname static int32 get_x() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldc.i4.1 + IL_0001: ret + } + + .property int32 x() + { + .custom instance void class M/MyAttribute`1::.ctor() = ( 01 00 00 00 ) + .get int32 M::get_x() + } +} + +.class private abstract auto ansi sealed ''.$M + extends [runtime]System.Object +{ +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/Attribute.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/Attribute.fs new file mode 100644 index 00000000000..a0410c8a838 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/Attribute.fs @@ -0,0 +1,109 @@ +namespace EmittedIL.RealInternalSignature + +open Xunit +open FSharp.Test +open FSharp.Test.Compiler + +module Attribute = + + let verifyCompilation compilation = + compilation + |> asFs + |> withOptions [ "--test:EmitFeeFeeAs100001" ] + |> withNoOptimize + |> withEmbeddedPdb + |> withEmbedAllSource + |> ignoreWarnings + |> verifyBaseline + |> verifyILBaseline + + //AttributeWithTypeParam + [] + let ``AttributeWithTypeParam_RealInternalSignatureOn_fs`` compilation = + compilation + |> withRealInternalSignatureOn + |> verifyCompilation + + [] + let ``AttributeWithTypeParam_RealInternalSignatureOff_fs`` compilation = + compilation + |> withRealInternalSignatureOff + |> verifyCompilation + + //RecordTypeAttributesWithTypeParam + [] + let ``RecordTypeAttributesWithTypeParam_RealInternalSignatureOn_fs`` compilation = + compilation + |> withRealInternalSignatureOn + |> verifyCompilation + + [] + let ``RecordTypeAttributesWithTypeParam_RealInternalSignatureOff_fs`` compilation = + compilation + |> withRealInternalSignatureOff + |> verifyCompilation + + //AttributeWithAliasedGenerics + [] + let ``AttributeWithAliasedGenerics_RealInternalSignatureOn_fs`` compilation = + compilation + |> withRealInternalSignatureOn + |> verifyCompilation + + [] + let ``AttributeWithAliasedGenerics_RealInternalSignatureOff_fs`` compilation = + compilation + |> withRealInternalSignatureOff + |> verifyCompilation + + //AttributeInRecursiveModule + [] + let ``AttributeInRecursiveModule_RealInternalSignatureOn_fs`` compilation = + compilation + |> withRealInternalSignatureOn + |> verifyCompilation + + [] + let ``AttributeInRecursiveModule_RealInternalSignatureOff_fs`` compilation = + compilation + |> withRealInternalSignatureOff + |> verifyCompilation + + //AttributeRecursionViaAnd + [] + let ``AttributeRecursionViaAnd_RealInternalSignatureOn_fs`` compilation = + compilation + |> withRealInternalSignatureOn + |> verifyCompilation + + [] + let ``AttributeRecursionViaAnd_RealInternalSignatureOff_fs`` compilation = + compilation + |> withRealInternalSignatureOff + |> verifyCompilation + + //AliasedGenericAttribute + [] + let ``AliasedGenericAttribute_RealInternalSignatureOn_fs`` compilation = + compilation + |> withRealInternalSignatureOn + |> verifyCompilation + + [] + let ``AliasedGenericAttribute_RealInternalSignatureOff_fs`` compilation = + compilation + |> withRealInternalSignatureOff + |> verifyCompilation + + //SelfReferenceGenericAttributeUsage + [] + let ``SelfReferenceGenericAttributeUsage_RealInternalSignatureOn_fs`` compilation = + compilation + |> withRealInternalSignatureOn + |> verifyCompilation + + [] + let ``SelfReferenceGenericAttributeUsage_RealInternalSignatureOff_fs`` compilation = + compilation + |> withRealInternalSignatureOff + |> verifyCompilation \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/AttributeWithTypeParam.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/AttributeWithTypeParam.fs new file mode 100644 index 00000000000..fbbd6195694 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/AttributeWithTypeParam.fs @@ -0,0 +1,8 @@ +module M +open System + +type MyAttribute<^T>() = + inherit Attribute() + +[>] +let x = 1 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/AttributeWithTypeParam.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/AttributeWithTypeParam.fs.RealInternalSignatureOff.il.bsl new file mode 100644 index 00000000000..a27ecb99d45 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/AttributeWithTypeParam.fs.RealInternalSignatureOff.il.bsl @@ -0,0 +1,103 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed M + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable nested public beforefieldinit MyAttribute`1 + extends [runtime]System.Attribute + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .method public specialname rtspecialname instance void .ctor() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ret + } + + } + + .method public specialname static int32 get_x() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldc.i4.1 + IL_0001: ret + } + + .property int32 x() + { + .custom instance void class M/MyAttribute`1::.ctor() = ( 01 00 00 00 ) + .get int32 M::get_x() + } +} + +.class private abstract auto ansi sealed ''.$M + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 3 + .locals init (int32 V_0) + IL_0000: call int32 M::get_x() + IL_0005: stloc.0 + IL_0006: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/AttributeWithTypeParam.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/AttributeWithTypeParam.fs.RealInternalSignatureOn.il.bsl new file mode 100644 index 00000000000..4e6f8da6208 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/AttributeWithTypeParam.fs.RealInternalSignatureOn.il.bsl @@ -0,0 +1,89 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed M + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable nested public beforefieldinit MyAttribute`1 + extends [runtime]System.Attribute + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .method public specialname rtspecialname instance void .ctor() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ret + } + + } + + .method public specialname static int32 get_x() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldc.i4.1 + IL_0001: ret + } + + .property int32 x() + { + .custom instance void class M/MyAttribute`1::.ctor() = ( 01 00 00 00 ) + .get int32 M::get_x() + } +} + +.class private abstract auto ansi sealed ''.$M + extends [runtime]System.Object +{ +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/RecordTypeAttributesWithTypeParam.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/RecordTypeAttributesWithTypeParam.fs new file mode 100644 index 00000000000..43cd029185e --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/RecordTypeAttributesWithTypeParam.fs @@ -0,0 +1,15 @@ +module M +open System + +type RecordLevelAttribute<^T>()= + inherit Attribute() + +type FieldLevelAttribute<^T>()= + inherit Attribute() + +[>] +type Test = + { + [>] + someField : string + } \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/RecordTypeAttributesWithTypeParam.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/RecordTypeAttributesWithTypeParam.fs.RealInternalSignatureOff.il.bsl new file mode 100644 index 00000000000..7ff5fb8f142 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/RecordTypeAttributesWithTypeParam.fs.RealInternalSignatureOff.il.bsl @@ -0,0 +1,456 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern netstandard +{ + .publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) + .ver 2:1:0:0 +} +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed M + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable nested public beforefieldinit RecordLevelAttribute`1 + extends [runtime]System.Attribute + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .method public specialname rtspecialname instance void .ctor() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ret + } + + } + + .class auto ansi serializable nested public beforefieldinit FieldLevelAttribute`1 + extends [runtime]System.Attribute + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .method public specialname rtspecialname instance void .ctor() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ret + } + + } + + .class auto ansi serializable sealed nested public Test + extends [runtime]System.Object + implements class [runtime]System.IEquatable`1, + [runtime]System.Collections.IStructuralEquatable, + class [runtime]System.IComparable`1, + [runtime]System.IComparable, + [runtime]System.Collections.IStructuralComparable + { + .custom instance void class M/RecordLevelAttribute`1::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 02 00 00 00 00 00 ) + .field assembly string someField@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method public hidebysig specialname instance string get_someField() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld string M/Test::someField@ + IL_0006: ret + } + + .method public specialname rtspecialname instance void .ctor(string someField) cil managed + { + .custom instance void [runtime]System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype [runtime]System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 06 4D 2B 54 65 73 74 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld string M/Test::someField@ + IL_000d: ret + } + + .method public strict virtual instance string ToString() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldstr "%+A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,class M/Test>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0015: ret + } + + .method public hidebysig virtual final instance int32 CompareTo(class M/Test obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 4 + .locals init (class [runtime]System.Collections.IComparer V_0, + string V_1, + string V_2, + class [runtime]System.Collections.IComparer V_3) + IL_0000: ldarg.0 + IL_0001: brfalse.s IL_0026 + + IL_0003: ldarg.1 + IL_0004: brfalse.s IL_0024 + + IL_0006: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_000b: stloc.0 + IL_000c: ldarg.0 + IL_000d: ldfld string M/Test::someField@ + IL_0012: stloc.1 + IL_0013: ldarg.1 + IL_0014: ldfld string M/Test::someField@ + IL_0019: stloc.2 + IL_001a: ldloc.0 + IL_001b: stloc.3 + IL_001c: ldloc.1 + IL_001d: ldloc.2 + IL_001e: call int32 [netstandard]System.String::CompareOrdinal(string, + string) + IL_0023: ret + + IL_0024: ldc.i4.1 + IL_0025: ret + + IL_0026: ldarg.1 + IL_0027: brfalse.s IL_002b + + IL_0029: ldc.i4.m1 + IL_002a: ret + + IL_002b: ldc.i4.0 + IL_002c: ret + } + + .method public hidebysig virtual final instance int32 CompareTo(object obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: unbox.any M/Test + IL_0007: callvirt instance int32 M/Test::CompareTo(class M/Test) + IL_000c: ret + } + + .method public hidebysig virtual final + instance int32 CompareTo(object obj, + class [runtime]System.Collections.IComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 4 + .locals init (class M/Test V_0, + class M/Test V_1, + class [runtime]System.Collections.IComparer V_2, + string V_3, + string V_4, + class [runtime]System.Collections.IComparer V_5) + IL_0000: ldarg.1 + IL_0001: unbox.any M/Test + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: stloc.1 + IL_0009: ldarg.0 + IL_000a: brfalse.s IL_0033 + + IL_000c: ldarg.1 + IL_000d: unbox.any M/Test + IL_0012: brfalse.s IL_0031 + + IL_0014: ldarg.2 + IL_0015: stloc.2 + IL_0016: ldarg.0 + IL_0017: ldfld string M/Test::someField@ + IL_001c: stloc.3 + IL_001d: ldloc.1 + IL_001e: ldfld string M/Test::someField@ + IL_0023: stloc.s V_4 + IL_0025: ldloc.2 + IL_0026: stloc.s V_5 + IL_0028: ldloc.3 + IL_0029: ldloc.s V_4 + IL_002b: call int32 [netstandard]System.String::CompareOrdinal(string, + string) + IL_0030: ret + + IL_0031: ldc.i4.1 + IL_0032: ret + + IL_0033: ldarg.1 + IL_0034: unbox.any M/Test + IL_0039: brfalse.s IL_003d + + IL_003b: ldc.i4.m1 + IL_003c: ret + + IL_003d: ldc.i4.0 + IL_003e: ret + } + + .method public hidebysig virtual final instance int32 GetHashCode(class [runtime]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 7 + .locals init (int32 V_0, + class [runtime]System.Collections.IEqualityComparer V_1, + string V_2, + class [runtime]System.Collections.IEqualityComparer V_3, + string V_4, + string V_5) + IL_0000: ldarg.0 + IL_0001: brfalse.s IL_0038 + + IL_0003: ldc.i4.0 + IL_0004: stloc.0 + IL_0005: ldc.i4 0x9e3779b9 + IL_000a: ldarg.1 + IL_000b: stloc.1 + IL_000c: ldarg.0 + IL_000d: ldfld string M/Test::someField@ + IL_0012: stloc.2 + IL_0013: ldloc.1 + IL_0014: stloc.3 + IL_0015: ldloc.2 + IL_0016: stloc.s V_4 + IL_0018: ldloc.s V_4 + IL_001a: stloc.s V_5 + IL_001c: ldloc.s V_5 + IL_001e: brtrue.s IL_0024 + + IL_0020: ldc.i4.0 + IL_0021: nop + IL_0022: br.s IL_002c + + IL_0024: ldloc.s V_5 + IL_0026: callvirt instance int32 [netstandard]System.Object::GetHashCode() + IL_002b: nop + IL_002c: ldloc.0 + IL_002d: ldc.i4.6 + IL_002e: shl + IL_002f: ldloc.0 + IL_0030: ldc.i4.2 + IL_0031: shr + IL_0032: add + IL_0033: add + IL_0034: add + IL_0035: stloc.0 + IL_0036: ldloc.0 + IL_0037: ret + + IL_0038: ldc.i4.0 + IL_0039: ret + } + + .method public hidebysig virtual final instance int32 GetHashCode() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call class [runtime]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() + IL_0006: callvirt instance int32 M/Test::GetHashCode(class [runtime]System.Collections.IEqualityComparer) + IL_000b: ret + } + + .method public hidebysig instance bool + Equals(class M/Test obj, + class [runtime]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 4 + .locals init (class M/Test V_0, + class [runtime]System.Collections.IEqualityComparer V_1, + string V_2, + string V_3, + class [runtime]System.Collections.IEqualityComparer V_4) + IL_0000: ldarg.0 + IL_0001: brfalse.s IL_0025 + + IL_0003: ldarg.1 + IL_0004: brfalse.s IL_0023 + + IL_0006: ldarg.1 + IL_0007: stloc.0 + IL_0008: ldarg.2 + IL_0009: stloc.1 + IL_000a: ldarg.0 + IL_000b: ldfld string M/Test::someField@ + IL_0010: stloc.2 + IL_0011: ldloc.0 + IL_0012: ldfld string M/Test::someField@ + IL_0017: stloc.3 + IL_0018: ldloc.1 + IL_0019: stloc.s V_4 + IL_001b: ldloc.2 + IL_001c: ldloc.3 + IL_001d: call bool [netstandard]System.String::Equals(string, + string) + IL_0022: ret + + IL_0023: ldc.i4.0 + IL_0024: ret + + IL_0025: ldarg.1 + IL_0026: ldnull + IL_0027: cgt.un + IL_0029: ldc.i4.0 + IL_002a: ceq + IL_002c: ret + } + + .method public hidebysig virtual final + instance bool Equals(object obj, + class [runtime]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 5 + .locals init (class M/Test V_0) + IL_0000: ldarg.1 + IL_0001: isinst M/Test + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: brfalse.s IL_0013 + + IL_000a: ldarg.0 + IL_000b: ldloc.0 + IL_000c: ldarg.2 + IL_000d: callvirt instance bool M/Test::Equals(class M/Test, + class [runtime]System.Collections.IEqualityComparer) + IL_0012: ret + + IL_0013: ldc.i4.0 + IL_0014: ret + } + + .method public hidebysig virtual final instance bool Equals(class M/Test obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: brfalse.s IL_001a + + IL_0003: ldarg.1 + IL_0004: brfalse.s IL_0018 + + IL_0006: ldarg.0 + IL_0007: ldfld string M/Test::someField@ + IL_000c: ldarg.1 + IL_000d: ldfld string M/Test::someField@ + IL_0012: call bool [netstandard]System.String::Equals(string, + string) + IL_0017: ret + + IL_0018: ldc.i4.0 + IL_0019: ret + + IL_001a: ldarg.1 + IL_001b: ldnull + IL_001c: cgt.un + IL_001e: ldc.i4.0 + IL_001f: ceq + IL_0021: ret + } + + .method public hidebysig virtual final instance bool Equals(object obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 4 + .locals init (class M/Test V_0) + IL_0000: ldarg.1 + IL_0001: isinst M/Test + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: brfalse.s IL_0012 + + IL_000a: ldarg.0 + IL_000b: ldloc.0 + IL_000c: callvirt instance bool M/Test::Equals(class M/Test) + IL_0011: ret + + IL_0012: ldc.i4.0 + IL_0013: ret + } + + .property instance string someField() + { + .custom instance void class M/FieldLevelAttribute`1::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 ) + .get instance string M/Test::get_someField() + } + } + +} + +.class private abstract auto ansi sealed ''.$M + extends [runtime]System.Object +{ +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/RecordTypeAttributesWithTypeParam.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/RecordTypeAttributesWithTypeParam.fs.RealInternalSignatureOn.il.bsl new file mode 100644 index 00000000000..7ff5fb8f142 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/RecordTypeAttributesWithTypeParam.fs.RealInternalSignatureOn.il.bsl @@ -0,0 +1,456 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern netstandard +{ + .publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) + .ver 2:1:0:0 +} +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed M + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable nested public beforefieldinit RecordLevelAttribute`1 + extends [runtime]System.Attribute + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .method public specialname rtspecialname instance void .ctor() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ret + } + + } + + .class auto ansi serializable nested public beforefieldinit FieldLevelAttribute`1 + extends [runtime]System.Attribute + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .method public specialname rtspecialname instance void .ctor() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ret + } + + } + + .class auto ansi serializable sealed nested public Test + extends [runtime]System.Object + implements class [runtime]System.IEquatable`1, + [runtime]System.Collections.IStructuralEquatable, + class [runtime]System.IComparable`1, + [runtime]System.IComparable, + [runtime]System.Collections.IStructuralComparable + { + .custom instance void class M/RecordLevelAttribute`1::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 02 00 00 00 00 00 ) + .field assembly string someField@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method public hidebysig specialname instance string get_someField() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld string M/Test::someField@ + IL_0006: ret + } + + .method public specialname rtspecialname instance void .ctor(string someField) cil managed + { + .custom instance void [runtime]System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype [runtime]System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 06 4D 2B 54 65 73 74 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld string M/Test::someField@ + IL_000d: ret + } + + .method public strict virtual instance string ToString() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldstr "%+A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,class M/Test>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0015: ret + } + + .method public hidebysig virtual final instance int32 CompareTo(class M/Test obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 4 + .locals init (class [runtime]System.Collections.IComparer V_0, + string V_1, + string V_2, + class [runtime]System.Collections.IComparer V_3) + IL_0000: ldarg.0 + IL_0001: brfalse.s IL_0026 + + IL_0003: ldarg.1 + IL_0004: brfalse.s IL_0024 + + IL_0006: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_000b: stloc.0 + IL_000c: ldarg.0 + IL_000d: ldfld string M/Test::someField@ + IL_0012: stloc.1 + IL_0013: ldarg.1 + IL_0014: ldfld string M/Test::someField@ + IL_0019: stloc.2 + IL_001a: ldloc.0 + IL_001b: stloc.3 + IL_001c: ldloc.1 + IL_001d: ldloc.2 + IL_001e: call int32 [netstandard]System.String::CompareOrdinal(string, + string) + IL_0023: ret + + IL_0024: ldc.i4.1 + IL_0025: ret + + IL_0026: ldarg.1 + IL_0027: brfalse.s IL_002b + + IL_0029: ldc.i4.m1 + IL_002a: ret + + IL_002b: ldc.i4.0 + IL_002c: ret + } + + .method public hidebysig virtual final instance int32 CompareTo(object obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: unbox.any M/Test + IL_0007: callvirt instance int32 M/Test::CompareTo(class M/Test) + IL_000c: ret + } + + .method public hidebysig virtual final + instance int32 CompareTo(object obj, + class [runtime]System.Collections.IComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 4 + .locals init (class M/Test V_0, + class M/Test V_1, + class [runtime]System.Collections.IComparer V_2, + string V_3, + string V_4, + class [runtime]System.Collections.IComparer V_5) + IL_0000: ldarg.1 + IL_0001: unbox.any M/Test + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: stloc.1 + IL_0009: ldarg.0 + IL_000a: brfalse.s IL_0033 + + IL_000c: ldarg.1 + IL_000d: unbox.any M/Test + IL_0012: brfalse.s IL_0031 + + IL_0014: ldarg.2 + IL_0015: stloc.2 + IL_0016: ldarg.0 + IL_0017: ldfld string M/Test::someField@ + IL_001c: stloc.3 + IL_001d: ldloc.1 + IL_001e: ldfld string M/Test::someField@ + IL_0023: stloc.s V_4 + IL_0025: ldloc.2 + IL_0026: stloc.s V_5 + IL_0028: ldloc.3 + IL_0029: ldloc.s V_4 + IL_002b: call int32 [netstandard]System.String::CompareOrdinal(string, + string) + IL_0030: ret + + IL_0031: ldc.i4.1 + IL_0032: ret + + IL_0033: ldarg.1 + IL_0034: unbox.any M/Test + IL_0039: brfalse.s IL_003d + + IL_003b: ldc.i4.m1 + IL_003c: ret + + IL_003d: ldc.i4.0 + IL_003e: ret + } + + .method public hidebysig virtual final instance int32 GetHashCode(class [runtime]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 7 + .locals init (int32 V_0, + class [runtime]System.Collections.IEqualityComparer V_1, + string V_2, + class [runtime]System.Collections.IEqualityComparer V_3, + string V_4, + string V_5) + IL_0000: ldarg.0 + IL_0001: brfalse.s IL_0038 + + IL_0003: ldc.i4.0 + IL_0004: stloc.0 + IL_0005: ldc.i4 0x9e3779b9 + IL_000a: ldarg.1 + IL_000b: stloc.1 + IL_000c: ldarg.0 + IL_000d: ldfld string M/Test::someField@ + IL_0012: stloc.2 + IL_0013: ldloc.1 + IL_0014: stloc.3 + IL_0015: ldloc.2 + IL_0016: stloc.s V_4 + IL_0018: ldloc.s V_4 + IL_001a: stloc.s V_5 + IL_001c: ldloc.s V_5 + IL_001e: brtrue.s IL_0024 + + IL_0020: ldc.i4.0 + IL_0021: nop + IL_0022: br.s IL_002c + + IL_0024: ldloc.s V_5 + IL_0026: callvirt instance int32 [netstandard]System.Object::GetHashCode() + IL_002b: nop + IL_002c: ldloc.0 + IL_002d: ldc.i4.6 + IL_002e: shl + IL_002f: ldloc.0 + IL_0030: ldc.i4.2 + IL_0031: shr + IL_0032: add + IL_0033: add + IL_0034: add + IL_0035: stloc.0 + IL_0036: ldloc.0 + IL_0037: ret + + IL_0038: ldc.i4.0 + IL_0039: ret + } + + .method public hidebysig virtual final instance int32 GetHashCode() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call class [runtime]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() + IL_0006: callvirt instance int32 M/Test::GetHashCode(class [runtime]System.Collections.IEqualityComparer) + IL_000b: ret + } + + .method public hidebysig instance bool + Equals(class M/Test obj, + class [runtime]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 4 + .locals init (class M/Test V_0, + class [runtime]System.Collections.IEqualityComparer V_1, + string V_2, + string V_3, + class [runtime]System.Collections.IEqualityComparer V_4) + IL_0000: ldarg.0 + IL_0001: brfalse.s IL_0025 + + IL_0003: ldarg.1 + IL_0004: brfalse.s IL_0023 + + IL_0006: ldarg.1 + IL_0007: stloc.0 + IL_0008: ldarg.2 + IL_0009: stloc.1 + IL_000a: ldarg.0 + IL_000b: ldfld string M/Test::someField@ + IL_0010: stloc.2 + IL_0011: ldloc.0 + IL_0012: ldfld string M/Test::someField@ + IL_0017: stloc.3 + IL_0018: ldloc.1 + IL_0019: stloc.s V_4 + IL_001b: ldloc.2 + IL_001c: ldloc.3 + IL_001d: call bool [netstandard]System.String::Equals(string, + string) + IL_0022: ret + + IL_0023: ldc.i4.0 + IL_0024: ret + + IL_0025: ldarg.1 + IL_0026: ldnull + IL_0027: cgt.un + IL_0029: ldc.i4.0 + IL_002a: ceq + IL_002c: ret + } + + .method public hidebysig virtual final + instance bool Equals(object obj, + class [runtime]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 5 + .locals init (class M/Test V_0) + IL_0000: ldarg.1 + IL_0001: isinst M/Test + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: brfalse.s IL_0013 + + IL_000a: ldarg.0 + IL_000b: ldloc.0 + IL_000c: ldarg.2 + IL_000d: callvirt instance bool M/Test::Equals(class M/Test, + class [runtime]System.Collections.IEqualityComparer) + IL_0012: ret + + IL_0013: ldc.i4.0 + IL_0014: ret + } + + .method public hidebysig virtual final instance bool Equals(class M/Test obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: brfalse.s IL_001a + + IL_0003: ldarg.1 + IL_0004: brfalse.s IL_0018 + + IL_0006: ldarg.0 + IL_0007: ldfld string M/Test::someField@ + IL_000c: ldarg.1 + IL_000d: ldfld string M/Test::someField@ + IL_0012: call bool [netstandard]System.String::Equals(string, + string) + IL_0017: ret + + IL_0018: ldc.i4.0 + IL_0019: ret + + IL_001a: ldarg.1 + IL_001b: ldnull + IL_001c: cgt.un + IL_001e: ldc.i4.0 + IL_001f: ceq + IL_0021: ret + } + + .method public hidebysig virtual final instance bool Equals(object obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 4 + .locals init (class M/Test V_0) + IL_0000: ldarg.1 + IL_0001: isinst M/Test + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: brfalse.s IL_0012 + + IL_000a: ldarg.0 + IL_000b: ldloc.0 + IL_000c: callvirt instance bool M/Test::Equals(class M/Test) + IL_0011: ret + + IL_0012: ldc.i4.0 + IL_0013: ret + } + + .property instance string someField() + { + .custom instance void class M/FieldLevelAttribute`1::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 ) + .get instance string M/Test::get_someField() + } + } + +} + +.class private abstract auto ansi sealed ''.$M + extends [runtime]System.Object +{ +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/SelfReferenceGenericAttributeUsage.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/SelfReferenceGenericAttributeUsage.fs new file mode 100644 index 00000000000..5dcb098f648 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/SelfReferenceGenericAttributeUsage.fs @@ -0,0 +1,8 @@ +module M +open System + +type MyAttribute<^T>() = + inherit Attribute() + +[>>>>>] +type AClass<'a>(arg) = class end \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/SelfReferenceGenericAttributeUsage.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/SelfReferenceGenericAttributeUsage.fs.RealInternalSignatureOff.il.bsl new file mode 100644 index 00000000000..8ab4711ae87 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/SelfReferenceGenericAttributeUsage.fs.RealInternalSignatureOff.il.bsl @@ -0,0 +1,92 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed M + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable nested public beforefieldinit MyAttribute`1 + extends [runtime]System.Attribute + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .method public specialname rtspecialname instance void .ctor() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ret + } + + } + + .class auto ansi serializable nested public beforefieldinit AClass`1 + extends [runtime]System.Object + { + .custom instance void class M/MyAttribute`1>>>>::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(object arg) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ret + } + + } + +} + +.class private abstract auto ansi sealed ''.$M + extends [runtime]System.Object +{ +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/SelfReferenceGenericAttributeUsage.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/SelfReferenceGenericAttributeUsage.fs.RealInternalSignatureOn.il.bsl new file mode 100644 index 00000000000..8ab4711ae87 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/SelfReferenceGenericAttributeUsage.fs.RealInternalSignatureOn.il.bsl @@ -0,0 +1,92 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed M + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable nested public beforefieldinit MyAttribute`1 + extends [runtime]System.Attribute + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .method public specialname rtspecialname instance void .ctor() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ret + } + + } + + .class auto ansi serializable nested public beforefieldinit AClass`1 + extends [runtime]System.Object + { + .custom instance void class M/MyAttribute`1>>>>::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(object arg) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ret + } + + } + +} + +.class private abstract auto ansi sealed ''.$M + extends [runtime]System.Object +{ +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompilerGeneratedAttributeOnAccessors.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompilerGeneratedAttributeOnAccessors.fs index 2d2f4fdede3..d1556c9aa4c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompilerGeneratedAttributeOnAccessors.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompilerGeneratedAttributeOnAccessors.fs @@ -183,7 +183,7 @@ module ``Auto-generated accessors have CompilerGenerated attribute`` = |> should haveAttribute "DebuggerNonUserCodeAttribute" // Regression: https://github.com/dotnet/fsharp/issues/14652 -module ``Let bindings in classes shoulnd't have DebuggerNonUserCodeAttribute`` = +module ``Let bindings in classes shouldn't have DebuggerNonUserCodeAttribute`` = let withRealInternalSignature realSig compilation = compilation diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index 4f52ba14ae0..de6913b432c 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -151,6 +151,7 @@ + @@ -319,9 +320,9 @@ - - %(RelativeDir)TestSource\%(Filename)%(Extension) - + + %(RelativeDir)TestSource\%(Filename)%(Extension) + %(RelativeDir)\BaseLine\%(Filename)%(Extension) diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl index 909e42e2cdc..242f1dd1b02 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl @@ -4865,6 +4865,8 @@ FSharp.Compiler.Symbols.FSharpAttribute: FSharp.Compiler.Symbols.FSharpEntity At FSharp.Compiler.Symbols.FSharpAttribute: FSharp.Compiler.Symbols.FSharpEntity get_AttributeType() FSharp.Compiler.Symbols.FSharpAttribute: FSharp.Compiler.Text.Range Range FSharp.Compiler.Symbols.FSharpAttribute: FSharp.Compiler.Text.Range get_Range() +FSharp.Compiler.Symbols.FSharpAttribute: System.Collections.Generic.IList`1[FSharp.Compiler.Symbols.FSharpType] TypeArgs +FSharp.Compiler.Symbols.FSharpAttribute: System.Collections.Generic.IList`1[FSharp.Compiler.Symbols.FSharpType] get_TypeArgs() FSharp.Compiler.Symbols.FSharpAttribute: System.Collections.Generic.IList`1[System.Tuple`2[FSharp.Compiler.Symbols.FSharpType,System.Object]] ConstructorArguments FSharp.Compiler.Symbols.FSharpAttribute: System.Collections.Generic.IList`1[System.Tuple`2[FSharp.Compiler.Symbols.FSharpType,System.Object]] get_ConstructorArguments() FSharp.Compiler.Symbols.FSharpAttribute: System.Collections.Generic.IList`1[System.Tuple`4[FSharp.Compiler.Symbols.FSharpType,System.String,System.Boolean,System.Object]] NamedArguments @@ -6283,10 +6285,12 @@ FSharp.Compiler.Syntax.SynAttribute: FSharp.Compiler.Syntax.SynLongIdent TypeNam FSharp.Compiler.Syntax.SynAttribute: FSharp.Compiler.Syntax.SynLongIdent get_TypeName() FSharp.Compiler.Syntax.SynAttribute: FSharp.Compiler.Text.Range Range FSharp.Compiler.Syntax.SynAttribute: FSharp.Compiler.Text.Range get_Range() +FSharp.Compiler.Syntax.SynAttribute: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType] TypeArgs +FSharp.Compiler.Syntax.SynAttribute: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType] get_TypeArgs() FSharp.Compiler.Syntax.SynAttribute: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident] Target FSharp.Compiler.Syntax.SynAttribute: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident] get_Target() FSharp.Compiler.Syntax.SynAttribute: System.String ToString() -FSharp.Compiler.Syntax.SynAttribute: Void .ctor(FSharp.Compiler.Syntax.SynLongIdent, FSharp.Compiler.Syntax.SynExpr, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident], Boolean, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynAttribute: Void .ctor(FSharp.Compiler.Syntax.SynLongIdent, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType], FSharp.Compiler.Syntax.SynExpr, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident], Boolean, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynAttributeList: FSharp.Compiler.Text.Range Range FSharp.Compiler.Syntax.SynAttributeList: FSharp.Compiler.Text.Range get_Range() FSharp.Compiler.Syntax.SynAttributeList: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttribute] Attributes diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl index 909e42e2cdc..242f1dd1b02 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl @@ -4865,6 +4865,8 @@ FSharp.Compiler.Symbols.FSharpAttribute: FSharp.Compiler.Symbols.FSharpEntity At FSharp.Compiler.Symbols.FSharpAttribute: FSharp.Compiler.Symbols.FSharpEntity get_AttributeType() FSharp.Compiler.Symbols.FSharpAttribute: FSharp.Compiler.Text.Range Range FSharp.Compiler.Symbols.FSharpAttribute: FSharp.Compiler.Text.Range get_Range() +FSharp.Compiler.Symbols.FSharpAttribute: System.Collections.Generic.IList`1[FSharp.Compiler.Symbols.FSharpType] TypeArgs +FSharp.Compiler.Symbols.FSharpAttribute: System.Collections.Generic.IList`1[FSharp.Compiler.Symbols.FSharpType] get_TypeArgs() FSharp.Compiler.Symbols.FSharpAttribute: System.Collections.Generic.IList`1[System.Tuple`2[FSharp.Compiler.Symbols.FSharpType,System.Object]] ConstructorArguments FSharp.Compiler.Symbols.FSharpAttribute: System.Collections.Generic.IList`1[System.Tuple`2[FSharp.Compiler.Symbols.FSharpType,System.Object]] get_ConstructorArguments() FSharp.Compiler.Symbols.FSharpAttribute: System.Collections.Generic.IList`1[System.Tuple`4[FSharp.Compiler.Symbols.FSharpType,System.String,System.Boolean,System.Object]] NamedArguments @@ -6283,10 +6285,12 @@ FSharp.Compiler.Syntax.SynAttribute: FSharp.Compiler.Syntax.SynLongIdent TypeNam FSharp.Compiler.Syntax.SynAttribute: FSharp.Compiler.Syntax.SynLongIdent get_TypeName() FSharp.Compiler.Syntax.SynAttribute: FSharp.Compiler.Text.Range Range FSharp.Compiler.Syntax.SynAttribute: FSharp.Compiler.Text.Range get_Range() +FSharp.Compiler.Syntax.SynAttribute: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType] TypeArgs +FSharp.Compiler.Syntax.SynAttribute: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType] get_TypeArgs() FSharp.Compiler.Syntax.SynAttribute: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident] Target FSharp.Compiler.Syntax.SynAttribute: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident] get_Target() FSharp.Compiler.Syntax.SynAttribute: System.String ToString() -FSharp.Compiler.Syntax.SynAttribute: Void .ctor(FSharp.Compiler.Syntax.SynLongIdent, FSharp.Compiler.Syntax.SynExpr, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident], Boolean, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynAttribute: Void .ctor(FSharp.Compiler.Syntax.SynLongIdent, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType], FSharp.Compiler.Syntax.SynExpr, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident], Boolean, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynAttributeList: FSharp.Compiler.Text.Range Range FSharp.Compiler.Syntax.SynAttributeList: FSharp.Compiler.Text.Range get_Range() FSharp.Compiler.Syntax.SynAttributeList: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttribute] Attributes diff --git a/tests/FSharp.Compiler.Service.Tests/Symbols.fs b/tests/FSharp.Compiler.Service.Tests/Symbols.fs index 2a46d5492f9..812dfb15e3a 100644 --- a/tests/FSharp.Compiler.Service.Tests/Symbols.fs +++ b/tests/FSharp.Compiler.Service.Tests/Symbols.fs @@ -258,6 +258,61 @@ let x = 123 |> Option.map (fun su -> su.Symbol :?> FSharpMemberOrFunctionOrValue) |> Option.iter (fun symbol -> symbol.Attributes.Count |> shouldEqual 1) + [] + let ``Digest attribute type parameters`` () = + let source = """ +open System +open System.Diagnostics + +type FooAttribute<^T>() = + inherit Attribute() + +[()>] +let x = 123 +""" + let fileName, options = mkTestFileAndOptions source [| "--noconditionalerasure" |] + let _, checkResults = parseAndCheckFile fileName source options + + checkResults.GetAllUsesOfAllSymbolsInFile() + |> Array.ofSeq + |> Array.tryFind (fun su -> su.Symbol.DisplayName = "x") + |> Option.orElseWith (fun _ -> failwith "Could not get symbol") + |> Option.map (fun su -> su.Symbol :?> FSharpMemberOrFunctionOrValue) + |> Option.iter (fun symbol -> + symbol.Attributes[0].TypeArgs[0].AbbreviatedType.TypeDefinition.CompiledName + |> should equal "Int32" + ) + [] + let ``Digest record attribute type parameters`` () = + let source = """ +open System +open System.Diagnostics + +type FooAttribute<^T>(input : string) = + inherit Attribute() +type BarAttribute<^T>(input : int) = + inherit Attribute() + +[("bar")>] +type FooBarRecord = + { + [(2)>] + id : string + } +""" + let fileName, options = mkTestFileAndOptions source [| "--noconditionalerasure" |] + let _, checkResults = parseAndCheckFile fileName source options + + checkResults.GetAllUsesOfAllSymbolsInFile() + |> Array.ofSeq + |> Array.tryFind (fun su -> su.Symbol.DisplayName = "FooBarRecord") + |> Option.orElseWith (fun _ -> failwith "Could not get symbol") + |> Option.map (fun su -> su.Symbol :?> FSharpEntity) + |> Option.iter (fun symbol -> + symbol.Attributes[0].TypeArgs[0].AbbreviatedType.TypeDefinition.CompiledName + |> should equal "Int32" + ) + module Types = [] let ``FSharpType.Print parent namespace qualifiers`` () = diff --git a/tests/FSharp.Test.Utilities/SurfaceArea.fs b/tests/FSharp.Test.Utilities/SurfaceArea.fs index 8dcd2b92970..62d4d84037d 100644 --- a/tests/FSharp.Test.Utilities/SurfaceArea.fs +++ b/tests/FSharp.Test.Utilities/SurfaceArea.fs @@ -78,7 +78,7 @@ module FSharp.Test.SurfaceArea let msg = $"""Assembly: %A{asm} Expected and actual surface area don't match. To see the delta, run: - windiff {baselinePath} {logFile} + git diff --no-index --word-diff {baselinePath} {logFile} {diff}""" diff --git a/tests/service/data/SyntaxTree/Attribute/ArglessAttribute.fs b/tests/service/data/SyntaxTree/Attribute/ArglessAttribute.fs new file mode 100644 index 00000000000..327466f5fe4 --- /dev/null +++ b/tests/service/data/SyntaxTree/Attribute/ArglessAttribute.fs @@ -0,0 +1,3 @@ + +[] +do () \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/Attribute/ArglessAttribute.fs.bsl b/tests/service/data/SyntaxTree/Attribute/ArglessAttribute.fs.bsl new file mode 100644 index 00000000000..b746dbe50ec --- /dev/null +++ b/tests/service/data/SyntaxTree/Attribute/ArglessAttribute.fs.bsl @@ -0,0 +1,19 @@ +ImplFile + (ParsedImplFileInput + ("/root/Attribute/ArglessAttribute.fs", false, + QualifiedNameOfFile ArglessAttribute, [], [], + [SynModuleOrNamespace + ([ArglessAttribute], false, AnonModule, + [Attributes + ([{ Attributes = + [{ TypeName = SynLongIdent ([MyAttribute], [], [None]) + TypeArgs = [] + ArgExpr = Const (Unit, (2,2--2,13)) + Target = None + AppliesToGetterAndSetter = false + Range = (2,2--2,13) }] + Range = (2,0--2,15) }], (2,0--2,15)); + Expr (Do (Const (Unit, (3,3--3,5)), (3,0--3,5)), (3,0--3,5))], + PreXmlDocEmpty, [], None, (2,0--3,5), { LeadingKeyword = None })], + (true, true), { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Attribute/AttributeWithTargetAndTypeArgs.fs b/tests/service/data/SyntaxTree/Attribute/AttributeWithTargetAndTypeArgs.fs new file mode 100644 index 00000000000..21411aaedb5 --- /dev/null +++ b/tests/service/data/SyntaxTree/Attribute/AttributeWithTargetAndTypeArgs.fs @@ -0,0 +1,3 @@ + +[>>] +do () \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/Attribute/AttributeWithTargetAndTypeArgs.fs.bsl b/tests/service/data/SyntaxTree/Attribute/AttributeWithTargetAndTypeArgs.fs.bsl new file mode 100644 index 00000000000..9db94038a47 --- /dev/null +++ b/tests/service/data/SyntaxTree/Attribute/AttributeWithTargetAndTypeArgs.fs.bsl @@ -0,0 +1,24 @@ +ImplFile + (ParsedImplFileInput + ("/root/Attribute/AttributeWithTargetAndTypeArgs.fs", false, + QualifiedNameOfFile AttributeWithTargetAndTypeArgs, [], [], + [SynModuleOrNamespace + ([AttributeWithTargetAndTypeArgs], false, AnonModule, + [Attributes + ([{ Attributes = + [{ TypeName = SynLongIdent ([MyAttribute], [], [None]) + TypeArgs = + [App + (LongIdent (SynLongIdent ([List], [], [None])), + Some (2,27--2,28), + [LongIdent (SynLongIdent ([int], [], [None]))], [], + Some (2,31--2,32), false, (2,23--2,32))] + ArgExpr = Const (Unit, (2,11--2,33)) + Target = Some assembly + AppliesToGetterAndSetter = false + Range = (2,2--2,33) }] + Range = (2,0--2,35) }], (2,0--2,35)); + Expr (Do (Const (Unit, (3,3--3,5)), (3,0--3,5)), (3,0--3,5))], + PreXmlDocEmpty, [], None, (2,0--3,5), { LeadingKeyword = None })], + (true, true), { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs.bsl b/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs.bsl index bde23ff1693..1fb65e4838c 100644 --- a/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs.bsl +++ b/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs.bsl @@ -7,6 +7,7 @@ ImplFile [Attributes ([{ Attributes = [{ TypeName = SynLongIdent ([MyAttribute], [], [None]) + TypeArgs = [] ArgExpr = Paren (App diff --git a/tests/service/data/SyntaxTree/Attribute/RangeOfAttributeWithPath.fs.bsl b/tests/service/data/SyntaxTree/Attribute/RangeOfAttributeWithPath.fs.bsl index b8c9c031836..abf2ce1db45 100644 --- a/tests/service/data/SyntaxTree/Attribute/RangeOfAttributeWithPath.fs.bsl +++ b/tests/service/data/SyntaxTree/Attribute/RangeOfAttributeWithPath.fs.bsl @@ -9,6 +9,7 @@ ImplFile [{ TypeName = SynLongIdent ([Prefix; MyAttribute], [(2,8--2,9)], [None; None]) + TypeArgs = [] ArgExpr = Paren (App diff --git a/tests/service/data/SyntaxTree/Attribute/RangeOfAttributeWithTarget.fs.bsl b/tests/service/data/SyntaxTree/Attribute/RangeOfAttributeWithTarget.fs.bsl index cdb1fdd30fe..1b0acec5108 100644 --- a/tests/service/data/SyntaxTree/Attribute/RangeOfAttributeWithTarget.fs.bsl +++ b/tests/service/data/SyntaxTree/Attribute/RangeOfAttributeWithTarget.fs.bsl @@ -7,6 +7,7 @@ ImplFile [Attributes ([{ Attributes = [{ TypeName = SynLongIdent ([MyAttribute], [], [None]) + TypeArgs = [] ArgExpr = Paren (App diff --git a/tests/service/data/SyntaxTree/Attribute/RecordAttributeWithTypeArg.fs b/tests/service/data/SyntaxTree/Attribute/RecordAttributeWithTypeArg.fs new file mode 100644 index 00000000000..2d1a83ec0c1 --- /dev/null +++ b/tests/service/data/SyntaxTree/Attribute/RecordAttributeWithTypeArg.fs @@ -0,0 +1,5 @@ +[>] +type Bar = + { + id : string + } \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/Attribute/RecordAttributeWithTypeArg.fs.bsl b/tests/service/data/SyntaxTree/Attribute/RecordAttributeWithTypeArg.fs.bsl new file mode 100644 index 00000000000..59cd3d93571 --- /dev/null +++ b/tests/service/data/SyntaxTree/Attribute/RecordAttributeWithTypeArg.fs.bsl @@ -0,0 +1,37 @@ +ImplFile + (ParsedImplFileInput + ("/root/Attribute/RecordAttributeWithTypeArg.fs", false, + QualifiedNameOfFile RecordAttributeWithTypeArg, [], [], + [SynModuleOrNamespace + ([RecordAttributeWithTypeArg], false, AnonModule, + [Types + ([SynTypeDefn + (SynComponentInfo + ([{ Attributes = + [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = + [LongIdent (SynLongIdent ([int], [], [None]))] + ArgExpr = Const (Unit, (1,2--1,10)) + Target = None + AppliesToGetterAndSetter = false + Range = (1,2--1,10) }] + Range = (1,0--1,12) }], None, [], [Bar], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (2,5--2,8)), + Simple + (Record + (None, + [SynField + ([], false, Some id, + LongIdent (SynLongIdent ([string], [], [None])), + false, + PreXmlDoc ((4,8), FSharp.Compiler.Xml.XmlDocCollector), + None, (4,8--4,19), { LeadingKeyword = None + MutableKeyword = None })], + (3,4--5,5)), (3,4--5,5)), [], None, (1,0--5,5), + { LeadingKeyword = Type (2,0--2,4) + EqualsRange = Some (2,9--2,10) + WithKeyword = None })], (1,0--5,5))], PreXmlDocEmpty, [], + None, (1,0--5,5), { LeadingKeyword = None })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeBetweenLetKeywordAndPatternShouldBeIncludedInSynModuleDeclLet.fs.bsl b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeBetweenLetKeywordAndPatternShouldBeIncludedInSynModuleDeclLet.fs.bsl index 63b8a81ea59..131d3ea98a7 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeBetweenLetKeywordAndPatternShouldBeIncludedInSynModuleDeclLet.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeBetweenLetKeywordAndPatternShouldBeIncludedInSynModuleDeclLet.fs.bsl @@ -14,6 +14,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([Literal], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (2,6--2,13)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInBindingOfSynExprObjExpr.fs.bsl b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInBindingOfSynExprObjExpr.fs.bsl index db5fe5051fe..486fbfdf511 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInBindingOfSynExprObjExpr.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInBindingOfSynExprObjExpr.fs.bsl @@ -18,6 +18,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (3,6--3,9)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInConstructorSynMemberDefnMember.fs.bsl b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInConstructorSynMemberDefnMember.fs.bsl index d52e2f085ba..f75a8acd12e 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInConstructorSynMemberDefnMember.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInConstructorSynMemberDefnMember.fs.bsl @@ -20,6 +20,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (3,6--3,9)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInConstructorSynMemberDefnMemberOptAsSpec.fs.bsl b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInConstructorSynMemberDefnMemberOptAsSpec.fs.bsl index 4717531eb39..da1116a9d0d 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInConstructorSynMemberDefnMemberOptAsSpec.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInConstructorSynMemberDefnMemberOptAsSpec.fs.bsl @@ -21,6 +21,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (3,6--3,9)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInFullSynMemberDefnMemberProperty.fs.bsl b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInFullSynMemberDefnMemberProperty.fs.bsl index fe111972f91..23e67128b25 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInFullSynMemberDefnMemberProperty.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInFullSynMemberDefnMemberProperty.fs.bsl @@ -23,6 +23,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (3,6--3,9)) Target = None AppliesToGetterAndSetter = false @@ -60,6 +61,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (3,6--3,9)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSecondaryConstructor.fs.bsl b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSecondaryConstructor.fs.bsl index ceff4f8e244..ef7b78c160e 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSecondaryConstructor.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSecondaryConstructor.fs.bsl @@ -77,6 +77,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (9,6--9,9)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSynMemberDefnLetBindings.fs.bsl b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSynMemberDefnLetBindings.fs.bsl index a8e5110eeb4..a36775bbc28 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSynMemberDefnLetBindings.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSynMemberDefnLetBindings.fs.bsl @@ -20,6 +20,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (3,6--3,9)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSynMemberDefnMember.fs.bsl b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSynMemberDefnMember.fs.bsl index 83139fe83ee..c816524f66d 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSynMemberDefnMember.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSynMemberDefnMember.fs.bsl @@ -20,6 +20,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (3,6--3,9)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSynModuleDeclLet.fs.bsl b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSynModuleDeclLet.fs.bsl index 08edc3d2631..0745e53fd65 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSynModuleDeclLet.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSynModuleDeclLet.fs.bsl @@ -12,6 +12,7 @@ ImplFile [SynBinding (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (2,2--2,5)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInWriteOnlySynMemberDefnMemberProperty.fs.bsl b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInWriteOnlySynMemberDefnMemberProperty.fs.bsl index bf0e8802e32..5b737691f31 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInWriteOnlySynMemberDefnMemberProperty.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInWriteOnlySynMemberDefnMemberProperty.fs.bsl @@ -24,6 +24,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (3,6--3,9)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/Binding/RangeOfLetKeywordShouldBePresentInSynModuleDeclLetBindingWithAttributes.fs.bsl b/tests/service/data/SyntaxTree/Binding/RangeOfLetKeywordShouldBePresentInSynModuleDeclLetBindingWithAttributes.fs.bsl index 613931862dd..49f79b68f82 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfLetKeywordShouldBePresentInSynModuleDeclLetBindingWithAttributes.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfLetKeywordShouldBePresentInSynModuleDeclLetBindingWithAttributes.fs.bsl @@ -14,6 +14,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([SomeAttribute], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (3,2--3,15)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/Exception/Missing name 02.fs.bsl b/tests/service/data/SyntaxTree/Exception/Missing name 02.fs.bsl index d71336169b3..a4e73c1fc13 100644 --- a/tests/service/data/SyntaxTree/Exception/Missing name 02.fs.bsl +++ b/tests/service/data/SyntaxTree/Exception/Missing name 02.fs.bsl @@ -8,6 +8,7 @@ ImplFile (SynExceptionDefn (SynExceptionDefnRepr ([{ Attributes = [{ TypeName = SynLongIdent ([A], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (3,12--3,13)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/Expression/SynExprObjWithSetter.fs.bsl b/tests/service/data/SyntaxTree/Expression/SynExprObjWithSetter.fs.bsl index 8e4beda60ed..11ed439b41c 100644 --- a/tests/service/data/SyntaxTree/Expression/SynExprObjWithSetter.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/SynExprObjWithSetter.fs.bsl @@ -10,6 +10,7 @@ ImplFile ([{ Attributes = [{ TypeName = SynLongIdent ([AbstractClass], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (2,2--2,15)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/Extern/Extern 01.fs.bsl b/tests/service/data/SyntaxTree/Extern/Extern 01.fs.bsl index efb3580fda3..77b82e76ec6 100644 --- a/tests/service/data/SyntaxTree/Extern/Extern 01.fs.bsl +++ b/tests/service/data/SyntaxTree/Extern/Extern 01.fs.bsl @@ -9,6 +9,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([DllImport], [], [None]) + TypeArgs = [] ArgExpr = Paren (Tuple diff --git a/tests/service/data/SyntaxTree/Measure/SynTypeTupleInMeasureTypeWithLeadingSlash.fs.bsl b/tests/service/data/SyntaxTree/Measure/SynTypeTupleInMeasureTypeWithLeadingSlash.fs.bsl index 65535c03d20..68ff6b1e2c2 100644 --- a/tests/service/data/SyntaxTree/Measure/SynTypeTupleInMeasureTypeWithLeadingSlash.fs.bsl +++ b/tests/service/data/SyntaxTree/Measure/SynTypeTupleInMeasureTypeWithLeadingSlash.fs.bsl @@ -9,6 +9,7 @@ ImplFile (SynComponentInfo ([{ Attributes = [{ TypeName = SynLongIdent ([Measure], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (2,2--2,9)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/Measure/SynTypeTupleInMeasureTypeWithNoSlashes.fs.bsl b/tests/service/data/SyntaxTree/Measure/SynTypeTupleInMeasureTypeWithNoSlashes.fs.bsl index dca088b13db..14e2fa9082b 100644 --- a/tests/service/data/SyntaxTree/Measure/SynTypeTupleInMeasureTypeWithNoSlashes.fs.bsl +++ b/tests/service/data/SyntaxTree/Measure/SynTypeTupleInMeasureTypeWithNoSlashes.fs.bsl @@ -9,6 +9,7 @@ ImplFile (SynComponentInfo ([{ Attributes = [{ TypeName = SynLongIdent ([Measure], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (2,2--2,9)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/Measure/SynTypeTupleInMeasureTypeWithStartAndSlash.fs.bsl b/tests/service/data/SyntaxTree/Measure/SynTypeTupleInMeasureTypeWithStartAndSlash.fs.bsl index f47273a687c..7204f4438ca 100644 --- a/tests/service/data/SyntaxTree/Measure/SynTypeTupleInMeasureTypeWithStartAndSlash.fs.bsl +++ b/tests/service/data/SyntaxTree/Measure/SynTypeTupleInMeasureTypeWithStartAndSlash.fs.bsl @@ -9,6 +9,7 @@ ImplFile (SynComponentInfo ([{ Attributes = [{ TypeName = SynLongIdent ([Measure], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (2,2--2,9)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/Member/Field 15.fs.bsl b/tests/service/data/SyntaxTree/Member/Field 15.fs.bsl index 472d5e0c2f9..94448adbe64 100644 --- a/tests/service/data/SyntaxTree/Member/Field 15.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Field 15.fs.bsl @@ -15,6 +15,7 @@ ImplFile (SynField ([{ Attributes = [{ TypeName = SynLongIdent ([A], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (4,6--4,7)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/Member/Member - Attributes 01.fs.bsl b/tests/service/data/SyntaxTree/Member/Member - Attributes 01.fs.bsl index 168769ff761..1990f6d1de4 100644 --- a/tests/service/data/SyntaxTree/Member/Member - Attributes 01.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Member - Attributes 01.fs.bsl @@ -17,6 +17,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([A], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (4,6--4,7)) Target = None AppliesToGetterAndSetter = false @@ -47,6 +48,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([B], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (5,6--5,7)) Target = None AppliesToGetterAndSetter = false @@ -76,6 +78,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([C], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (6,6--6,7)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/Member/Member 01.fs.bsl b/tests/service/data/SyntaxTree/Member/Member 01.fs.bsl index e5ce844b09e..9ce2ab57297 100644 --- a/tests/service/data/SyntaxTree/Member/Member 01.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Member 01.fs.bsl @@ -16,6 +16,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([A], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (4,6--4,7)) Target = None AppliesToGetterAndSetter = false @@ -46,6 +47,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([B], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (5,6--5,7)) Target = None AppliesToGetterAndSetter = false @@ -75,6 +77,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([C], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (6,6--6,7)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/Member/Member 02.fs.bsl b/tests/service/data/SyntaxTree/Member/Member 02.fs.bsl index dc24f73a058..813346568ca 100644 --- a/tests/service/data/SyntaxTree/Member/Member 02.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Member 02.fs.bsl @@ -16,6 +16,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([A], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (4,6--4,7)) Target = None AppliesToGetterAndSetter = false @@ -46,6 +47,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([B], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (5,6--5,7)) Target = None AppliesToGetterAndSetter = false @@ -75,6 +77,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([C], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (6,6--6,7)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/Member/Member 03.fs.bsl b/tests/service/data/SyntaxTree/Member/Member 03.fs.bsl index cb85a85bfc7..495d712c248 100644 --- a/tests/service/data/SyntaxTree/Member/Member 03.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Member 03.fs.bsl @@ -16,6 +16,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([A], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (4,6--4,7)) Target = None AppliesToGetterAndSetter = false @@ -46,6 +47,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([B], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (5,6--5,7)) Target = None AppliesToGetterAndSetter = false @@ -75,6 +77,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([C], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (6,6--6,7)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/Member/Member 04.fs.bsl b/tests/service/data/SyntaxTree/Member/Member 04.fs.bsl index c4bfa610f42..83019d21481 100644 --- a/tests/service/data/SyntaxTree/Member/Member 04.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Member 04.fs.bsl @@ -16,6 +16,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([A], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (4,6--4,7)) Target = None AppliesToGetterAndSetter = false @@ -46,6 +47,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([B], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (5,6--5,7)) Target = None AppliesToGetterAndSetter = false @@ -76,6 +78,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([C], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (6,6--6,7)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/Member/Member 05.fs.bsl b/tests/service/data/SyntaxTree/Member/Member 05.fs.bsl index 7fdadfeebbc..3f1ec90e0ca 100644 --- a/tests/service/data/SyntaxTree/Member/Member 05.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Member 05.fs.bsl @@ -16,6 +16,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([A], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (4,6--4,7)) Target = None AppliesToGetterAndSetter = false @@ -46,6 +47,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([B], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (5,6--5,7)) Target = None AppliesToGetterAndSetter = false @@ -77,6 +79,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([C], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (6,6--6,7)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/Member/Member 06.fs.bsl b/tests/service/data/SyntaxTree/Member/Member 06.fs.bsl index d249dd2cc26..a8f0e12388e 100644 --- a/tests/service/data/SyntaxTree/Member/Member 06.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Member 06.fs.bsl @@ -16,6 +16,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([A], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (4,6--4,7)) Target = None AppliesToGetterAndSetter = false @@ -46,6 +47,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([B], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (5,6--5,7)) Target = None AppliesToGetterAndSetter = false @@ -76,6 +78,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([C], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (6,6--6,7)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/Member/Member 07.fs.bsl b/tests/service/data/SyntaxTree/Member/Member 07.fs.bsl index 5e5c51e0f2b..5df9633b4d4 100644 --- a/tests/service/data/SyntaxTree/Member/Member 07.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Member 07.fs.bsl @@ -16,6 +16,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([A], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (4,6--4,7)) Target = None AppliesToGetterAndSetter = false @@ -46,6 +47,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([B], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (5,6--5,7)) Target = None AppliesToGetterAndSetter = false @@ -74,6 +76,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([C], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (6,6--6,7)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/Member/Static 02.fs.bsl b/tests/service/data/SyntaxTree/Member/Static 02.fs.bsl index ecf86c4e1f6..24d860082e3 100644 --- a/tests/service/data/SyntaxTree/Member/Static 02.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Static 02.fs.bsl @@ -16,6 +16,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([A], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (4,6--4,7)) Target = None AppliesToGetterAndSetter = false @@ -46,6 +47,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([B], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (5,6--5,7)) Target = None AppliesToGetterAndSetter = false @@ -74,6 +76,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([C], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (6,6--6,7)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/Member/Static 03.fs.bsl b/tests/service/data/SyntaxTree/Member/Static 03.fs.bsl index 70d5eb3aba9..4ecb47300d2 100644 --- a/tests/service/data/SyntaxTree/Member/Static 03.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Static 03.fs.bsl @@ -16,6 +16,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([A], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (4,6--4,7)) Target = None AppliesToGetterAndSetter = false @@ -46,6 +47,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([B], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (5,6--5,7)) Target = None AppliesToGetterAndSetter = false @@ -75,6 +77,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([C], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (6,6--6,7)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/ModuleOrNamespace/Module - Attribute 01.fs.bsl b/tests/service/data/SyntaxTree/ModuleOrNamespace/Module - Attribute 01.fs.bsl index 70ca7f64fdb..4d53c1edcd2 100644 --- a/tests/service/data/SyntaxTree/ModuleOrNamespace/Module - Attribute 01.fs.bsl +++ b/tests/service/data/SyntaxTree/ModuleOrNamespace/Module - Attribute 01.fs.bsl @@ -25,6 +25,7 @@ ImplFile EqualsRange = Some (5,15--5,16) })], (5,0--5,20))], PreXmlDoc ((2,0), FSharp.Compiler.Xml.XmlDocCollector), [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (2,4--2,7)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/ModuleOrNamespaceSig/ModuleRangeShouldStartAtFirstAttribute.fsi.bsl b/tests/service/data/SyntaxTree/ModuleOrNamespaceSig/ModuleRangeShouldStartAtFirstAttribute.fsi.bsl index 892bcf3d4b5..cf5290716a1 100644 --- a/tests/service/data/SyntaxTree/ModuleOrNamespaceSig/ModuleRangeShouldStartAtFirstAttribute.fsi.bsl +++ b/tests/service/data/SyntaxTree/ModuleOrNamespaceSig/ModuleRangeShouldStartAtFirstAttribute.fsi.bsl @@ -16,6 +16,7 @@ SigFile EqualsRange = None }), (5,0--5,14))], PreXmlDoc ((2,0), FSharp.Compiler.Xml.XmlDocCollector), [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (2,4--2,7)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/NestedModule/RangeOfAttributeShouldBeIncludedInSynModuleDeclNestedModule.fs.bsl b/tests/service/data/SyntaxTree/NestedModule/RangeOfAttributeShouldBeIncludedInSynModuleDeclNestedModule.fs.bsl index 0160f4068bf..10919c2ff66 100644 --- a/tests/service/data/SyntaxTree/NestedModule/RangeOfAttributeShouldBeIncludedInSynModuleDeclNestedModule.fs.bsl +++ b/tests/service/data/SyntaxTree/NestedModule/RangeOfAttributeShouldBeIncludedInSynModuleDeclNestedModule.fs.bsl @@ -7,6 +7,7 @@ ImplFile [NestedModule (SynComponentInfo ([{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (4,2--4,5)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/NestedModule/RangeOfAttributeShouldBeIncludedInSynModuleSigDeclNestedModule.fsi.bsl b/tests/service/data/SyntaxTree/NestedModule/RangeOfAttributeShouldBeIncludedInSynModuleSigDeclNestedModule.fsi.bsl index 2fbd636ab28..e0ed27f679d 100644 --- a/tests/service/data/SyntaxTree/NestedModule/RangeOfAttributeShouldBeIncludedInSynModuleSigDeclNestedModule.fsi.bsl +++ b/tests/service/data/SyntaxTree/NestedModule/RangeOfAttributeShouldBeIncludedInSynModuleSigDeclNestedModule.fsi.bsl @@ -8,6 +8,7 @@ SigFile [NestedModule (SynComponentInfo ([{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (4,2--4,5)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/NestedModule/RangeOfNestedModuleInSignatureFileShouldEndAtTheLastSynModuleSigDecl.fsi.bsl b/tests/service/data/SyntaxTree/NestedModule/RangeOfNestedModuleInSignatureFileShouldEndAtTheLastSynModuleSigDecl.fsi.bsl index b52c329f8c9..1a61b823c91 100644 --- a/tests/service/data/SyntaxTree/NestedModule/RangeOfNestedModuleInSignatureFileShouldEndAtTheLastSynModuleSigDecl.fsi.bsl +++ b/tests/service/data/SyntaxTree/NestedModule/RangeOfNestedModuleInSignatureFileShouldEndAtTheLastSynModuleSigDecl.fsi.bsl @@ -234,6 +234,7 @@ SigFile ([{ Attributes = [{ TypeName = SynLongIdent ([StructuralEquality], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (27,6--27,24)) Target = None AppliesToGetterAndSetter = false @@ -241,6 +242,7 @@ SigFile { TypeName = SynLongIdent ([StructuralComparison], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (27,26--27,46)) Target = None AppliesToGetterAndSetter = false @@ -249,6 +251,7 @@ SigFile { Attributes = [{ TypeName = SynLongIdent ([CompiledName], [], [None]) + TypeArgs = [] ArgExpr = Paren (Const @@ -387,6 +390,7 @@ SigFile (SynComponentInfo ([{ Attributes = [{ TypeName = SynLongIdent ([AutoOpen], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (46,2--46,10)) Target = None AppliesToGetterAndSetter = false @@ -412,6 +416,7 @@ SigFile ([{ Attributes = [{ TypeName = SynLongIdent ([CompiledName], [], [None]) + TypeArgs = [] ArgExpr = Paren (Const @@ -446,6 +451,7 @@ SigFile ([{ Attributes = [{ TypeName = SynLongIdent ([CompiledName], [], [None]) + TypeArgs = [] ArgExpr = Paren (Const @@ -480,6 +486,7 @@ SigFile ([{ Attributes = [{ TypeName = SynLongIdent ([CompiledName], [], [None]) + TypeArgs = [] ArgExpr = Paren (Const @@ -513,6 +520,7 @@ SigFile ([{ Attributes = [{ TypeName = SynLongIdent ([CompiledName], [], [None]) + TypeArgs = [] ArgExpr = Paren (Const diff --git a/tests/service/data/SyntaxTree/OperatorName/OperatorNameInValConstraint.fsi.bsl b/tests/service/data/SyntaxTree/OperatorName/OperatorNameInValConstraint.fsi.bsl index 9fc5a83a0d6..3b4f8976d40 100644 --- a/tests/service/data/SyntaxTree/OperatorName/OperatorNameInValConstraint.fsi.bsl +++ b/tests/service/data/SyntaxTree/OperatorName/OperatorNameInValConstraint.fsi.bsl @@ -71,6 +71,7 @@ SigFile EqualsRange = None }), (4,4--12,94))], PreXmlDoc ((2,0), FSharp.Compiler.Xml.XmlDocCollector), [{ Attributes = [{ TypeName = SynLongIdent ([AutoOpen], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (2,2--2,10)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributeShouldBeIncludedInSynExceptionDefnReprAndSynExceptionSig.fsi.bsl b/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributeShouldBeIncludedInSynExceptionDefnReprAndSynExceptionSig.fsi.bsl index e92edcc8113..b3cfb0d22ab 100644 --- a/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributeShouldBeIncludedInSynExceptionDefnReprAndSynExceptionSig.fsi.bsl +++ b/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributeShouldBeIncludedInSynExceptionDefnReprAndSynExceptionSig.fsi.bsl @@ -9,11 +9,13 @@ SigFile (SynExceptionDefnRepr ([{ Attributes = [{ TypeName = SynLongIdent ([NoEquality], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (5,2--5,12)) Target = None AppliesToGetterAndSetter = false Range = (5,2--5,12) }; { TypeName = SynLongIdent ([NoComparison], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (5,14--5,26)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributeShouldBeIncludedInSynTypeDefnSig.fsi.bsl b/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributeShouldBeIncludedInSynTypeDefnSig.fsi.bsl index 0e7eac31934..570bd9d9f12 100644 --- a/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributeShouldBeIncludedInSynTypeDefnSig.fsi.bsl +++ b/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributeShouldBeIncludedInSynTypeDefnSig.fsi.bsl @@ -10,6 +10,7 @@ SigFile (SynComponentInfo ([{ Attributes = [{ TypeName = SynLongIdent ([Foo1], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (4,2--4,6)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributeShouldBeIncludedInSynValSpfnAndMember.fsi.bsl b/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributeShouldBeIncludedInSynValSpfnAndMember.fsi.bsl index f33e7aff10b..56ba99b4ae8 100644 --- a/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributeShouldBeIncludedInSynValSpfnAndMember.fsi.bsl +++ b/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributeShouldBeIncludedInSynValSpfnAndMember.fsi.bsl @@ -17,6 +17,7 @@ SigFile (SynValSig ([{ Attributes = [{ TypeName = SynLongIdent ([Foo2], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (5,6--5,10)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributesShouldBeIncludedInRecursiveTypes.fsi.bsl b/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributesShouldBeIncludedInRecursiveTypes.fsi.bsl index bf3950ebf3c..72668db4e27 100644 --- a/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributesShouldBeIncludedInRecursiveTypes.fsi.bsl +++ b/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributesShouldBeIncludedInRecursiveTypes.fsi.bsl @@ -27,6 +27,7 @@ SigFile ([{ Attributes = [{ TypeName = SynLongIdent ([CustomEquality], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (7,6--7,20)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/SignatureType/ValKeywordIsPresentInSynValSig.fsi.bsl b/tests/service/data/SyntaxTree/SignatureType/ValKeywordIsPresentInSynValSig.fsi.bsl index fb5865e0b04..65cdfc25add 100644 --- a/tests/service/data/SyntaxTree/SignatureType/ValKeywordIsPresentInSynValSig.fsi.bsl +++ b/tests/service/data/SyntaxTree/SignatureType/ValKeywordIsPresentInSynValSig.fsi.bsl @@ -7,6 +7,7 @@ SigFile [Val (SynValSig ([{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (4,2--4,5)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/SimplePats/SimplePats - Recover 01.fs.bsl b/tests/service/data/SyntaxTree/SimplePats/SimplePats - Recover 01.fs.bsl index 9f74ed36236..dd1f97ec365 100644 --- a/tests/service/data/SyntaxTree/SimplePats/SimplePats - Recover 01.fs.bsl +++ b/tests/service/data/SyntaxTree/SimplePats/SimplePats - Recover 01.fs.bsl @@ -88,6 +88,7 @@ ImplFile ([[SynArgInfo ([{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (5,15--5,18)) Target = None AppliesToGetterAndSetter = false @@ -96,6 +97,7 @@ ImplFile SynArgInfo ([{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (5,28--5,31)) Target = None AppliesToGetterAndSetter = false @@ -111,6 +113,7 @@ ImplFile (Id (bar, None, false, false, false, (5,21--5,24)), [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (5,15--5,18)) Target = None AppliesToGetterAndSetter = false @@ -123,6 +126,7 @@ ImplFile (5,34--5,38)), [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (5,28--5,31)) Target = None AppliesToGetterAndSetter = false @@ -142,6 +146,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (5,15--5,18)) Target = None AppliesToGetterAndSetter = false @@ -157,6 +162,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (5,28--5,31)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/SimplePats/SimplePats 01.fs.bsl b/tests/service/data/SyntaxTree/SimplePats/SimplePats 01.fs.bsl index 512fa280b98..7b25dc154a8 100644 --- a/tests/service/data/SyntaxTree/SimplePats/SimplePats 01.fs.bsl +++ b/tests/service/data/SyntaxTree/SimplePats/SimplePats 01.fs.bsl @@ -78,6 +78,7 @@ ImplFile ([[SynArgInfo ([{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (5,15--5,18)) Target = None AppliesToGetterAndSetter = false @@ -86,6 +87,7 @@ ImplFile SynArgInfo ([{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (5,28--5,31)) Target = None AppliesToGetterAndSetter = false @@ -100,6 +102,7 @@ ImplFile (Id (bar, None, false, false, false, (5,21--5,24)), [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (5,15--5,18)) Target = None AppliesToGetterAndSetter = false @@ -112,6 +115,7 @@ ImplFile (5,34--5,38)), [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (5,28--5,31)) Target = None AppliesToGetterAndSetter = false @@ -130,6 +134,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (5,15--5,18)) Target = None AppliesToGetterAndSetter = false @@ -145,6 +150,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (5,28--5,31)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/SimplePats/SimplePats 02.fs.bsl b/tests/service/data/SyntaxTree/SimplePats/SimplePats 02.fs.bsl index fc92f2e4767..d18b08eed93 100644 --- a/tests/service/data/SyntaxTree/SimplePats/SimplePats 02.fs.bsl +++ b/tests/service/data/SyntaxTree/SimplePats/SimplePats 02.fs.bsl @@ -92,6 +92,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (5,9--5,12)) Target = None AppliesToGetterAndSetter = false @@ -107,6 +108,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (5,22--5,25)) Target = None AppliesToGetterAndSetter = false @@ -128,6 +130,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (5,9--5,12)) Target = None AppliesToGetterAndSetter = false @@ -143,6 +146,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (5,22--5,25)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/SynType/SynTypeTupleDoesIncludeLeadingParameterAttributes.fsi.bsl b/tests/service/data/SyntaxTree/SynType/SynTypeTupleDoesIncludeLeadingParameterAttributes.fsi.bsl index f3d59669f94..5be048f9d5c 100644 --- a/tests/service/data/SyntaxTree/SynType/SynTypeTupleDoesIncludeLeadingParameterAttributes.fsi.bsl +++ b/tests/service/data/SyntaxTree/SynType/SynTypeTupleDoesIncludeLeadingParameterAttributes.fsi.bsl @@ -26,6 +26,7 @@ SigFile [{ TypeName = SynLongIdent ([SomeAttribute], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (3,16--3,29)) Target = None @@ -41,6 +42,7 @@ SigFile [{ TypeName = SynLongIdent ([OtherAttribute], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (3,38--3,52)) Target = None @@ -58,6 +60,7 @@ SigFile [{ TypeName = SynLongIdent ([SomeAttribute], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (3,16--3,29)) Target = None AppliesToGetterAndSetter = false @@ -68,6 +71,7 @@ SigFile [{ TypeName = SynLongIdent ([OtherAttribute], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (3,38--3,52)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/Type/AttributesInOptionalNamedMemberParameter.fs.bsl b/tests/service/data/SyntaxTree/Type/AttributesInOptionalNamedMemberParameter.fs.bsl index 1905684969e..0b2fafcfc14 100644 --- a/tests/service/data/SyntaxTree/Type/AttributesInOptionalNamedMemberParameter.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/AttributesInOptionalNamedMemberParameter.fs.bsl @@ -21,12 +21,14 @@ ImplFile ([{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (3,25--3,28)) Target = None AppliesToGetterAndSetter = false Range = (3,25--3,28) }; { TypeName = SynLongIdent ([Bar], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (3,30--3,33)) Target = None AppliesToGetterAndSetter = false @@ -41,12 +43,14 @@ ImplFile ([{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (3,25--3,28)) Target = None AppliesToGetterAndSetter = false Range = (3,25--3,28) }; { TypeName = SynLongIdent ([Bar], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (3,30--3,33)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/Type/Class 05.fs.bsl b/tests/service/data/SyntaxTree/Type/Class 05.fs.bsl index 6516bdc8320..54e7223a1e3 100644 --- a/tests/service/data/SyntaxTree/Type/Class 05.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/Class 05.fs.bsl @@ -15,6 +15,7 @@ ImplFile (None, [{ Attributes = [{ TypeName = SynLongIdent ([A], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (3,9--3,10)) Target = None AppliesToGetterAndSetter = false @@ -28,6 +29,7 @@ ImplFile (None, [{ Attributes = [{ TypeName = SynLongIdent ([A], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (3,9--3,10)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/Type/RangeOfAttributeShouldBeIncludedInSynTypeDefn.fs.bsl b/tests/service/data/SyntaxTree/Type/RangeOfAttributeShouldBeIncludedInSynTypeDefn.fs.bsl index 3d954e3c37d..96d77e9d4d8 100644 --- a/tests/service/data/SyntaxTree/Type/RangeOfAttributeShouldBeIncludedInSynTypeDefn.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/RangeOfAttributeShouldBeIncludedInSynTypeDefn.fs.bsl @@ -9,6 +9,7 @@ ImplFile (SynComponentInfo ([{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (2,2--2,5)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/Type/RangeOfAttributesShouldBeIncludedInRecursiveTypes.fs.bsl b/tests/service/data/SyntaxTree/Type/RangeOfAttributesShouldBeIncludedInRecursiveTypes.fs.bsl index 0b685986fc4..8c9e411c3a7 100644 --- a/tests/service/data/SyntaxTree/Type/RangeOfAttributesShouldBeIncludedInRecursiveTypes.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/RangeOfAttributesShouldBeIncludedInRecursiveTypes.fs.bsl @@ -10,11 +10,13 @@ ImplFile (SynComponentInfo ([{ Attributes = [{ TypeName = SynLongIdent ([NoEquality], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (2,2--2,12)) Target = None AppliesToGetterAndSetter = false Range = (2,2--2,12) }; { TypeName = SynLongIdent ([NoComparison], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (2,15--2,27)) Target = None AppliesToGetterAndSetter = false @@ -64,11 +66,13 @@ ImplFile ([{ Attributes = [{ TypeName = SynLongIdent ([CustomEquality], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (6,6--6,20)) Target = None AppliesToGetterAndSetter = false Range = (6,6--6,20) }; { TypeName = SynLongIdent ([NoComparison], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (6,23--6,35)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/Type/SynTypeDefnWithAttributeContainsTheRangeOfTheTypeKeyword.fs.bsl b/tests/service/data/SyntaxTree/Type/SynTypeDefnWithAttributeContainsTheRangeOfTheTypeKeyword.fs.bsl index 6b465047993..ce320ee5694 100644 --- a/tests/service/data/SyntaxTree/Type/SynTypeDefnWithAttributeContainsTheRangeOfTheTypeKeyword.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/SynTypeDefnWithAttributeContainsTheRangeOfTheTypeKeyword.fs.bsl @@ -12,6 +12,7 @@ ImplFile (SynComponentInfo ([{ Attributes = [{ TypeName = SynLongIdent ([MyAttribute], [], [None]) + TypeArgs = [] ArgExpr = Const (Unit, (2,2--2,13)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/TypeParameters/Attribute.fs b/tests/service/data/SyntaxTree/TypeParameters/Attribute.fs new file mode 100644 index 00000000000..30b00371ce6 --- /dev/null +++ b/tests/service/data/SyntaxTree/TypeParameters/Attribute.fs @@ -0,0 +1,5 @@ +[>>] +do() + +[>(NamedArg1="Foo", NamedArg2="Bar")>] +do() \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/TypeParameters/Attribute.fs.bsl b/tests/service/data/SyntaxTree/TypeParameters/Attribute.fs.bsl new file mode 100644 index 00000000000..f870a9d1214 --- /dev/null +++ b/tests/service/data/SyntaxTree/TypeParameters/Attribute.fs.bsl @@ -0,0 +1,84 @@ +ImplFile + (ParsedImplFileInput + ("/root/TypeParameters/Attribute.fs", false, QualifiedNameOfFile Attribute, + [], [], + [SynModuleOrNamespace + ([Attribute], false, AnonModule, + [Attributes + ([{ Attributes = + [{ TypeName = SynLongIdent ([AGoodAttribute], [], [None]) + TypeArgs = + [Var (SynTypar (A, HeadType, false), (1,17--1,19)); + App + (LongIdent (SynLongIdent ([SomeThing], [], [None])), + Some (1,30--1,31), + [LongIdent (SynLongIdent ([int], [], [None]))], [], + Some (1,34--1,35), false, (1,21--1,35))] + ArgExpr = Const (Unit, (1,2--1,36)) + Target = None + AppliesToGetterAndSetter = false + Range = (1,2--1,36) }] + Range = (1,0--1,38) }], (1,0--1,38)); + Expr (Do (Const (Unit, (2,2--2,4)), (2,0--2,4)), (2,0--2,4)); + Attributes + ([{ Attributes = + [{ TypeName = SynLongIdent ([AnotherAttr], [], [None]) + TypeArgs = + [Var (SynTypar (a, None, false), (4,14--4,16)); + LongIdent (SynLongIdent ([string], [], [None])); + Intersection + (None, + [HashConstraint + (LongIdent + (SynLongIdent ([IDisposible], [], [None])), + (4,25--4,37)); + HashConstraint + (App + (LongIdent (SynLongIdent ([List], [], [None])), + Some (4,45--4,46), + [LongIdent (SynLongIdent ([int], [], [None]))], + [], Some (4,49--4,50), false, (4,41--4,50)), + (4,40--4,50))], (4,25--4,50), + { AmpersandRanges = [(4,38--4,39)] })] + ArgExpr = + Paren + (Tuple + (false, + [App + (NonAtomic, false, + App + (NonAtomic, true, + LongIdent + (false, + SynLongIdent + ([op_Equality], [], + [Some (OriginalNotation "=")]), None, + (4,61--4,62)), Ident NamedArg1, + (4,52--4,62)), + Const + (String ("Foo", Regular, (4,62--4,67)), + (4,62--4,67)), (4,52--4,67)); + App + (NonAtomic, false, + App + (NonAtomic, true, + LongIdent + (false, + SynLongIdent + ([op_Equality], [], + [Some (OriginalNotation "=")]), None, + (4,78--4,79)), Ident NamedArg2, + (4,69--4,79)), + Const + (String ("Bar", Regular, (4,79--4,84)), + (4,79--4,84)), (4,69--4,84))], [(4,67--4,68)], + (4,52--4,84)), (4,51--4,52), Some (4,84--4,85), + (4,51--4,85)) + Target = None + AppliesToGetterAndSetter = false + Range = (4,2--4,85) }] + Range = (4,0--4,87) }], (4,0--4,87)); + Expr (Do (Const (Unit, (5,2--5,4)), (5,0--5,4)), (5,0--5,4))], + PreXmlDocEmpty, [], None, (1,0--5,4), { LeadingKeyword = None })], + (true, true), { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/TypeParameters/MethodDefAndUse.fs b/tests/service/data/SyntaxTree/TypeParameters/MethodDefAndUse.fs new file mode 100644 index 00000000000..16ae9dee2af --- /dev/null +++ b/tests/service/data/SyntaxTree/TypeParameters/MethodDefAndUse.fs @@ -0,0 +1,3 @@ +let inline myMethod<^S, 'a> (arg : 'a) = arg + +myMethod<^T> 2 \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/TypeParameters/MethodDefAndUse.fs.bsl b/tests/service/data/SyntaxTree/TypeParameters/MethodDefAndUse.fs.bsl new file mode 100644 index 00000000000..5bf0c0b8460 --- /dev/null +++ b/tests/service/data/SyntaxTree/TypeParameters/MethodDefAndUse.fs.bsl @@ -0,0 +1,51 @@ +ImplFile + (ParsedImplFileInput + ("/root/TypeParameters/MethodDefAndUse.fs", false, + QualifiedNameOfFile MethodDefAndUse, [], [], + [SynModuleOrNamespace + ([MethodDefAndUse], false, AnonModule, + [Let + (false, + [SynBinding + (None, Normal, true, false, [], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), + SynValData + (None, + SynValInfo + ([[SynArgInfo ([], false, Some arg)]], + SynArgInfo ([], false, None)), None), + LongIdent + (SynLongIdent ([myMethod], [], [None]), None, + Some + (SynValTyparDecls + (Some + (PostfixList + ([SynTyparDecl + ([], SynTypar (S, HeadType, false), [], + { AmpersandRanges = [] }); + SynTyparDecl + ([], SynTypar (a, None, false), [], + { AmpersandRanges = [] })], [], + (1,19--1,27))), false)), + Pats + [Paren + (Typed + (Named + (SynIdent (arg, None), false, None, (1,29--1,32)), + Var (SynTypar (a, None, false), (1,35--1,37)), + (1,29--1,37)), (1,28--1,38))], None, (1,11--1,38)), + None, Ident arg, (1,11--1,38), NoneAtLet, + { LeadingKeyword = Let (1,0--1,3) + InlineKeyword = Some (1,4--1,10) + EqualsRange = Some (1,39--1,40) })], (1,0--1,44)); + Expr + (App + (NonAtomic, false, + TypeApp + (Ident myMethod, (3,8--3,9), + [Var (SynTypar (T, HeadType, false), (3,9--3,11))], [], + Some (3,11--3,12), (3,8--3,12), (3,0--3,12)), + Const (Int32 2, (3,13--3,14)), (3,0--3,14)), (3,0--3,14))], + PreXmlDocEmpty, [], None, (1,0--3,14), { LeadingKeyword = None })], + (true, true), { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/TypeParameters/TypeDefAndApp.fs b/tests/service/data/SyntaxTree/TypeParameters/TypeDefAndApp.fs new file mode 100644 index 00000000000..8c1e7167a0f --- /dev/null +++ b/tests/service/data/SyntaxTree/TypeParameters/TypeDefAndApp.fs @@ -0,0 +1,4 @@ +type AGoodType<^T, ^S>()= + class end + +AGoodType<'P, int>() \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/TypeParameters/TypeDefAndApp.fs.bsl b/tests/service/data/SyntaxTree/TypeParameters/TypeDefAndApp.fs.bsl new file mode 100644 index 00000000000..865632f347a --- /dev/null +++ b/tests/service/data/SyntaxTree/TypeParameters/TypeDefAndApp.fs.bsl @@ -0,0 +1,47 @@ +ImplFile + (ParsedImplFileInput + ("/root/TypeParameters/TypeDefAndApp.fs", false, + QualifiedNameOfFile TypeDefAndApp, [], [], + [SynModuleOrNamespace + ([TypeDefAndApp], false, AnonModule, + [Types + ([SynTypeDefn + (SynComponentInfo + ([], + Some + (PostfixList + ([SynTyparDecl + ([], SynTypar (T, HeadType, false), [], + { AmpersandRanges = [] }); + SynTyparDecl + ([], SynTypar (S, HeadType, false), [], + { AmpersandRanges = [] })], [], (1,14--1,22))), + [], [AGoodType], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), + true, None, (1,5--1,14)), + ObjectModel + (Class, + [ImplicitCtor + (None, [], Const (Unit, (1,22--1,24)), None, + PreXmlDoc ((1,22), FSharp.Compiler.Xml.XmlDocCollector), + (1,5--1,14), { AsKeyword = None })], (2,4--2,13)), [], + Some + (ImplicitCtor + (None, [], Const (Unit, (1,22--1,24)), None, + PreXmlDoc ((1,22), FSharp.Compiler.Xml.XmlDocCollector), + (1,5--1,14), { AsKeyword = None })), (1,5--2,13), + { LeadingKeyword = Type (1,0--1,4) + EqualsRange = Some (1,24--1,25) + WithKeyword = None })], (1,0--2,13)); + Expr + (App + (Atomic, false, + TypeApp + (Ident AGoodType, (4,9--4,10), + [Var (SynTypar (P, None, false), (4,10--4,12)); + LongIdent (SynLongIdent ([int], [], [None]))], + [(4,12--4,13)], Some (4,17--4,18), (4,9--4,18), (4,0--4,18)), + Const (Unit, (4,18--4,20)), (4,0--4,20)), (4,0--4,20))], + PreXmlDocEmpty, [], None, (1,0--4,20), { LeadingKeyword = None })], + (true, true), { ConditionalDirectives = [] + CodeComments = [] }, set []))