From c6a11c47b6e26e85b8e1bc9929456727227f3dd6 Mon Sep 17 00:00:00 2001 From: Mackenzie F Libby Date: Sun, 19 May 2024 11:51:24 -0400 Subject: [PATCH 01/19] basic parsing implementation of generic attribute type parameters --- src/Compiler/Checking/CheckExpressions.fs | 10 ++++++--- src/Compiler/Driver/CompilerDiagnostics.fs | 2 +- src/Compiler/SyntaxTree/SyntaxTree.fs | 2 ++ src/Compiler/SyntaxTree/SyntaxTree.fsi | 3 +++ src/Compiler/pars.fsy | 17 ++++++++++++--- .../SyntaxTree/Attribute/RangeOfAttribute.fs | 2 +- .../Attribute/RangeOfAttribute.fs.bsl | 21 +++++++++++++------ .../Attribute/RangeOfAttributeWithPath.fs.bsl | 1 + .../RangeOfAttributeWithTarget.fs.bsl | 1 + ...nShouldBeIncludedInSynModuleDeclLet.fs.bsl | 1 + ...BeIncludedInBindingOfSynExprObjExpr.fs.bsl | 1 + ...dedInConstructorSynMemberDefnMember.fs.bsl | 1 + ...tructorSynMemberDefnMemberOptAsSpec.fs.bsl | 1 + ...edInFullSynMemberDefnMemberProperty.fs.bsl | 1 + ...uldBeIncludedInSecondaryConstructor.fs.bsl | 1 + ...eIncludedInSynMemberDefnLetBindings.fs.bsl | 1 + ...ouldBeIncludedInSynMemberDefnMember.fs.bsl | 1 + ...eShouldBeIncludedInSynModuleDeclLet.fs.bsl | 1 + ...riteOnlySynMemberDefnMemberProperty.fs.bsl | 1 + ...nModuleDeclLetBindingWithAttributes.fs.bsl | 1 + .../data/SyntaxTree/Extern/Extern 01.fs.bsl | 1 + 21 files changed, 57 insertions(+), 14 deletions(-) diff --git a/src/Compiler/Checking/CheckExpressions.fs b/src/Compiler/Checking/CheckExpressions.fs index 871f36dd454..5578eca16c3 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]) + TypeParams = None ArgExpr=mkSynUnit m Target=None AppliesToGetterAndSetter=false @@ -11065,13 +11066,15 @@ and TcAttributeEx canFail (cenv: cenv) (env: TcEnv) attrTgt attrEx (synAttr: Syn let (SynLongIdent(tycon, _, _)) = synAttr.TypeName let arg = synAttr.ArgExpr + let (TyparsAndConstraints(synTyparDecls, synTyparConstraints)) = synAttr.TypeParams + let declaredTypars = TcTyparDecls cenv env synTyparDecls 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 - + let envinner = AddDeclaredTypars CheckForDuplicateTypars declaredTypars env + let tpenv = TcTyparConstraints cenv ImplicitlyBoundTyparsAllowed.NewTyparsOK CheckConstraints.CheckCxs ItemOccurence.UseInAttribute envinner emptyUnscopedTyparEnv synTyparConstraints // 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 @@ -11080,7 +11083,8 @@ 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 declaredTypars.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) 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/SyntaxTree/SyntaxTree.fs b/src/Compiler/SyntaxTree/SyntaxTree.fs index 69cd067ddfe..845d5b96e5a 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fs +++ b/src/Compiler/SyntaxTree/SyntaxTree.fs @@ -1042,6 +1042,8 @@ type SynMatchClause = type SynAttribute = { TypeName: SynLongIdent + + TypeParams: SynTyparDecls option ArgExpr: SynExpr diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fsi b/src/Compiler/SyntaxTree/SyntaxTree.fsi index 363ddf55a1d..e5266ec5115 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTree.fsi @@ -1169,6 +1169,9 @@ type SynAttribute = { /// The name of the type for the attribute TypeName: SynLongIdent + + /// The type parameters of the attribute. + TypeParams: SynTyparDecls option /// The argument of the attribute, perhaps a tuple ArgExpr: SynExpr diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index 96058711135..c614f81911c 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -1507,25 +1507,36 @@ attributeListElements: /* One custom attribute */ attribute: + /* A custom attribute with generic type parameters + some.good.AttributeName<^SomeTypar>(and, args)opt_HIGH_PRECEDENCE_APP + HIGH_PRECEDENCE_PAREN_APP + */ + | path postfixTyparDecls HIGH_PRECEDENCE_PAREN_APP opt_atomicExprAfterType + { let arg = match $4 with None -> mkSynUnit $1.Range | Some e -> e + debugPrint("\nWe managed to get in here....\n") + let m = unionRanges $1.Range arg.Range + ({ TypeName = $1; ArgExpr = arg; TypeParams = Some ($2); Target = None; AppliesToGetterAndSetter = false; Range = m }: SynAttribute) } + /* 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; TypeParams = None; 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; TypeParams = None; 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; TypeParams = None; Target = $1; AppliesToGetterAndSetter = false; Range = m }: SynAttribute) } /* The target of a custom attribute */ diff --git a/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs b/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs index f69eaad8c30..31b13d14285 100644 --- a/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs +++ b/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs @@ -1,3 +1,3 @@ -[] +[(foo = "bar")>] do () diff --git a/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs.bsl b/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs.bsl index bde23ff1693..c0d50318ed6 100644 --- a/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs.bsl +++ b/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs.bsl @@ -7,6 +7,15 @@ ImplFile [Attributes ([{ Attributes = [{ TypeName = SynLongIdent ([MyAttribute], [], [None]) + TypeParams = + Some + (PostfixList + ([SynTyparDecl + ([], SynTypar (T, HeadType, false), [], + { AmpersandRanges = [] }); + SynTyparDecl + ([], SynTypar (S, HeadType, false), [], + { AmpersandRanges = [] })], [], (2,13--2,21))) ArgExpr = Paren (App @@ -18,15 +27,15 @@ ImplFile SynLongIdent ([op_Equality], [], [Some (OriginalNotation "=")]), None, - (2,18--2,19)), Ident foo, (2,14--2,19)), + (2,26--2,27)), Ident foo, (2,22--2,27)), Const - (String ("bar", Regular, (2,19--2,24)), - (2,19--2,24)), (2,14--2,24)), (2,13--2,14), - Some (2,24--2,25), (2,13--2,25)) + (String ("bar", Regular, (2,28--2,33)), + (2,28--2,33)), (2,22--2,33)), (2,21--2,22), + Some (2,33--2,34), (2,21--2,34)) Target = None AppliesToGetterAndSetter = false - Range = (2,2--2,25) }] - Range = (2,0--2,27) }], (2,0--2,27)); + Range = (2,2--2,34) }] + Range = (2,0--2,36) }], (2,0--2,36)); Expr (Do (Const (Unit, (3,3--3,5)), (3,0--3,5)), (3,0--3,5))], PreXmlDocEmpty, [], None, (2,0--4,0), { LeadingKeyword = None })], (true, true), { ConditionalDirectives = [] diff --git a/tests/service/data/SyntaxTree/Attribute/RangeOfAttributeWithPath.fs.bsl b/tests/service/data/SyntaxTree/Attribute/RangeOfAttributeWithPath.fs.bsl index b8c9c031836..1de6ef8897c 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]) + TypeParams = None 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..0cb583b150e 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]) + TypeParams = None ArgExpr = Paren (App diff --git a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeBetweenLetKeywordAndPatternShouldBeIncludedInSynModuleDeclLet.fs.bsl b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeBetweenLetKeywordAndPatternShouldBeIncludedInSynModuleDeclLet.fs.bsl index 63b8a81ea59..fc7a043305c 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]) + TypeParams = None 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..00a0a489daf 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]) + TypeParams = None 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..95b996565ad 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]) + TypeParams = None 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..b8120e65eb7 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]) + TypeParams = None 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..d65b92f177e 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]) + TypeParams = None 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..5e41612fa57 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]) + TypeParams = None 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..82a89326cc1 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]) + TypeParams = None 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..da993e3a574 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]) + TypeParams = None 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..e469e293b3a 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]) + TypeParams = None 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..b65e44258e6 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]) + TypeParams = None 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..5a6b4c671dc 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]) + TypeParams = None ArgExpr = Const (Unit, (3,2--3,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..2080fc331b5 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]) + TypeParams = None ArgExpr = Paren (Tuple From cd393709d6ddaf02e02bc7263d73f7ac806d2157 Mon Sep 17 00:00:00 2001 From: Mackenzie F Libby Date: Fri, 24 May 2024 03:29:15 -0400 Subject: [PATCH 02/19] generalized basic parsing for type parameters on attributes --- src/Compiler/Checking/CheckExpressions.fs | 29 ++++++--- src/Compiler/SyntaxTree/SyntaxTree.fs | 2 +- src/Compiler/SyntaxTree/SyntaxTree.fsi | 2 +- src/Compiler/pars.fsy | 21 ++++--- ...ervice.SurfaceArea.netstandard20.debug.bsl | 4 +- ...vice.SurfaceArea.netstandard20.release.bsl | 4 +- .../SyntaxTree/Attribute/RangeOfAttribute.fs | 2 +- .../Attribute/RangeOfAttribute.fs.bsl | 22 +++---- .../Attribute/RangeOfAttributeWithPath.fs.bsl | 2 +- .../RangeOfAttributeWithTarget.fs.bsl | 2 +- ...nShouldBeIncludedInSynModuleDeclLet.fs.bsl | 2 +- ...BeIncludedInBindingOfSynExprObjExpr.fs.bsl | 2 +- ...dedInConstructorSynMemberDefnMember.fs.bsl | 2 +- ...tructorSynMemberDefnMemberOptAsSpec.fs.bsl | 2 +- ...edInFullSynMemberDefnMemberProperty.fs.bsl | 3 +- ...uldBeIncludedInSecondaryConstructor.fs.bsl | 2 +- ...eIncludedInSynMemberDefnLetBindings.fs.bsl | 2 +- ...ouldBeIncludedInSynMemberDefnMember.fs.bsl | 2 +- ...eShouldBeIncludedInSynModuleDeclLet.fs.bsl | 2 +- ...riteOnlySynMemberDefnMemberProperty.fs.bsl | 2 +- ...nModuleDeclLetBindingWithAttributes.fs.bsl | 2 +- .../Exception/Missing name 02.fs.bsl | 1 + .../Expression/SynExprObjWithSetter.fs.bsl | 1 + .../data/SyntaxTree/Extern/Extern 01.fs.bsl | 2 +- ...eTupleInMeasureTypeWithLeadingSlash.fs.bsl | 1 + ...TypeTupleInMeasureTypeWithNoSlashes.fs.bsl | 1 + ...TupleInMeasureTypeWithStartAndSlash.fs.bsl | 1 + .../data/SyntaxTree/Member/Field 15.fs.bsl | 1 + .../Member/Member - Attributes 01.fs.bsl | 3 + .../data/SyntaxTree/Member/Member 01.fs.bsl | 3 + .../data/SyntaxTree/Member/Member 02.fs.bsl | 3 + .../data/SyntaxTree/Member/Member 03.fs.bsl | 3 + .../data/SyntaxTree/Member/Member 04.fs.bsl | 3 + .../data/SyntaxTree/Member/Member 05.fs.bsl | 3 + .../data/SyntaxTree/Member/Member 06.fs.bsl | 3 + .../data/SyntaxTree/Member/Member 07.fs.bsl | 3 + .../data/SyntaxTree/Member/Static 02.fs.bsl | 3 + .../data/SyntaxTree/Member/Static 03.fs.bsl | 3 + .../Module - Attribute 01.fs.bsl | 1 + ...leRangeShouldStartAtFirstAttribute.fsi.bsl | 1 + ...IncludedInSynModuleDeclNestedModule.fs.bsl | 1 + ...udedInSynModuleSigDeclNestedModule.fsi.bsl | 1 + ...ShouldEndAtTheLastSynModuleSigDecl.fsi.bsl | 8 +++ .../OperatorNameInValConstraint.fsi.bsl | 1 + ...xceptionDefnReprAndSynExceptionSig.fsi.bsl | 2 + ...teShouldBeIncludedInSynTypeDefnSig.fsi.bsl | 1 + ...uldBeIncludedInSynValSpfnAndMember.fsi.bsl | 1 + ...esShouldBeIncludedInRecursiveTypes.fsi.bsl | 1 + .../ValKeywordIsPresentInSynValSig.fsi.bsl | 1 + .../SimplePats/SimplePats - Recover 01.fs.bsl | 6 ++ .../SimplePats/SimplePats 01.fs.bsl | 6 ++ .../SimplePats/SimplePats 02.fs.bsl | 4 ++ ...sIncludeLeadingParameterAttributes.fsi.bsl | 4 ++ ...butesInOptionalNamedMemberParameter.fs.bsl | 4 ++ .../data/SyntaxTree/Type/Class 05.fs.bsl | 2 + ...ributeShouldBeIncludedInSynTypeDefn.fs.bsl | 1 + ...tesShouldBeIncludedInRecursiveTypes.fs.bsl | 4 ++ ...uteContainsTheRangeOfTheTypeKeyword.fs.bsl | 1 + .../SyntaxTree/TypeParameters/Attribute.fs | 4 ++ .../TypeParameters/Attribute.fs.bsl | 41 +++++++++++++ .../TypeParameters/MethodDefAndUse.fs | 3 + .../TypeParameters/MethodDefAndUse.fs.bsl | 51 ++++++++++++++++ .../TypeParameters/TypeDefAndApp.fs | 4 ++ .../TypeParameters/TypeDefAndApp.fs.bsl | 59 +++++++++++++++++++ 64 files changed, 317 insertions(+), 47 deletions(-) create mode 100644 tests/service/data/SyntaxTree/TypeParameters/Attribute.fs create mode 100644 tests/service/data/SyntaxTree/TypeParameters/Attribute.fs.bsl create mode 100644 tests/service/data/SyntaxTree/TypeParameters/MethodDefAndUse.fs create mode 100644 tests/service/data/SyntaxTree/TypeParameters/MethodDefAndUse.fs.bsl create mode 100644 tests/service/data/SyntaxTree/TypeParameters/TypeDefAndApp.fs create mode 100644 tests/service/data/SyntaxTree/TypeParameters/TypeDefAndApp.fs.bsl diff --git a/src/Compiler/Checking/CheckExpressions.fs b/src/Compiler/Checking/CheckExpressions.fs index 03436903d0c..3c626f786a3 100644 --- a/src/Compiler/Checking/CheckExpressions.fs +++ b/src/Compiler/Checking/CheckExpressions.fs @@ -962,7 +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]) - TypeParams = None + TypeParams = [] ArgExpr=mkSynUnit m Target=None AppliesToGetterAndSetter=false @@ -11068,15 +11068,30 @@ and TcAttributeEx canFail (cenv: cenv) (env: TcEnv) attrTgt attrEx (synAttr: Syn let (SynLongIdent(tycon, _, _)) = synAttr.TypeName let arg = synAttr.ArgExpr - let (TyparsAndConstraints(synTyparDecls, synTyparConstraints)) = synAttr.TypeParams - let declaredTypars = TcTyparDecls cenv env synTyparDecls + let paramSynTypes = synAttr.TypeParams + //check type parameters. tpenv remains empty if synAttr.TypeParams = [] + // let paramTTypes, tpenv = + // List.mapFold ( + // fun typeParameterEnv -> + // TcTypeOrMeasure + // (Some TyparKind.Type) + // cenv + // ImplicitlyBoundTyparsAllowed.NewTyparsOKButWarnIfNotRigid + // CheckConstraints.CheckCxs + // ItemOccurence.Open + // WarnOnIWSAM.Yes + // env + // typeParameterEnv ) + // emptyUnscopedTyparEnv + // synAttr.TypeParams + let tyParEnv = emptyUnscopedTyparEnv let targetIndicator = synAttr.Target let isAppliedToGetterOrSetter = synAttr.AppliesToGetterAndSetter let mAttr = synAttr.Range let typath, tyid = List.frontAndBack tycon let ad = env.eAccessRights - let envinner = AddDeclaredTypars CheckForDuplicateTypars declaredTypars env - let tpenv = TcTyparConstraints cenv ImplicitlyBoundTyparsAllowed.NewTyparsOK CheckConstraints.CheckCxs ItemOccurence.UseInAttribute envinner emptyUnscopedTyparEnv synTyparConstraints + // let envinner = AddDeclaredTypars CheckForDuplicateTypars declaredTypars env + // let tpenv = TcTyparConstraints cenv ImplicitlyBoundTyparsAllowed.NewTyparsOK CheckConstraints.CheckCxs ItemOccurence.UseInAttribute envinner emptyUnscopedTyparEnv synTyparConstraints // 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 @@ -11086,9 +11101,9 @@ and TcAttributeEx canFail (cenv: cenv) (env: TcEnv) attrTgt attrEx (synAttr: Syn let tycon = (typath @ [tyid]) - match ResolveTypeLongIdent cenv.tcSink cenv.nameResolver ItemOccurence.UseInAttribute OpenQualified env.eNameResEnv ad tycon (TypeNameResolutionStaticArgsInfo.FromTyArgs declaredTypars.Length) 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 tyParEnv mAttr tcref tinstEnclosing paramSynTypes inst) ForceRaise ((try1 (tyid.idText + "Attribute")) |> otherwise (fun () -> (try1 tyid.idText))) diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fs b/src/Compiler/SyntaxTree/SyntaxTree.fs index 845d5b96e5a..81bff5177c4 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fs +++ b/src/Compiler/SyntaxTree/SyntaxTree.fs @@ -1043,7 +1043,7 @@ type SynAttribute = { TypeName: SynLongIdent - TypeParams: SynTyparDecls option + TypeParams: SynType list ArgExpr: SynExpr diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fsi b/src/Compiler/SyntaxTree/SyntaxTree.fsi index e5266ec5115..453db796006 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTree.fsi @@ -1171,7 +1171,7 @@ type SynAttribute = TypeName: SynLongIdent /// The type parameters of the attribute. - TypeParams: SynTyparDecls option + TypeParams: SynType list /// The argument of the attribute, perhaps a tuple ArgExpr: SynExpr diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index c614f81911c..edc4c42287a 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -1508,20 +1508,27 @@ attributeListElements: /* One custom attribute */ attribute: /* A custom attribute with generic type parameters - some.good.AttributeName<^SomeTypar>(and, args)opt_HIGH_PRECEDENCE_APP + some.good.AttributeName<^SomeTyPar>(and, args)opt_HIGH_PRECEDENCE_APP HIGH_PRECEDENCE_PAREN_APP */ - | path postfixTyparDecls HIGH_PRECEDENCE_PAREN_APP opt_atomicExprAfterType - { let arg = match $4 with None -> mkSynUnit $1.Range | Some e -> e + // | path postfixTyparDecls HIGH_PRECEDENCE_PAREN_APP opt_atomicExprAfterType + // { let arg = match $4 with None -> mkSynUnit $1.Range | Some e -> e + // debugPrint("\nWe managed to get in here....\n") + // let m = unionRanges $1.Range arg.Range + // ({ TypeName = $1; ArgExpr = arg; TypeParams = Some ($2); Target = None; AppliesToGetterAndSetter = false; Range = m }: SynAttribute) } + + | path HIGH_PRECEDENCE_TYAPP typeArgsActual opt_HIGH_PRECEDENCE_APP opt_atomicExprAfterType + { let arg = match $5 with None -> mkSynUnit $1.Range | Some e -> e debugPrint("\nWe managed to get in here....\n") let m = unionRanges $1.Range arg.Range - ({ TypeName = $1; ArgExpr = arg; TypeParams = Some ($2); Target = None; AppliesToGetterAndSetter = false; Range = m }: SynAttribute) } + let mLessThan, mGreaterThan, _, args, commas, mAll = $3 + ({ TypeName = $1; ArgExpr = arg; TypeParams = args; Target = None; AppliesToGetterAndSetter = false; Range = m }: SynAttribute) } /* 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; TypeParams = None; Target = None; AppliesToGetterAndSetter = false; Range = m }: SynAttribute) } + ({ TypeName = $1; ArgExpr = arg; TypeParams = []; Target = None; AppliesToGetterAndSetter = false; Range = m }: SynAttribute) } /* A custom attribute with an attribute target */ @@ -1529,14 +1536,14 @@ attribute: { 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; TypeParams = None; Target = $1; AppliesToGetterAndSetter = false; Range = m }: SynAttribute) } + ({ TypeName = $2; ArgExpr = arg; TypeParams = []; 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; TypeParams = None; Target = $1; AppliesToGetterAndSetter = false; Range = m }: SynAttribute) } + ({ TypeName = $3; ArgExpr = arg; TypeParams = []; Target = $1; AppliesToGetterAndSetter = false; Range = m }: SynAttribute) } /* The target of a custom attribute */ 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..90928ca9fa8 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 @@ -6283,10 +6283,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] TypeParams +FSharp.Compiler.Syntax.SynAttribute: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType] get_TypeParams() 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..90928ca9fa8 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 @@ -6283,10 +6283,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] TypeParams +FSharp.Compiler.Syntax.SynAttribute: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType] get_TypeParams() 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/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs b/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs index 31b13d14285..78fa629708b 100644 --- a/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs +++ b/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs @@ -1,3 +1,3 @@ -[(foo = "bar")>] +[(foo = "bar")>] do () diff --git a/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs.bsl b/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs.bsl index c0d50318ed6..1d771c0b803 100644 --- a/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs.bsl +++ b/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs.bsl @@ -8,14 +8,8 @@ ImplFile ([{ Attributes = [{ TypeName = SynLongIdent ([MyAttribute], [], [None]) TypeParams = - Some - (PostfixList - ([SynTyparDecl - ([], SynTypar (T, HeadType, false), [], - { AmpersandRanges = [] }); - SynTyparDecl - ([], SynTypar (S, HeadType, false), [], - { AmpersandRanges = [] })], [], (2,13--2,21))) + [Var (SynTypar (T, HeadType, false), (2,14--2,16)); + LongIdent (SynLongIdent ([int], [], [None]))] ArgExpr = Paren (App @@ -27,15 +21,15 @@ ImplFile SynLongIdent ([op_Equality], [], [Some (OriginalNotation "=")]), None, - (2,26--2,27)), Ident foo, (2,22--2,27)), + (2,27--2,28)), Ident foo, (2,23--2,28)), Const - (String ("bar", Regular, (2,28--2,33)), - (2,28--2,33)), (2,22--2,33)), (2,21--2,22), - Some (2,33--2,34), (2,21--2,34)) + (String ("bar", Regular, (2,29--2,34)), + (2,29--2,34)), (2,23--2,34)), (2,22--2,23), + Some (2,34--2,35), (2,22--2,35)) Target = None AppliesToGetterAndSetter = false - Range = (2,2--2,34) }] - Range = (2,0--2,36) }], (2,0--2,36)); + Range = (2,2--2,35) }] + Range = (2,0--2,37) }], (2,0--2,37)); Expr (Do (Const (Unit, (3,3--3,5)), (3,0--3,5)), (3,0--3,5))], PreXmlDocEmpty, [], None, (2,0--4,0), { LeadingKeyword = None })], (true, true), { ConditionalDirectives = [] diff --git a/tests/service/data/SyntaxTree/Attribute/RangeOfAttributeWithPath.fs.bsl b/tests/service/data/SyntaxTree/Attribute/RangeOfAttributeWithPath.fs.bsl index 1de6ef8897c..945a993b07a 100644 --- a/tests/service/data/SyntaxTree/Attribute/RangeOfAttributeWithPath.fs.bsl +++ b/tests/service/data/SyntaxTree/Attribute/RangeOfAttributeWithPath.fs.bsl @@ -9,7 +9,7 @@ ImplFile [{ TypeName = SynLongIdent ([Prefix; MyAttribute], [(2,8--2,9)], [None; None]) - TypeParams = None + TypeParams = [] ArgExpr = Paren (App diff --git a/tests/service/data/SyntaxTree/Attribute/RangeOfAttributeWithTarget.fs.bsl b/tests/service/data/SyntaxTree/Attribute/RangeOfAttributeWithTarget.fs.bsl index 0cb583b150e..132f11da3ac 100644 --- a/tests/service/data/SyntaxTree/Attribute/RangeOfAttributeWithTarget.fs.bsl +++ b/tests/service/data/SyntaxTree/Attribute/RangeOfAttributeWithTarget.fs.bsl @@ -7,7 +7,7 @@ ImplFile [Attributes ([{ Attributes = [{ TypeName = SynLongIdent ([MyAttribute], [], [None]) - TypeParams = None + TypeParams = [] ArgExpr = Paren (App diff --git a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeBetweenLetKeywordAndPatternShouldBeIncludedInSynModuleDeclLet.fs.bsl b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeBetweenLetKeywordAndPatternShouldBeIncludedInSynModuleDeclLet.fs.bsl index fc7a043305c..1003a9f2cd6 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeBetweenLetKeywordAndPatternShouldBeIncludedInSynModuleDeclLet.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeBetweenLetKeywordAndPatternShouldBeIncludedInSynModuleDeclLet.fs.bsl @@ -14,7 +14,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([Literal], [], [None]) - TypeParams = None + TypeParams = [] 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 00a0a489daf..d4ec37a81eb 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInBindingOfSynExprObjExpr.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInBindingOfSynExprObjExpr.fs.bsl @@ -18,7 +18,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = None + TypeParams = [] 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 95b996565ad..7483326488d 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInConstructorSynMemberDefnMember.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInConstructorSynMemberDefnMember.fs.bsl @@ -20,7 +20,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = None + TypeParams = [] 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 b8120e65eb7..b407d1fcc54 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInConstructorSynMemberDefnMemberOptAsSpec.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInConstructorSynMemberDefnMemberOptAsSpec.fs.bsl @@ -21,7 +21,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = None + TypeParams = [] 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 d65b92f177e..94cc1e79115 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInFullSynMemberDefnMemberProperty.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInFullSynMemberDefnMemberProperty.fs.bsl @@ -23,7 +23,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = None + TypeParams = [] ArgExpr = Const (Unit, (3,6--3,9)) Target = None AppliesToGetterAndSetter = false @@ -61,6 +61,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeParams = [] 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 5e41612fa57..d0ca446e719 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSecondaryConstructor.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSecondaryConstructor.fs.bsl @@ -77,7 +77,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = None + TypeParams = [] 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 82a89326cc1..32a8abf7178 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSynMemberDefnLetBindings.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSynMemberDefnLetBindings.fs.bsl @@ -20,7 +20,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = None + TypeParams = [] 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 da993e3a574..6250204a7b1 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSynMemberDefnMember.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSynMemberDefnMember.fs.bsl @@ -20,7 +20,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = None + TypeParams = [] 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 e469e293b3a..54855ac33f6 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSynModuleDeclLet.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSynModuleDeclLet.fs.bsl @@ -12,7 +12,7 @@ ImplFile [SynBinding (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = None + TypeParams = [] 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 b65e44258e6..72f0a718641 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInWriteOnlySynMemberDefnMemberProperty.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInWriteOnlySynMemberDefnMemberProperty.fs.bsl @@ -24,7 +24,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = None + TypeParams = [] 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 5a6b4c671dc..bc44c5dc1a2 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfLetKeywordShouldBePresentInSynModuleDeclLetBindingWithAttributes.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfLetKeywordShouldBePresentInSynModuleDeclLetBindingWithAttributes.fs.bsl @@ -14,7 +14,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([SomeAttribute], [], [None]) - TypeParams = None + TypeParams = [] 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..d4998bfeb8e 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]) + TypeParams = [] 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..047cbc57e9b 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]) + TypeParams = [] 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 2080fc331b5..43fcae41edb 100644 --- a/tests/service/data/SyntaxTree/Extern/Extern 01.fs.bsl +++ b/tests/service/data/SyntaxTree/Extern/Extern 01.fs.bsl @@ -9,7 +9,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([DllImport], [], [None]) - TypeParams = None + TypeParams = [] 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..4de8b55608e 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]) + TypeParams = [] 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..722e92e5282 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]) + TypeParams = [] 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..b57801fb95e 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]) + TypeParams = [] 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..858fbad890f 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]) + TypeParams = [] 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..5fa6fe740b8 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]) + TypeParams = [] 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]) + TypeParams = [] 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]) + TypeParams = [] 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..d22c3c89290 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]) + TypeParams = [] 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]) + TypeParams = [] 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]) + TypeParams = [] 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..5237d9f9e71 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]) + TypeParams = [] 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]) + TypeParams = [] 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]) + TypeParams = [] 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..d795f4c31c5 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]) + TypeParams = [] 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]) + TypeParams = [] 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]) + TypeParams = [] 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..ce351c3ea02 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]) + TypeParams = [] 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]) + TypeParams = [] 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]) + TypeParams = [] 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..908578f5eb4 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]) + TypeParams = [] 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]) + TypeParams = [] 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]) + TypeParams = [] 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..ebeb4578236 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]) + TypeParams = [] 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]) + TypeParams = [] 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]) + TypeParams = [] 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..8b7f6fc5035 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]) + TypeParams = [] 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]) + TypeParams = [] 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]) + TypeParams = [] 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..1a774c155c8 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]) + TypeParams = [] 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]) + TypeParams = [] 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]) + TypeParams = [] 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..35a476f563c 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]) + TypeParams = [] 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]) + TypeParams = [] 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]) + TypeParams = [] 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..67059db1aeb 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]) + TypeParams = [] 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..04ac9b3c5bc 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]) + TypeParams = [] 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..5bd22ebc0ec 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]) + TypeParams = [] 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..f7bc8a5ec97 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]) + TypeParams = [] 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..f48513ebd84 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]) + TypeParams = [] ArgExpr = Const (Unit, (27,6--27,24)) Target = None AppliesToGetterAndSetter = false @@ -241,6 +242,7 @@ SigFile { TypeName = SynLongIdent ([StructuralComparison], [], [None]) + TypeParams = [] ArgExpr = Const (Unit, (27,26--27,46)) Target = None AppliesToGetterAndSetter = false @@ -249,6 +251,7 @@ SigFile { Attributes = [{ TypeName = SynLongIdent ([CompiledName], [], [None]) + TypeParams = [] ArgExpr = Paren (Const @@ -387,6 +390,7 @@ SigFile (SynComponentInfo ([{ Attributes = [{ TypeName = SynLongIdent ([AutoOpen], [], [None]) + TypeParams = [] ArgExpr = Const (Unit, (46,2--46,10)) Target = None AppliesToGetterAndSetter = false @@ -412,6 +416,7 @@ SigFile ([{ Attributes = [{ TypeName = SynLongIdent ([CompiledName], [], [None]) + TypeParams = [] ArgExpr = Paren (Const @@ -446,6 +451,7 @@ SigFile ([{ Attributes = [{ TypeName = SynLongIdent ([CompiledName], [], [None]) + TypeParams = [] ArgExpr = Paren (Const @@ -480,6 +486,7 @@ SigFile ([{ Attributes = [{ TypeName = SynLongIdent ([CompiledName], [], [None]) + TypeParams = [] ArgExpr = Paren (Const @@ -513,6 +520,7 @@ SigFile ([{ Attributes = [{ TypeName = SynLongIdent ([CompiledName], [], [None]) + TypeParams = [] 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..0b86d093bdd 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]) + TypeParams = [] 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..4a097b7e5f9 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]) + TypeParams = [] ArgExpr = Const (Unit, (5,2--5,12)) Target = None AppliesToGetterAndSetter = false Range = (5,2--5,12) }; { TypeName = SynLongIdent ([NoComparison], [], [None]) + TypeParams = [] 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..38dfd9df5dc 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]) + TypeParams = [] 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..a40f10639a6 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]) + TypeParams = [] 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..75ada66f812 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]) + TypeParams = [] 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..9dcd81dc9bd 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]) + TypeParams = [] 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..e5cfebf53a2 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]) + TypeParams = [] ArgExpr = Const (Unit, (5,15--5,18)) Target = None AppliesToGetterAndSetter = false @@ -96,6 +97,7 @@ ImplFile SynArgInfo ([{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeParams = [] 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]) + TypeParams = [] 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]) + TypeParams = [] ArgExpr = Const (Unit, (5,28--5,31)) Target = None AppliesToGetterAndSetter = false @@ -142,6 +146,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeParams = [] ArgExpr = Const (Unit, (5,15--5,18)) Target = None AppliesToGetterAndSetter = false @@ -157,6 +162,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeParams = [] 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..fbab96fa08a 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]) + TypeParams = [] ArgExpr = Const (Unit, (5,15--5,18)) Target = None AppliesToGetterAndSetter = false @@ -86,6 +87,7 @@ ImplFile SynArgInfo ([{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeParams = [] 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]) + TypeParams = [] 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]) + TypeParams = [] ArgExpr = Const (Unit, (5,28--5,31)) Target = None AppliesToGetterAndSetter = false @@ -130,6 +134,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeParams = [] ArgExpr = Const (Unit, (5,15--5,18)) Target = None AppliesToGetterAndSetter = false @@ -145,6 +150,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeParams = [] 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..442f5cc0502 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]) + TypeParams = [] ArgExpr = Const (Unit, (5,9--5,12)) Target = None AppliesToGetterAndSetter = false @@ -107,6 +108,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeParams = [] ArgExpr = Const (Unit, (5,22--5,25)) Target = None AppliesToGetterAndSetter = false @@ -128,6 +130,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeParams = [] ArgExpr = Const (Unit, (5,9--5,12)) Target = None AppliesToGetterAndSetter = false @@ -143,6 +146,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeParams = [] 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..91054c76dac 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]) + TypeParams = [] ArgExpr = Const (Unit, (3,16--3,29)) Target = None @@ -41,6 +42,7 @@ SigFile [{ TypeName = SynLongIdent ([OtherAttribute], [], [None]) + TypeParams = [] ArgExpr = Const (Unit, (3,38--3,52)) Target = None @@ -58,6 +60,7 @@ SigFile [{ TypeName = SynLongIdent ([SomeAttribute], [], [None]) + TypeParams = [] ArgExpr = Const (Unit, (3,16--3,29)) Target = None AppliesToGetterAndSetter = false @@ -68,6 +71,7 @@ SigFile [{ TypeName = SynLongIdent ([OtherAttribute], [], [None]) + TypeParams = [] 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..ddbbf9deb36 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]) + TypeParams = [] ArgExpr = Const (Unit, (3,25--3,28)) Target = None AppliesToGetterAndSetter = false Range = (3,25--3,28) }; { TypeName = SynLongIdent ([Bar], [], [None]) + TypeParams = [] ArgExpr = Const (Unit, (3,30--3,33)) Target = None AppliesToGetterAndSetter = false @@ -41,12 +43,14 @@ ImplFile ([{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) + TypeParams = [] ArgExpr = Const (Unit, (3,25--3,28)) Target = None AppliesToGetterAndSetter = false Range = (3,25--3,28) }; { TypeName = SynLongIdent ([Bar], [], [None]) + TypeParams = [] 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..9f1dba4a0d7 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]) + TypeParams = [] ArgExpr = Const (Unit, (3,9--3,10)) Target = None AppliesToGetterAndSetter = false @@ -28,6 +29,7 @@ ImplFile (None, [{ Attributes = [{ TypeName = SynLongIdent ([A], [], [None]) + TypeParams = [] 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..9e1c55e3632 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]) + TypeParams = [] 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..34a84ab7f68 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]) + TypeParams = [] ArgExpr = Const (Unit, (2,2--2,12)) Target = None AppliesToGetterAndSetter = false Range = (2,2--2,12) }; { TypeName = SynLongIdent ([NoComparison], [], [None]) + TypeParams = [] ArgExpr = Const (Unit, (2,15--2,27)) Target = None AppliesToGetterAndSetter = false @@ -64,11 +66,13 @@ ImplFile ([{ Attributes = [{ TypeName = SynLongIdent ([CustomEquality], [], [None]) + TypeParams = [] ArgExpr = Const (Unit, (6,6--6,20)) Target = None AppliesToGetterAndSetter = false Range = (6,6--6,20) }; { TypeName = SynLongIdent ([NoComparison], [], [None]) + TypeParams = [] 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..620bb5b1fe4 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]) + TypeParams = [] 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..df4a65d82ac --- /dev/null +++ b/tests/service/data/SyntaxTree/TypeParameters/Attribute.fs @@ -0,0 +1,4 @@ +type SomeThing<^S> = class end + +[> >] +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..9b8b7c1aa1f --- /dev/null +++ b/tests/service/data/SyntaxTree/TypeParameters/Attribute.fs.bsl @@ -0,0 +1,41 @@ +ImplFile + (ParsedImplFileInput + ("/root/TypeParameters/Attribute.fs", false, QualifiedNameOfFile Attribute, + [], [], + [SynModuleOrNamespace + ([Attribute], false, AnonModule, + [Types + ([SynTypeDefn + (SynComponentInfo + ([], + Some + (PostfixList + ([SynTyparDecl + ([], SynTypar (S, HeadType, false), [], + { AmpersandRanges = [] })], [], (1,14--1,18))), + [], [SomeThing], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), + true, None, (1,5--1,14)), + ObjectModel (Class, [], (1,21--1,30)), [], None, (1,5--1,30), + { LeadingKeyword = Type (1,0--1,4) + EqualsRange = Some (1,19--1,20) + WithKeyword = None })], (1,0--1,30)); + Attributes + ([{ Attributes = + [{ TypeName = SynLongIdent ([AGoodAttribute], [], [None]) + TypeParams = + [Var (SynTypar (A, HeadType, false), (3,17--3,19)); + App + (LongIdent (SynLongIdent ([SomeThing], [], [None])), + Some (3,30--3,31), + [LongIdent (SynLongIdent ([int], [], [None]))], [], + Some (3,34--3,35), false, (3,21--3,35))] + ArgExpr = Const (Unit, (3,2--3,16)) + Target = None + AppliesToGetterAndSetter = false + Range = (3,2--3,16) }] + Range = (3,0--3,39) }], (3,0--3,39)); + Expr (Do (Const (Unit, (4,2--4,4)), (4,0--4,4)), (4,0--4,4))], + PreXmlDocEmpty, [], None, (1,0--4,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..2f5935d6e4c --- /dev/null +++ b/tests/service/data/SyntaxTree/TypeParameters/TypeDefAndApp.fs @@ -0,0 +1,4 @@ +type AGoodType<^T, ^S>()= + class end + +let myInstance = 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..1937f0d082d --- /dev/null +++ b/tests/service/data/SyntaxTree/TypeParameters/TypeDefAndApp.fs.bsl @@ -0,0 +1,59 @@ +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)); + Let + (false, + [SynBinding + (None, Normal, false, false, [], + PreXmlDoc ((4,0), FSharp.Compiler.Xml.XmlDocCollector), + SynValData + (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Named (SynIdent (myInstance, None), false, None, (4,4--4,14)), + None, + App + (Atomic, false, + TypeApp + (Ident AGoodType, (4,26--4,27), + [Var (SynTypar (P, None, false), (4,27--4,29)); + LongIdent (SynLongIdent ([int], [], [None]))], + [(4,29--4,30)], Some (4,34--4,35), (4,26--4,35), + (4,17--4,35)), Const (Unit, (4,35--4,37)), (4,17--4,37)), + (4,4--4,14), Yes (4,0--4,37), + { LeadingKeyword = Let (4,0--4,3) + InlineKeyword = None + EqualsRange = Some (4,15--4,16) })], (4,0--4,37))], + PreXmlDocEmpty, [], None, (1,0--4,37), { LeadingKeyword = None })], + (true, true), { ConditionalDirectives = [] + CodeComments = [] }, set [])) From 006463432ed9869e135dfe6d1f34768e5d8f35fa Mon Sep 17 00:00:00 2001 From: mflibby Date: Sat, 25 May 2024 10:30:07 -0400 Subject: [PATCH 03/19] threading type parameters into type tree --- src/Compiler/Checking/AttributeChecking.fs | 7 ++++ src/Compiler/Checking/CheckExpressions.fs | 2 +- src/Compiler/Symbols/Symbols.fs | 6 +++- tests/service/Symbols.fs | 25 +++++++++++++++ .../TypeParameters/TypeDefAndApp.fs | 2 +- .../TypeParameters/TypeDefAndApp.fs.bsl | 32 ++++++------------- 6 files changed, 49 insertions(+), 25 deletions(-) diff --git a/src/Compiler/Checking/AttributeChecking.fs b/src/Compiler/Checking/AttributeChecking.fs index 2564a54bdd3..94dc6c432f1 100644 --- a/src/Compiler/Checking/AttributeChecking.fs +++ b/src/Compiler/Checking/AttributeChecking.fs @@ -92,6 +92,13 @@ type AttribInfo = | ILAttribInfo (g, amap, scoref, a, m) -> let ty = RescopeAndImportILType scoref amap m [] a.Method.DeclaringType tcrefOfAppTy g ty + + member x.TypeParams : TypeInst = [] + // match x with + // | FSAttribInfo(_g, Attrib(tcref, _, _, _, _, _, _)) -> tcref + // | ILAttribInfo (g, amap, scoref, a, m) -> + // let ty = RescopeAndImportILType scoref amap m [] a.Method.DeclaringType + // argsOfAppTy g ty member x.ConstructorArguments = match x with diff --git a/src/Compiler/Checking/CheckExpressions.fs b/src/Compiler/Checking/CheckExpressions.fs index 3c626f786a3..651d50f3723 100644 --- a/src/Compiler/Checking/CheckExpressions.fs +++ b/src/Compiler/Checking/CheckExpressions.fs @@ -11316,7 +11316,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/Symbols/Symbols.fs b/src/Compiler/Symbols/Symbols.fs index 19fbfe9306b..e14a296051e 100644 --- a/src/Compiler/Symbols/Symbols.fs +++ b/src/Compiler/Symbols/Symbols.fs @@ -2718,7 +2718,11 @@ type FSharpAttribute(cenv: SymbolEnv, attrib: AttribInfo) = | _ -> arg member _.AttributeType = - FSharpEntity(cenv, attrib.TyconRef) + FSharpEntity(cenv, attrib.TyconRef, []) + + // member _.GenericArguments = + // protect <| fun () -> + // (attrib.TypeParams |> List.map (fun ty -> FSharpType(cenv, ty)) |> makeReadOnlyCollection) member _.IsUnresolved = entityIsUnresolved(attrib.TyconRef) diff --git a/tests/service/Symbols.fs b/tests/service/Symbols.fs index a186b0b49f9..1d766e8f46b 100644 --- a/tests/service/Symbols.fs +++ b/tests/service/Symbols.fs @@ -265,6 +265,31 @@ 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 contents = System.IO.File.ReadAllText fileName + let parseResults = parseSourceCode(fileName, contents) + 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.Count |> shouldEqual 1) + module Types = [] let ``FSharpType.Print parent namespace qualifiers`` () = diff --git a/tests/service/data/SyntaxTree/TypeParameters/TypeDefAndApp.fs b/tests/service/data/SyntaxTree/TypeParameters/TypeDefAndApp.fs index 2f5935d6e4c..8c1e7167a0f 100644 --- a/tests/service/data/SyntaxTree/TypeParameters/TypeDefAndApp.fs +++ b/tests/service/data/SyntaxTree/TypeParameters/TypeDefAndApp.fs @@ -1,4 +1,4 @@ type AGoodType<^T, ^S>()= class end -let myInstance = AGoodType<'P, int>() \ No newline at end of file +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 index 1937f0d082d..865632f347a 100644 --- a/tests/service/data/SyntaxTree/TypeParameters/TypeDefAndApp.fs.bsl +++ b/tests/service/data/SyntaxTree/TypeParameters/TypeDefAndApp.fs.bsl @@ -33,27 +33,15 @@ ImplFile { LeadingKeyword = Type (1,0--1,4) EqualsRange = Some (1,24--1,25) WithKeyword = None })], (1,0--2,13)); - Let - (false, - [SynBinding - (None, Normal, false, false, [], - PreXmlDoc ((4,0), FSharp.Compiler.Xml.XmlDocCollector), - SynValData - (None, SynValInfo ([], SynArgInfo ([], false, None)), None), - Named (SynIdent (myInstance, None), false, None, (4,4--4,14)), - None, - App - (Atomic, false, - TypeApp - (Ident AGoodType, (4,26--4,27), - [Var (SynTypar (P, None, false), (4,27--4,29)); - LongIdent (SynLongIdent ([int], [], [None]))], - [(4,29--4,30)], Some (4,34--4,35), (4,26--4,35), - (4,17--4,35)), Const (Unit, (4,35--4,37)), (4,17--4,37)), - (4,4--4,14), Yes (4,0--4,37), - { LeadingKeyword = Let (4,0--4,3) - InlineKeyword = None - EqualsRange = Some (4,15--4,16) })], (4,0--4,37))], - PreXmlDocEmpty, [], None, (1,0--4,37), { LeadingKeyword = None })], + 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 [])) From cdb0974fc5040cec168c08dc23887df328f939a9 Mon Sep 17 00:00:00 2001 From: mflibby Date: Mon, 27 May 2024 23:56:04 -0400 Subject: [PATCH 04/19] fully threaded base implementation of generic attributes --- src/Compiler/AbstractIL/il.fs | 12 +- src/Compiler/AbstractIL/ilwrite.fs | 100 ++++++++++------- src/Compiler/Checking/AttributeChecking.fs | 38 +++---- src/Compiler/Checking/AttributeChecking.fsi | 1 + src/Compiler/Checking/CheckDeclarations.fs | 4 +- src/Compiler/Checking/CheckExpressions.fs | 22 ++-- src/Compiler/Checking/FindUnsolved.fs | 2 +- src/Compiler/Checking/NicePrint.fs | 2 +- src/Compiler/Checking/PostInferenceChecks.fs | 8 +- src/Compiler/Checking/SignatureConformance.fs | 10 +- src/Compiler/Checking/infos.fs | 4 +- src/Compiler/CodeGen/IlxGen.fs | 53 +++++---- src/Compiler/Driver/CreateILModule.fs | 6 +- src/Compiler/Service/IncrementalBuild.fs | 4 +- src/Compiler/Service/TransparentCompiler.fs | 2 +- src/Compiler/Symbols/Symbols.fs | 5 + src/Compiler/Symbols/Symbols.fsi | 2 + src/Compiler/SyntaxTree/SyntaxTree.fs | 2 +- src/Compiler/SyntaxTree/SyntaxTree.fsi | 2 +- src/Compiler/TypedTree/TcGlobals.fs | 6 +- src/Compiler/TypedTree/TypedTree.fs | 7 +- src/Compiler/TypedTree/TypedTree.fsi | 1 + src/Compiler/TypedTree/TypedTreeOps.fs | 29 ++--- src/Compiler/TypedTree/TypedTreePickle.fs | 12 +- .../EmittedIL/Attribute/Attribute.fs | 30 +++++ .../Attribute/AttributeWithTypeParam.fs | 8 ++ ...peParam.fs.RealInternalSignatureOff.il.bsl | 103 ++++++++++++++++++ ...ypeParam.fs.RealInternalSignatureOn.il.bsl | 89 +++++++++++++++ .../CompilerGeneratedAttributeOnAccessors.fs | 2 +- .../FSharp.Compiler.ComponentTests.fsproj | 4 +- ...vice.SurfaceArea.netstandard20.release.bsl | 2 + tests/FSharp.Test.Utilities/SurfaceArea.fs | 2 +- tests/service/Symbols.fs | 7 +- 33 files changed, 438 insertions(+), 143 deletions(-) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/Attribute.fs create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/AttributeWithTypeParam.fs create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/AttributeWithTypeParam.fs.RealInternalSignatureOff.il.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/AttributeWithTypeParam.fs.RealInternalSignatureOn.il.bsl diff --git a/src/Compiler/AbstractIL/il.fs b/src/Compiler/AbstractIL/il.fs index 48cee265fdc..4dfce19b0df 100644 --- a/src/Compiler/AbstractIL/il.fs +++ b/src/Compiler/AbstractIL/il.fs @@ -3150,7 +3150,7 @@ let mkILMethRef (tref, callconv, nm, numGenericParams, argTys, retTy) = } let mkILMethSpecForMethRefInTy (mref, ty, methInst) = - { + { mspecMethodRef = mref mspecDeclaringType = ty mspecMethodInst = methInst @@ -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..258e68afdcb 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) + //tenv // -------------------------------------------------------------------- // 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 @@ -1922,6 +1941,7 @@ module Codebuf = | Unaligned4 -> emitInstrCode codebuf i_unaligned; codebuf.EmitByte 0x4 let rec emitInstr cenv codebuf env instr = + //printfn "%A" instr match instr with | si when isNoArgInstr si -> emitInstrCode codebuf (encodingsOfNoArgInstr si) @@ -2347,14 +2367,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 +2481,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 +2562,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 +2587,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 +2614,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 +2726,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 +2816,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 +2842,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 +2876,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 +2903,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 +2948,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 +2966,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 +3003,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 +3065,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 94dc6c432f1..1ad38f8a8d1 100644 --- a/src/Compiler/Checking/AttributeChecking.fs +++ b/src/Compiler/Checking/AttributeChecking.fs @@ -88,21 +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.TypeParams : TypeInst = [] - // match x with - // | FSAttribInfo(_g, Attrib(tcref, _, _, _, _, _, _)) -> tcref - // | ILAttribInfo (g, amap, scoref, a, m) -> - // let ty = RescopeAndImportILType scoref amap m [] a.Method.DeclaringType - // argsOfAppTy 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 @@ -117,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 @@ -225,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. @@ -278,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 @@ -291,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 @@ -309,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 @@ -358,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. @@ -366,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. @@ -533,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, _, _, _, _, _, _, _)) m = // There's no CAS on Silverlight, so we have to be careful here match g.attrib_SecurityAttribute with | None -> false @@ -549,11 +549,11 @@ let IsSecurityAttribute (g: TcGlobals) amap (casmap : IDictionary) 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..8601b30cfe8 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, _, _typeParams, [ 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 522f039df9f..4f13a61dd4a 100644 --- a/src/Compiler/Checking/CheckExpressions.fs +++ b/src/Compiler/Checking/CheckExpressions.fs @@ -962,7 +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]) - TypeParams = [] + TypeArgs = [] ArgExpr=mkSynUnit m Target=None AppliesToGetterAndSetter=false @@ -1278,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) = @@ -10785,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 @@ -11094,7 +11094,7 @@ and TcAttributeEx canFail (cenv: cenv) (env: TcEnv) attrTgt attrEx (synAttr: Syn let (SynLongIdent(tycon, _, _)) = synAttr.TypeName let arg = synAttr.ArgExpr - let paramSynTypes = synAttr.TypeParams + let paramSynTypes = synAttr.TypeArgs //check type parameters. tpenv remains empty if synAttr.TypeParams = [] // let paramTTypes, tpenv = // List.mapFold ( @@ -11164,11 +11164,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)) @@ -11259,11 +11259,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, _, _, _)), _formalType, _typeArgs, args, _range) -> 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)) 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..63466e30900 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, _typeParams, args, props, _, _, m)) = let props = props |> List.map (fun (AttribNamedArg(s, ty, fld, AttribExpr(_, expr))) -> @@ -9966,17 +9966,32 @@ and GenAttr cenv g eenv (Attrib(_, k, args, props, _, _, _)) = let ilTy = GenType cenv m eenv.tyenv ty let cval = GenAttribArg cenv g eenv expr ilTy (s, ilTy, fld, cval)) - + let ilTyArgs = GenTypeArgs cenv m eenv.tyenv _typeParams 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 +10023,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 +10993,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 +11408,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 +11437,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/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/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 e14a296051e..9c579849354 100644 --- a/src/Compiler/Symbols/Symbols.fs +++ b/src/Compiler/Symbols/Symbols.fs @@ -2731,6 +2731,11 @@ type FSharpAttribute(cenv: SymbolEnv, attrib: AttribInfo) = |> List.map (fun (ty, obj) -> FSharpType(cenv, ty), resolveArgObj obj) |> makeReadOnlyCollection + member _.TypeParameters = + 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..3ff642994a7 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 TypeParameters: IList + /// The named arguments for the attribute member NamedArguments: IList diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fs b/src/Compiler/SyntaxTree/SyntaxTree.fs index 81bff5177c4..3eebd888461 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fs +++ b/src/Compiler/SyntaxTree/SyntaxTree.fs @@ -1043,7 +1043,7 @@ type SynAttribute = { TypeName: SynLongIdent - TypeParams: SynType list + TypeArgs: SynType list ArgExpr: SynExpr diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fsi b/src/Compiler/SyntaxTree/SyntaxTree.fsi index 453db796006..65404f45188 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTree.fsi @@ -1171,7 +1171,7 @@ type SynAttribute = TypeName: SynLongIdent /// The type parameters of the attribute. - TypeParams: SynType list + 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..4ffe4c7c466 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_tup7 (p_tcref "attrib") p_attribkind (p_list p_ty) (p_list p_attrib_expr) (p_list p_attrib_arg) p_bool p_dummy_range (a, b, _tyArgs, 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 and u_attrib_expr st = let a, b = u_tup2 u_expr u_expr st 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..da980c345e1 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/Attribute.fs @@ -0,0 +1,30 @@ +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 + + [] + let ``AttributeWithTypeParam_RealInternalSignatureOn_fs`` compilation = + compilation + |> withRealInternalSignatureOn + |> verifyCompilation + + [] + let ``AttributeWithTypeParam_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..3fa9806527e --- /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/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..470c7aa94b7 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,6 @@ - - %(RelativeDir)TestSource\%(Filename)%(Extension) - %(RelativeDir)\BaseLine\%(Filename)%(Extension) 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 90928ca9fa8..f661b965bd0 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] TypeParameters +FSharp.Compiler.Symbols.FSharpAttribute: System.Collections.Generic.IList`1[FSharp.Compiler.Symbols.FSharpType] get_TypeParameters() 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 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/Symbols.fs b/tests/service/Symbols.fs index 1d766e8f46b..52823e65541 100644 --- a/tests/service/Symbols.fs +++ b/tests/service/Symbols.fs @@ -280,7 +280,7 @@ let x = 123 """ let fileName, options = mkTestFileAndOptions source [| "--noconditionalerasure" |] let contents = System.IO.File.ReadAllText fileName - let parseResults = parseSourceCode(fileName, contents) + let parseResults = parseSourceCode(fileName, source) let _, checkResults = parseAndCheckFile fileName source options checkResults.GetAllUsesOfAllSymbolsInFile() @@ -288,7 +288,10 @@ let x = 123 |> 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.Count |> shouldEqual 1) + |> Option.iter (fun symbol -> + let a = symbol.Attributes[0].TypeParameters[0] + Assert.AreEqual(a.AbbreviatedType.TypeDefinition.CompiledName, "Int32") + ) module Types = [] From 799ad54f0ef8ce973c83d1c260c4ad4944adb90e Mon Sep 17 00:00:00 2001 From: Mackenzie F Libby Date: Tue, 28 May 2024 00:57:09 -0400 Subject: [PATCH 05/19] updating originally named TypeParam to TypeArg (for attr types) to align with apparent standard --- src/Compiler/Symbols/Symbols.fs | 2 +- src/Compiler/Symbols/Symbols.fsi | 2 +- src/Compiler/TypedTree/TypedTreePickle.fs | 8 ++++---- src/Compiler/pars.fsy | 16 +++++----------- .../FSharp.Compiler.ComponentTests.fsproj | 3 +++ tests/service/Symbols.fs | 2 +- .../SyntaxTree/Attribute/RangeOfAttribute.fs | 2 +- .../SyntaxTree/Attribute/RangeOfAttribute.fs.bsl | 2 +- .../Attribute/RangeOfAttributeWithPath.fs.bsl | 2 +- .../Attribute/RangeOfAttributeWithTarget.fs.bsl | 2 +- ...ternShouldBeIncludedInSynModuleDeclLet.fs.bsl | 2 +- ...uldBeIncludedInBindingOfSynExprObjExpr.fs.bsl | 2 +- ...cludedInConstructorSynMemberDefnMember.fs.bsl | 2 +- ...onstructorSynMemberDefnMemberOptAsSpec.fs.bsl | 2 +- ...ludedInFullSynMemberDefnMemberProperty.fs.bsl | 4 ++-- ...ShouldBeIncludedInSecondaryConstructor.fs.bsl | 2 +- ...ldBeIncludedInSynMemberDefnLetBindings.fs.bsl | 2 +- ...eShouldBeIncludedInSynMemberDefnMember.fs.bsl | 2 +- ...buteShouldBeIncludedInSynModuleDeclLet.fs.bsl | 2 +- ...InWriteOnlySynMemberDefnMemberProperty.fs.bsl | 2 +- ...nSynModuleDeclLetBindingWithAttributes.fs.bsl | 2 +- .../SyntaxTree/Exception/Missing name 02.fs.bsl | 2 +- .../Expression/SynExprObjWithSetter.fs.bsl | 2 +- .../data/SyntaxTree/Extern/Extern 01.fs.bsl | 2 +- ...TypeTupleInMeasureTypeWithLeadingSlash.fs.bsl | 2 +- ...SynTypeTupleInMeasureTypeWithNoSlashes.fs.bsl | 2 +- ...ypeTupleInMeasureTypeWithStartAndSlash.fs.bsl | 2 +- .../data/SyntaxTree/Member/Field 15.fs.bsl | 2 +- .../Member/Member - Attributes 01.fs.bsl | 6 +++--- .../data/SyntaxTree/Member/Member 01.fs.bsl | 6 +++--- .../data/SyntaxTree/Member/Member 02.fs.bsl | 6 +++--- .../data/SyntaxTree/Member/Member 03.fs.bsl | 6 +++--- .../data/SyntaxTree/Member/Member 04.fs.bsl | 6 +++--- .../data/SyntaxTree/Member/Member 05.fs.bsl | 6 +++--- .../data/SyntaxTree/Member/Member 06.fs.bsl | 6 +++--- .../data/SyntaxTree/Member/Member 07.fs.bsl | 6 +++--- .../data/SyntaxTree/Member/Static 02.fs.bsl | 6 +++--- .../data/SyntaxTree/Member/Static 03.fs.bsl | 6 +++--- .../Module - Attribute 01.fs.bsl | 2 +- ...oduleRangeShouldStartAtFirstAttribute.fsi.bsl | 2 +- ...dBeIncludedInSynModuleDeclNestedModule.fs.bsl | 2 +- ...ncludedInSynModuleSigDeclNestedModule.fsi.bsl | 2 +- ...ileShouldEndAtTheLastSynModuleSigDecl.fsi.bsl | 16 ++++++++-------- .../OperatorNameInValConstraint.fsi.bsl | 2 +- ...ynExceptionDefnReprAndSynExceptionSig.fsi.bsl | 4 ++-- ...ibuteShouldBeIncludedInSynTypeDefnSig.fsi.bsl | 2 +- ...ShouldBeIncludedInSynValSpfnAndMember.fsi.bsl | 2 +- ...butesShouldBeIncludedInRecursiveTypes.fsi.bsl | 2 +- .../ValKeywordIsPresentInSynValSig.fsi.bsl | 2 +- .../SimplePats/SimplePats - Recover 01.fs.bsl | 12 ++++++------ .../SyntaxTree/SimplePats/SimplePats 01.fs.bsl | 12 ++++++------ .../SyntaxTree/SimplePats/SimplePats 02.fs.bsl | 8 ++++---- ...DoesIncludeLeadingParameterAttributes.fsi.bsl | 8 ++++---- ...tributesInOptionalNamedMemberParameter.fs.bsl | 8 ++++---- .../service/data/SyntaxTree/Type/Class 05.fs.bsl | 4 ++-- ...AttributeShouldBeIncludedInSynTypeDefn.fs.bsl | 2 +- ...ibutesShouldBeIncludedInRecursiveTypes.fs.bsl | 8 ++++---- ...ributeContainsTheRangeOfTheTypeKeyword.fs.bsl | 2 +- .../SyntaxTree/TypeParameters/Attribute.fs.bsl | 2 +- 59 files changed, 120 insertions(+), 123 deletions(-) diff --git a/src/Compiler/Symbols/Symbols.fs b/src/Compiler/Symbols/Symbols.fs index 9c579849354..c994db6a263 100644 --- a/src/Compiler/Symbols/Symbols.fs +++ b/src/Compiler/Symbols/Symbols.fs @@ -2731,7 +2731,7 @@ type FSharpAttribute(cenv: SymbolEnv, attrib: AttribInfo) = |> List.map (fun (ty, obj) -> FSharpType(cenv, ty), resolveArgObj obj) |> makeReadOnlyCollection - member _.TypeParameters = + member _.TypeArgs = attrib.TypeArgs |> List.map (fun (ty) -> FSharpType(cenv, ty)) |> makeReadOnlyCollection diff --git a/src/Compiler/Symbols/Symbols.fsi b/src/Compiler/Symbols/Symbols.fsi index 3ff642994a7..3933048e956 100644 --- a/src/Compiler/Symbols/Symbols.fsi +++ b/src/Compiler/Symbols/Symbols.fsi @@ -1185,7 +1185,7 @@ type FSharpAttribute = /// The arguments to the constructor for the attribute member ConstructorArguments: IList - member TypeParameters: IList + member TypeArgs: IList /// The named arguments for the attribute member NamedArguments: IList diff --git a/src/Compiler/TypedTree/TypedTreePickle.fs b/src/Compiler/TypedTree/TypedTreePickle.fs index 4ffe4c7c466..1e93701c20b 100644 --- a/src/Compiler/TypedTree/TypedTreePickle.fs +++ b/src/Compiler/TypedTree/TypedTreePickle.fs @@ -259,7 +259,7 @@ 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) = +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) = @@ -1947,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, _tyArgs, c, d, e, _targets, f)) st = // AttributeTargets are not preserved - p_tup7 (p_tcref "attrib") p_attribkind (p_list p_ty) (p_list p_attrib_expr) (p_list p_attrib_arg) p_bool p_dummy_range (a, b, _tyArgs, 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 @@ -2258,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 741c369a21f..2c1504c4ec7 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -1510,25 +1510,19 @@ attribute: /* A custom attribute with generic type parameters some.good.AttributeName<^SomeTyPar>(and, args)opt_HIGH_PRECEDENCE_APP HIGH_PRECEDENCE_PAREN_APP - */ - // | path postfixTyparDecls HIGH_PRECEDENCE_PAREN_APP opt_atomicExprAfterType - // { let arg = match $4 with None -> mkSynUnit $1.Range | Some e -> e - // debugPrint("\nWe managed to get in here....\n") - // let m = unionRanges $1.Range arg.Range - // ({ TypeName = $1; ArgExpr = arg; TypeParams = Some ($2); Target = None; AppliesToGetterAndSetter = false; Range = m }: SynAttribute) } - + */ | path HIGH_PRECEDENCE_TYAPP typeArgsActual opt_HIGH_PRECEDENCE_APP opt_atomicExprAfterType { let arg = match $5 with None -> mkSynUnit $1.Range | Some e -> e debugPrint("\nWe managed to get in here....\n") let m = unionRanges $1.Range arg.Range let mLessThan, mGreaterThan, _, args, commas, mAll = $3 - ({ TypeName = $1; ArgExpr = arg; TypeParams = args; Target = None; AppliesToGetterAndSetter = false; Range = m }: SynAttribute) } + ({ TypeName = $1; ArgExpr = arg; TypeArgs = args; Target = None; AppliesToGetterAndSetter = false; Range = m }: SynAttribute) } /* 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; TypeParams = []; Target = None; AppliesToGetterAndSetter = false; Range = m }: SynAttribute) } + ({ TypeName = $1; ArgExpr = arg; TypeArgs = []; Target = None; AppliesToGetterAndSetter = false; Range = m }: SynAttribute) } /* A custom attribute with an attribute target */ @@ -1536,14 +1530,14 @@ attribute: { 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; TypeParams = []; 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 */ | 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; TypeParams = []; Target = $1; AppliesToGetterAndSetter = false; Range = m }: SynAttribute) } + ({ TypeName = $3; ArgExpr = arg; TypeArgs = []; Target = $1; AppliesToGetterAndSetter = false; Range = m }: SynAttribute) } /* The target of a custom attribute */ diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index 470c7aa94b7..de6913b432c 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -320,6 +320,9 @@ + + %(RelativeDir)TestSource\%(Filename)%(Extension) + %(RelativeDir)\BaseLine\%(Filename)%(Extension) diff --git a/tests/service/Symbols.fs b/tests/service/Symbols.fs index 52823e65541..0e9cca4662e 100644 --- a/tests/service/Symbols.fs +++ b/tests/service/Symbols.fs @@ -289,7 +289,7 @@ let x = 123 |> Option.orElseWith (fun _ -> failwith "Could not get symbol") |> Option.map (fun su -> su.Symbol :?> FSharpMemberOrFunctionOrValue) |> Option.iter (fun symbol -> - let a = symbol.Attributes[0].TypeParameters[0] + let a = symbol.Attributes[0].TypeArgs[0] Assert.AreEqual(a.AbbreviatedType.TypeDefinition.CompiledName, "Int32") ) diff --git a/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs b/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs index 78fa629708b..0d30faed047 100644 --- a/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs +++ b/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs @@ -1,3 +1,3 @@ -[(foo = "bar")>] +[] do () diff --git a/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs.bsl b/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs.bsl index 1d771c0b803..ae0ba560bb5 100644 --- a/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs.bsl +++ b/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs.bsl @@ -7,7 +7,7 @@ ImplFile [Attributes ([{ Attributes = [{ TypeName = SynLongIdent ([MyAttribute], [], [None]) - TypeParams = + TypeArgs = [Var (SynTypar (T, HeadType, false), (2,14--2,16)); LongIdent (SynLongIdent ([int], [], [None]))] ArgExpr = diff --git a/tests/service/data/SyntaxTree/Attribute/RangeOfAttributeWithPath.fs.bsl b/tests/service/data/SyntaxTree/Attribute/RangeOfAttributeWithPath.fs.bsl index 945a993b07a..abf2ce1db45 100644 --- a/tests/service/data/SyntaxTree/Attribute/RangeOfAttributeWithPath.fs.bsl +++ b/tests/service/data/SyntaxTree/Attribute/RangeOfAttributeWithPath.fs.bsl @@ -9,7 +9,7 @@ ImplFile [{ TypeName = SynLongIdent ([Prefix; MyAttribute], [(2,8--2,9)], [None; None]) - TypeParams = [] + 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 132f11da3ac..1b0acec5108 100644 --- a/tests/service/data/SyntaxTree/Attribute/RangeOfAttributeWithTarget.fs.bsl +++ b/tests/service/data/SyntaxTree/Attribute/RangeOfAttributeWithTarget.fs.bsl @@ -7,7 +7,7 @@ ImplFile [Attributes ([{ Attributes = [{ TypeName = SynLongIdent ([MyAttribute], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Paren (App diff --git a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeBetweenLetKeywordAndPatternShouldBeIncludedInSynModuleDeclLet.fs.bsl b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeBetweenLetKeywordAndPatternShouldBeIncludedInSynModuleDeclLet.fs.bsl index 1003a9f2cd6..131d3ea98a7 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeBetweenLetKeywordAndPatternShouldBeIncludedInSynModuleDeclLet.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeBetweenLetKeywordAndPatternShouldBeIncludedInSynModuleDeclLet.fs.bsl @@ -14,7 +14,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([Literal], [], [None]) - TypeParams = [] + 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 d4ec37a81eb..486fbfdf511 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInBindingOfSynExprObjExpr.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInBindingOfSynExprObjExpr.fs.bsl @@ -18,7 +18,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + 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 7483326488d..f75a8acd12e 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInConstructorSynMemberDefnMember.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInConstructorSynMemberDefnMember.fs.bsl @@ -20,7 +20,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + 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 b407d1fcc54..da1116a9d0d 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInConstructorSynMemberDefnMemberOptAsSpec.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInConstructorSynMemberDefnMemberOptAsSpec.fs.bsl @@ -21,7 +21,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + 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 94cc1e79115..23e67128b25 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInFullSynMemberDefnMemberProperty.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInFullSynMemberDefnMemberProperty.fs.bsl @@ -23,7 +23,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (3,6--3,9)) Target = None AppliesToGetterAndSetter = false @@ -61,7 +61,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + 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 d0ca446e719..ef7b78c160e 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSecondaryConstructor.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSecondaryConstructor.fs.bsl @@ -77,7 +77,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + 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 32a8abf7178..a36775bbc28 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSynMemberDefnLetBindings.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSynMemberDefnLetBindings.fs.bsl @@ -20,7 +20,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + 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 6250204a7b1..c816524f66d 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSynMemberDefnMember.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSynMemberDefnMember.fs.bsl @@ -20,7 +20,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + 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 54855ac33f6..0745e53fd65 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSynModuleDeclLet.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInSynModuleDeclLet.fs.bsl @@ -12,7 +12,7 @@ ImplFile [SynBinding (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + 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 72f0a718641..5b737691f31 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInWriteOnlySynMemberDefnMemberProperty.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfAttributeShouldBeIncludedInWriteOnlySynMemberDefnMemberProperty.fs.bsl @@ -24,7 +24,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + 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 bc44c5dc1a2..49f79b68f82 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfLetKeywordShouldBePresentInSynModuleDeclLetBindingWithAttributes.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfLetKeywordShouldBePresentInSynModuleDeclLetBindingWithAttributes.fs.bsl @@ -14,7 +14,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([SomeAttribute], [], [None]) - TypeParams = [] + 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 d4998bfeb8e..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,7 +8,7 @@ ImplFile (SynExceptionDefn (SynExceptionDefnRepr ([{ Attributes = [{ TypeName = SynLongIdent ([A], [], [None]) - TypeParams = [] + 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 047cbc57e9b..11ed439b41c 100644 --- a/tests/service/data/SyntaxTree/Expression/SynExprObjWithSetter.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/SynExprObjWithSetter.fs.bsl @@ -10,7 +10,7 @@ ImplFile ([{ Attributes = [{ TypeName = SynLongIdent ([AbstractClass], [], [None]) - TypeParams = [] + 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 43fcae41edb..77b82e76ec6 100644 --- a/tests/service/data/SyntaxTree/Extern/Extern 01.fs.bsl +++ b/tests/service/data/SyntaxTree/Extern/Extern 01.fs.bsl @@ -9,7 +9,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([DllImport], [], [None]) - TypeParams = [] + 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 4de8b55608e..68ff6b1e2c2 100644 --- a/tests/service/data/SyntaxTree/Measure/SynTypeTupleInMeasureTypeWithLeadingSlash.fs.bsl +++ b/tests/service/data/SyntaxTree/Measure/SynTypeTupleInMeasureTypeWithLeadingSlash.fs.bsl @@ -9,7 +9,7 @@ ImplFile (SynComponentInfo ([{ Attributes = [{ TypeName = SynLongIdent ([Measure], [], [None]) - TypeParams = [] + 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 722e92e5282..14e2fa9082b 100644 --- a/tests/service/data/SyntaxTree/Measure/SynTypeTupleInMeasureTypeWithNoSlashes.fs.bsl +++ b/tests/service/data/SyntaxTree/Measure/SynTypeTupleInMeasureTypeWithNoSlashes.fs.bsl @@ -9,7 +9,7 @@ ImplFile (SynComponentInfo ([{ Attributes = [{ TypeName = SynLongIdent ([Measure], [], [None]) - TypeParams = [] + 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 b57801fb95e..7204f4438ca 100644 --- a/tests/service/data/SyntaxTree/Measure/SynTypeTupleInMeasureTypeWithStartAndSlash.fs.bsl +++ b/tests/service/data/SyntaxTree/Measure/SynTypeTupleInMeasureTypeWithStartAndSlash.fs.bsl @@ -9,7 +9,7 @@ ImplFile (SynComponentInfo ([{ Attributes = [{ TypeName = SynLongIdent ([Measure], [], [None]) - TypeParams = [] + 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 858fbad890f..94448adbe64 100644 --- a/tests/service/data/SyntaxTree/Member/Field 15.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Field 15.fs.bsl @@ -15,7 +15,7 @@ ImplFile (SynField ([{ Attributes = [{ TypeName = SynLongIdent ([A], [], [None]) - TypeParams = [] + 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 5fa6fe740b8..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,7 +17,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([A], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (4,6--4,7)) Target = None AppliesToGetterAndSetter = false @@ -48,7 +48,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([B], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (5,6--5,7)) Target = None AppliesToGetterAndSetter = false @@ -78,7 +78,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([C], [], [None]) - TypeParams = [] + 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 d22c3c89290..9ce2ab57297 100644 --- a/tests/service/data/SyntaxTree/Member/Member 01.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Member 01.fs.bsl @@ -16,7 +16,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([A], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (4,6--4,7)) Target = None AppliesToGetterAndSetter = false @@ -47,7 +47,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([B], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (5,6--5,7)) Target = None AppliesToGetterAndSetter = false @@ -77,7 +77,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([C], [], [None]) - TypeParams = [] + 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 5237d9f9e71..813346568ca 100644 --- a/tests/service/data/SyntaxTree/Member/Member 02.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Member 02.fs.bsl @@ -16,7 +16,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([A], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (4,6--4,7)) Target = None AppliesToGetterAndSetter = false @@ -47,7 +47,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([B], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (5,6--5,7)) Target = None AppliesToGetterAndSetter = false @@ -77,7 +77,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([C], [], [None]) - TypeParams = [] + 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 d795f4c31c5..495d712c248 100644 --- a/tests/service/data/SyntaxTree/Member/Member 03.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Member 03.fs.bsl @@ -16,7 +16,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([A], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (4,6--4,7)) Target = None AppliesToGetterAndSetter = false @@ -47,7 +47,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([B], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (5,6--5,7)) Target = None AppliesToGetterAndSetter = false @@ -77,7 +77,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([C], [], [None]) - TypeParams = [] + 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 ce351c3ea02..83019d21481 100644 --- a/tests/service/data/SyntaxTree/Member/Member 04.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Member 04.fs.bsl @@ -16,7 +16,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([A], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (4,6--4,7)) Target = None AppliesToGetterAndSetter = false @@ -47,7 +47,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([B], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (5,6--5,7)) Target = None AppliesToGetterAndSetter = false @@ -78,7 +78,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([C], [], [None]) - TypeParams = [] + 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 908578f5eb4..3f1ec90e0ca 100644 --- a/tests/service/data/SyntaxTree/Member/Member 05.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Member 05.fs.bsl @@ -16,7 +16,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([A], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (4,6--4,7)) Target = None AppliesToGetterAndSetter = false @@ -47,7 +47,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([B], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (5,6--5,7)) Target = None AppliesToGetterAndSetter = false @@ -79,7 +79,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([C], [], [None]) - TypeParams = [] + 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 ebeb4578236..a8f0e12388e 100644 --- a/tests/service/data/SyntaxTree/Member/Member 06.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Member 06.fs.bsl @@ -16,7 +16,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([A], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (4,6--4,7)) Target = None AppliesToGetterAndSetter = false @@ -47,7 +47,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([B], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (5,6--5,7)) Target = None AppliesToGetterAndSetter = false @@ -78,7 +78,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([C], [], [None]) - TypeParams = [] + 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 8b7f6fc5035..5df9633b4d4 100644 --- a/tests/service/data/SyntaxTree/Member/Member 07.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Member 07.fs.bsl @@ -16,7 +16,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([A], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (4,6--4,7)) Target = None AppliesToGetterAndSetter = false @@ -47,7 +47,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([B], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (5,6--5,7)) Target = None AppliesToGetterAndSetter = false @@ -76,7 +76,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([C], [], [None]) - TypeParams = [] + 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 1a774c155c8..24d860082e3 100644 --- a/tests/service/data/SyntaxTree/Member/Static 02.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Static 02.fs.bsl @@ -16,7 +16,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([A], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (4,6--4,7)) Target = None AppliesToGetterAndSetter = false @@ -47,7 +47,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([B], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (5,6--5,7)) Target = None AppliesToGetterAndSetter = false @@ -76,7 +76,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([C], [], [None]) - TypeParams = [] + 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 35a476f563c..4ecb47300d2 100644 --- a/tests/service/data/SyntaxTree/Member/Static 03.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Static 03.fs.bsl @@ -16,7 +16,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([A], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (4,6--4,7)) Target = None AppliesToGetterAndSetter = false @@ -47,7 +47,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([B], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (5,6--5,7)) Target = None AppliesToGetterAndSetter = false @@ -77,7 +77,7 @@ ImplFile (None, Normal, false, false, [{ Attributes = [{ TypeName = SynLongIdent ([C], [], [None]) - TypeParams = [] + 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 67059db1aeb..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,7 +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]) - TypeParams = [] + 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 04ac9b3c5bc..cf5290716a1 100644 --- a/tests/service/data/SyntaxTree/ModuleOrNamespaceSig/ModuleRangeShouldStartAtFirstAttribute.fsi.bsl +++ b/tests/service/data/SyntaxTree/ModuleOrNamespaceSig/ModuleRangeShouldStartAtFirstAttribute.fsi.bsl @@ -16,7 +16,7 @@ SigFile EqualsRange = None }), (5,0--5,14))], PreXmlDoc ((2,0), FSharp.Compiler.Xml.XmlDocCollector), [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + 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 5bd22ebc0ec..10919c2ff66 100644 --- a/tests/service/data/SyntaxTree/NestedModule/RangeOfAttributeShouldBeIncludedInSynModuleDeclNestedModule.fs.bsl +++ b/tests/service/data/SyntaxTree/NestedModule/RangeOfAttributeShouldBeIncludedInSynModuleDeclNestedModule.fs.bsl @@ -7,7 +7,7 @@ ImplFile [NestedModule (SynComponentInfo ([{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + 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 f7bc8a5ec97..e0ed27f679d 100644 --- a/tests/service/data/SyntaxTree/NestedModule/RangeOfAttributeShouldBeIncludedInSynModuleSigDeclNestedModule.fsi.bsl +++ b/tests/service/data/SyntaxTree/NestedModule/RangeOfAttributeShouldBeIncludedInSynModuleSigDeclNestedModule.fsi.bsl @@ -8,7 +8,7 @@ SigFile [NestedModule (SynComponentInfo ([{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + 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 f48513ebd84..1a61b823c91 100644 --- a/tests/service/data/SyntaxTree/NestedModule/RangeOfNestedModuleInSignatureFileShouldEndAtTheLastSynModuleSigDecl.fsi.bsl +++ b/tests/service/data/SyntaxTree/NestedModule/RangeOfNestedModuleInSignatureFileShouldEndAtTheLastSynModuleSigDecl.fsi.bsl @@ -234,7 +234,7 @@ SigFile ([{ Attributes = [{ TypeName = SynLongIdent ([StructuralEquality], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (27,6--27,24)) Target = None AppliesToGetterAndSetter = false @@ -242,7 +242,7 @@ SigFile { TypeName = SynLongIdent ([StructuralComparison], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (27,26--27,46)) Target = None AppliesToGetterAndSetter = false @@ -251,7 +251,7 @@ SigFile { Attributes = [{ TypeName = SynLongIdent ([CompiledName], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Paren (Const @@ -390,7 +390,7 @@ SigFile (SynComponentInfo ([{ Attributes = [{ TypeName = SynLongIdent ([AutoOpen], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (46,2--46,10)) Target = None AppliesToGetterAndSetter = false @@ -416,7 +416,7 @@ SigFile ([{ Attributes = [{ TypeName = SynLongIdent ([CompiledName], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Paren (Const @@ -451,7 +451,7 @@ SigFile ([{ Attributes = [{ TypeName = SynLongIdent ([CompiledName], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Paren (Const @@ -486,7 +486,7 @@ SigFile ([{ Attributes = [{ TypeName = SynLongIdent ([CompiledName], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Paren (Const @@ -520,7 +520,7 @@ SigFile ([{ Attributes = [{ TypeName = SynLongIdent ([CompiledName], [], [None]) - TypeParams = [] + 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 0b86d093bdd..3b4f8976d40 100644 --- a/tests/service/data/SyntaxTree/OperatorName/OperatorNameInValConstraint.fsi.bsl +++ b/tests/service/data/SyntaxTree/OperatorName/OperatorNameInValConstraint.fsi.bsl @@ -71,7 +71,7 @@ SigFile EqualsRange = None }), (4,4--12,94))], PreXmlDoc ((2,0), FSharp.Compiler.Xml.XmlDocCollector), [{ Attributes = [{ TypeName = SynLongIdent ([AutoOpen], [], [None]) - TypeParams = [] + 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 4a097b7e5f9..b3cfb0d22ab 100644 --- a/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributeShouldBeIncludedInSynExceptionDefnReprAndSynExceptionSig.fsi.bsl +++ b/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributeShouldBeIncludedInSynExceptionDefnReprAndSynExceptionSig.fsi.bsl @@ -9,13 +9,13 @@ SigFile (SynExceptionDefnRepr ([{ Attributes = [{ TypeName = SynLongIdent ([NoEquality], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (5,2--5,12)) Target = None AppliesToGetterAndSetter = false Range = (5,2--5,12) }; { TypeName = SynLongIdent ([NoComparison], [], [None]) - TypeParams = [] + 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 38dfd9df5dc..570bd9d9f12 100644 --- a/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributeShouldBeIncludedInSynTypeDefnSig.fsi.bsl +++ b/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributeShouldBeIncludedInSynTypeDefnSig.fsi.bsl @@ -10,7 +10,7 @@ SigFile (SynComponentInfo ([{ Attributes = [{ TypeName = SynLongIdent ([Foo1], [], [None]) - TypeParams = [] + 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 a40f10639a6..56ba99b4ae8 100644 --- a/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributeShouldBeIncludedInSynValSpfnAndMember.fsi.bsl +++ b/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributeShouldBeIncludedInSynValSpfnAndMember.fsi.bsl @@ -17,7 +17,7 @@ SigFile (SynValSig ([{ Attributes = [{ TypeName = SynLongIdent ([Foo2], [], [None]) - TypeParams = [] + 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 75ada66f812..72668db4e27 100644 --- a/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributesShouldBeIncludedInRecursiveTypes.fsi.bsl +++ b/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributesShouldBeIncludedInRecursiveTypes.fsi.bsl @@ -27,7 +27,7 @@ SigFile ([{ Attributes = [{ TypeName = SynLongIdent ([CustomEquality], [], [None]) - TypeParams = [] + 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 9dcd81dc9bd..65cdfc25add 100644 --- a/tests/service/data/SyntaxTree/SignatureType/ValKeywordIsPresentInSynValSig.fsi.bsl +++ b/tests/service/data/SyntaxTree/SignatureType/ValKeywordIsPresentInSynValSig.fsi.bsl @@ -7,7 +7,7 @@ SigFile [Val (SynValSig ([{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + 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 e5cfebf53a2..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,7 +88,7 @@ ImplFile ([[SynArgInfo ([{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (5,15--5,18)) Target = None AppliesToGetterAndSetter = false @@ -97,7 +97,7 @@ ImplFile SynArgInfo ([{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (5,28--5,31)) Target = None AppliesToGetterAndSetter = false @@ -113,7 +113,7 @@ ImplFile (Id (bar, None, false, false, false, (5,21--5,24)), [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (5,15--5,18)) Target = None AppliesToGetterAndSetter = false @@ -126,7 +126,7 @@ ImplFile (5,34--5,38)), [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (5,28--5,31)) Target = None AppliesToGetterAndSetter = false @@ -146,7 +146,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (5,15--5,18)) Target = None AppliesToGetterAndSetter = false @@ -162,7 +162,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + 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 fbab96fa08a..7b25dc154a8 100644 --- a/tests/service/data/SyntaxTree/SimplePats/SimplePats 01.fs.bsl +++ b/tests/service/data/SyntaxTree/SimplePats/SimplePats 01.fs.bsl @@ -78,7 +78,7 @@ ImplFile ([[SynArgInfo ([{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (5,15--5,18)) Target = None AppliesToGetterAndSetter = false @@ -87,7 +87,7 @@ ImplFile SynArgInfo ([{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (5,28--5,31)) Target = None AppliesToGetterAndSetter = false @@ -102,7 +102,7 @@ ImplFile (Id (bar, None, false, false, false, (5,21--5,24)), [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (5,15--5,18)) Target = None AppliesToGetterAndSetter = false @@ -115,7 +115,7 @@ ImplFile (5,34--5,38)), [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (5,28--5,31)) Target = None AppliesToGetterAndSetter = false @@ -134,7 +134,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (5,15--5,18)) Target = None AppliesToGetterAndSetter = false @@ -150,7 +150,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + 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 442f5cc0502..d18b08eed93 100644 --- a/tests/service/data/SyntaxTree/SimplePats/SimplePats 02.fs.bsl +++ b/tests/service/data/SyntaxTree/SimplePats/SimplePats 02.fs.bsl @@ -92,7 +92,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (5,9--5,12)) Target = None AppliesToGetterAndSetter = false @@ -108,7 +108,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (5,22--5,25)) Target = None AppliesToGetterAndSetter = false @@ -130,7 +130,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (5,9--5,12)) Target = None AppliesToGetterAndSetter = false @@ -146,7 +146,7 @@ ImplFile [{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + 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 91054c76dac..5be048f9d5c 100644 --- a/tests/service/data/SyntaxTree/SynType/SynTypeTupleDoesIncludeLeadingParameterAttributes.fsi.bsl +++ b/tests/service/data/SyntaxTree/SynType/SynTypeTupleDoesIncludeLeadingParameterAttributes.fsi.bsl @@ -26,7 +26,7 @@ SigFile [{ TypeName = SynLongIdent ([SomeAttribute], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (3,16--3,29)) Target = None @@ -42,7 +42,7 @@ SigFile [{ TypeName = SynLongIdent ([OtherAttribute], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (3,38--3,52)) Target = None @@ -60,7 +60,7 @@ SigFile [{ TypeName = SynLongIdent ([SomeAttribute], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (3,16--3,29)) Target = None AppliesToGetterAndSetter = false @@ -71,7 +71,7 @@ SigFile [{ TypeName = SynLongIdent ([OtherAttribute], [], [None]) - TypeParams = [] + 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 ddbbf9deb36..0b2fafcfc14 100644 --- a/tests/service/data/SyntaxTree/Type/AttributesInOptionalNamedMemberParameter.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/AttributesInOptionalNamedMemberParameter.fs.bsl @@ -21,14 +21,14 @@ ImplFile ([{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (3,25--3,28)) Target = None AppliesToGetterAndSetter = false Range = (3,25--3,28) }; { TypeName = SynLongIdent ([Bar], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (3,30--3,33)) Target = None AppliesToGetterAndSetter = false @@ -43,14 +43,14 @@ ImplFile ([{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (3,25--3,28)) Target = None AppliesToGetterAndSetter = false Range = (3,25--3,28) }; { TypeName = SynLongIdent ([Bar], [], [None]) - TypeParams = [] + 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 9f1dba4a0d7..54e7223a1e3 100644 --- a/tests/service/data/SyntaxTree/Type/Class 05.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/Class 05.fs.bsl @@ -15,7 +15,7 @@ ImplFile (None, [{ Attributes = [{ TypeName = SynLongIdent ([A], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (3,9--3,10)) Target = None AppliesToGetterAndSetter = false @@ -29,7 +29,7 @@ ImplFile (None, [{ Attributes = [{ TypeName = SynLongIdent ([A], [], [None]) - TypeParams = [] + 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 9e1c55e3632..96d77e9d4d8 100644 --- a/tests/service/data/SyntaxTree/Type/RangeOfAttributeShouldBeIncludedInSynTypeDefn.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/RangeOfAttributeShouldBeIncludedInSynTypeDefn.fs.bsl @@ -9,7 +9,7 @@ ImplFile (SynComponentInfo ([{ Attributes = [{ TypeName = SynLongIdent ([Foo], [], [None]) - TypeParams = [] + 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 34a84ab7f68..8c9e411c3a7 100644 --- a/tests/service/data/SyntaxTree/Type/RangeOfAttributesShouldBeIncludedInRecursiveTypes.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/RangeOfAttributesShouldBeIncludedInRecursiveTypes.fs.bsl @@ -10,13 +10,13 @@ ImplFile (SynComponentInfo ([{ Attributes = [{ TypeName = SynLongIdent ([NoEquality], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (2,2--2,12)) Target = None AppliesToGetterAndSetter = false Range = (2,2--2,12) }; { TypeName = SynLongIdent ([NoComparison], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (2,15--2,27)) Target = None AppliesToGetterAndSetter = false @@ -66,13 +66,13 @@ ImplFile ([{ Attributes = [{ TypeName = SynLongIdent ([CustomEquality], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (6,6--6,20)) Target = None AppliesToGetterAndSetter = false Range = (6,6--6,20) }; { TypeName = SynLongIdent ([NoComparison], [], [None]) - TypeParams = [] + 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 620bb5b1fe4..ce320ee5694 100644 --- a/tests/service/data/SyntaxTree/Type/SynTypeDefnWithAttributeContainsTheRangeOfTheTypeKeyword.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/SynTypeDefnWithAttributeContainsTheRangeOfTheTypeKeyword.fs.bsl @@ -12,7 +12,7 @@ ImplFile (SynComponentInfo ([{ Attributes = [{ TypeName = SynLongIdent ([MyAttribute], [], [None]) - TypeParams = [] + TypeArgs = [] ArgExpr = Const (Unit, (2,2--2,13)) Target = None AppliesToGetterAndSetter = false diff --git a/tests/service/data/SyntaxTree/TypeParameters/Attribute.fs.bsl b/tests/service/data/SyntaxTree/TypeParameters/Attribute.fs.bsl index 9b8b7c1aa1f..1d4983a7eb1 100644 --- a/tests/service/data/SyntaxTree/TypeParameters/Attribute.fs.bsl +++ b/tests/service/data/SyntaxTree/TypeParameters/Attribute.fs.bsl @@ -23,7 +23,7 @@ ImplFile Attributes ([{ Attributes = [{ TypeName = SynLongIdent ([AGoodAttribute], [], [None]) - TypeParams = + TypeArgs = [Var (SynTypar (A, HeadType, false), (3,17--3,19)); App (LongIdent (SynLongIdent ([SomeThing], [], [None])), From d9ac04e0644b1d5d16619293089be6e99f187f3c Mon Sep 17 00:00:00 2001 From: Mackenzie F Libby Date: Tue, 28 May 2024 01:32:46 -0400 Subject: [PATCH 06/19] updated with language feature and reverted modified test cases --- src/Compiler/FSComp.txt | 1 + src/Compiler/Facilities/LanguageFeatures.fs | 3 +++ src/Compiler/Facilities/LanguageFeatures.fsi | 1 + src/Compiler/xlf/FSComp.txt.cs.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.de.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.es.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.fr.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.it.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.ja.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.ko.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.pl.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.pt-BR.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.ru.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.tr.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.zh-Hans.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.zh-Hant.xlf | 5 +++++ ...r.Service.SurfaceArea.netstandard20.debug.bsl | 6 ++++-- ...Service.SurfaceArea.netstandard20.release.bsl | 8 ++++---- .../SyntaxTree/Attribute/RangeOfAttribute.fs.bsl | 16 +++++++--------- 19 files changed, 85 insertions(+), 15 deletions(-) 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/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.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl index 90928ca9fa8..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,8 +6285,8 @@ 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] TypeParams -FSharp.Compiler.Syntax.SynAttribute: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType] get_TypeParams() +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() 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 f661b965bd0..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,8 +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] TypeParameters -FSharp.Compiler.Symbols.FSharpAttribute: System.Collections.Generic.IList`1[FSharp.Compiler.Symbols.FSharpType] get_TypeParameters() +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 @@ -6285,8 +6285,8 @@ 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] TypeParams -FSharp.Compiler.Syntax.SynAttribute: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType] get_TypeParams() +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() diff --git a/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs.bsl b/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs.bsl index ae0ba560bb5..f7ad46641f7 100644 --- a/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs.bsl +++ b/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs.bsl @@ -7,9 +7,7 @@ ImplFile [Attributes ([{ Attributes = [{ TypeName = SynLongIdent ([MyAttribute], [], [None]) - TypeArgs = - [Var (SynTypar (T, HeadType, false), (2,14--2,16)); - LongIdent (SynLongIdent ([int], [], [None]))] + TypeArgs = [] ArgExpr = Paren (App @@ -21,15 +19,15 @@ ImplFile SynLongIdent ([op_Equality], [], [Some (OriginalNotation "=")]), None, - (2,27--2,28)), Ident foo, (2,23--2,28)), + (2,18--2,19)), Ident foo, (2,14--2,19)), Const - (String ("bar", Regular, (2,29--2,34)), - (2,29--2,34)), (2,23--2,34)), (2,22--2,23), - Some (2,34--2,35), (2,22--2,35)) + (String ("bar", Regular, (2,20--2,25)), + (2,20--2,25)), (2,14--2,25)), (2,13--2,14), + Some (2,25--2,26), (2,13--2,26)) Target = None AppliesToGetterAndSetter = false - Range = (2,2--2,35) }] - Range = (2,0--2,37) }], (2,0--2,37)); + Range = (2,2--2,26) }] + Range = (2,0--2,28) }], (2,0--2,28)); Expr (Do (Const (Unit, (3,3--3,5)), (3,0--3,5)), (3,0--3,5))], PreXmlDocEmpty, [], None, (2,0--4,0), { LeadingKeyword = None })], (true, true), { ConditionalDirectives = [] From e545b49a2d838a944f79c5bd2b366e14ab237543 Mon Sep 17 00:00:00 2001 From: Mackenzie F Libby Date: Tue, 28 May 2024 01:41:04 -0400 Subject: [PATCH 07/19] updated release notes --- docs/release-notes/.FSharp.Compiler.Service/8.0.400.md | 1 + docs/release-notes/.Language/preview.md | 1 + 2 files changed, 2 insertions(+) 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 744d041341e..33374028b90 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/8.0.400.md +++ b/docs/release-notes/.FSharp.Compiler.Service/8.0.400.md @@ -21,6 +21,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 From 64607efb838d1d0b2b4c285d98ac3cb5d3124bac Mon Sep 17 00:00:00 2001 From: Mackenzie F Libby Date: Tue, 28 May 2024 01:47:28 -0400 Subject: [PATCH 08/19] formatting fixes --- src/Compiler/AbstractIL/il.fs | 2 +- src/Compiler/CodeGen/IlxGen.fs | 8 +++++--- src/Compiler/SyntaxTree/SyntaxTree.fs | 2 +- src/Compiler/SyntaxTree/SyntaxTree.fsi | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Compiler/AbstractIL/il.fs b/src/Compiler/AbstractIL/il.fs index 4dfce19b0df..019068d7603 100644 --- a/src/Compiler/AbstractIL/il.fs +++ b/src/Compiler/AbstractIL/il.fs @@ -3150,7 +3150,7 @@ let mkILMethRef (tref, callconv, nm, numGenericParams, argTys, retTy) = } let mkILMethSpecForMethRefInTy (mref, ty, methInst) = - { + { mspecMethodRef = mref mspecDeclaringType = ty mspecMethodInst = methInst diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index 63466e30900..0da5938d4a1 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -9966,7 +9966,9 @@ and GenAttr cenv g eenv (Attrib(_, k, _typeParams, args, props, _, _, m)) = let ilTy = GenType cenv m eenv.tyenv ty let cval = GenAttribArg cenv g eenv expr ilTy (s, ilTy, fld, cval)) + let ilTyArgs = GenTypeArgs cenv m eenv.tyenv _typeParams + let mspec = match k with | ILAttrib mref -> mkILMethSpec (mref, AsObject, ilTyArgs, []) @@ -9976,13 +9978,13 @@ and GenAttr cenv g eenv (Attrib(_, k, _typeParams, args, props, _, _, m)) = let mspec, _, _, _, _, _, _, _, _, _ = GetMethodSpecForMemberVal cenv (Option.get vref.MemberInfo) vref - //numEnclILTypeArgs will include unit-of-measure args, unfortunately. For now, just cut-and-paste code from GetMemberCallInfo - //@REVIEW: refactor this + //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)) diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fs b/src/Compiler/SyntaxTree/SyntaxTree.fs index 3eebd888461..6c8a90b1545 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fs +++ b/src/Compiler/SyntaxTree/SyntaxTree.fs @@ -1042,7 +1042,7 @@ type SynMatchClause = type SynAttribute = { TypeName: SynLongIdent - + TypeArgs: SynType list ArgExpr: SynExpr diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fsi b/src/Compiler/SyntaxTree/SyntaxTree.fsi index 65404f45188..0af340740f2 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTree.fsi @@ -1169,7 +1169,7 @@ type SynAttribute = { /// The name of the type for the attribute TypeName: SynLongIdent - + /// The type parameters of the attribute. TypeArgs: SynType list From 45281efbf87efbd9cf56ed23a794c573299229bb Mon Sep 17 00:00:00 2001 From: mflibby Date: Wed, 29 May 2024 23:42:20 -0400 Subject: [PATCH 09/19] more tests for ensuring appropriate type arg behavior in attributes --- .../EmittedIL/Attribute/Attribute.fs | 12 +++ .../RecordTypeAttributesWithTypeParam.fs | 16 ++++ tests/service/Symbols.fs | 37 +++++++- .../Attribute/RecordAttributeWithTypeArg.fs | 5 + .../RecordAttributeWithTypeArg.fs.bsl | 39 ++++++++ .../SyntaxTree/TypeParameters/Attribute.fs | 5 +- .../TypeParameters/Attribute.fs.bsl | 94 +++++++++++++------ 7 files changed, 174 insertions(+), 34 deletions(-) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/RecordTypeAttributesWithTypeParam.fs create mode 100644 tests/service/data/SyntaxTree/Attribute/RecordAttributeWithTypeArg.fs create mode 100644 tests/service/data/SyntaxTree/Attribute/RecordAttributeWithTypeArg.fs.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/Attribute.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/Attribute.fs index da980c345e1..c034cda6607 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/Attribute.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/Attribute.fs @@ -25,6 +25,18 @@ module Attribute = [] let ``AttributeWithTypeParam_RealInternalSignatureOff_fs`` compilation = + compilation + |> withRealInternalSignatureOff + |> verifyCompilation + + [] + let ``RecordTypeAttributesWithTypeParam_RealInternalSignatureOn_fs`` compilation = + compilation + |> withRealInternalSignatureOn + |> verifyCompilation + + [] + let ``RecordTypeAttributesWithTypeParam_RealInternalSignatureOff_fs`` compilation = compilation |> withRealInternalSignatureOff |> verifyCompilation \ No newline at end of file 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..3fa5e7d5a48 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/RecordTypeAttributesWithTypeParam.fs @@ -0,0 +1,16 @@ +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/service/Symbols.fs b/tests/service/Symbols.fs index 0e9cca4662e..3932b9dbaad 100644 --- a/tests/service/Symbols.fs +++ b/tests/service/Symbols.fs @@ -271,7 +271,6 @@ let x = 123 open System open System.Diagnostics -[] type FooAttribute<^T>() = inherit Attribute() @@ -279,8 +278,6 @@ type FooAttribute<^T>() = let x = 123 """ let fileName, options = mkTestFileAndOptions source [| "--noconditionalerasure" |] - let contents = System.IO.File.ReadAllText fileName - let parseResults = parseSourceCode(fileName, source) let _, checkResults = parseAndCheckFile fileName source options checkResults.GetAllUsesOfAllSymbolsInFile() @@ -289,9 +286,39 @@ let x = 123 |> Option.orElseWith (fun _ -> failwith "Could not get symbol") |> Option.map (fun su -> su.Symbol :?> FSharpMemberOrFunctionOrValue) |> Option.iter (fun symbol -> - let a = symbol.Attributes[0].TypeArgs[0] - Assert.AreEqual(a.AbbreviatedType.TypeDefinition.CompiledName, "Int32") + 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 = [] 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..90ac718489c --- /dev/null +++ b/tests/service/data/SyntaxTree/Attribute/RecordAttributeWithTypeArg.fs.bsl @@ -0,0 +1,39 @@ +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,5)) + Target = None + AppliesToGetterAndSetter = false + Range = (1,2--1,5) }] + Range = (1,0--1,11) }], 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 [])) + +(1,10)-(1,11) parse error Unexpected symbol '>' in attribute list diff --git a/tests/service/data/SyntaxTree/TypeParameters/Attribute.fs b/tests/service/data/SyntaxTree/TypeParameters/Attribute.fs index df4a65d82ac..df575c8551a 100644 --- a/tests/service/data/SyntaxTree/TypeParameters/Attribute.fs +++ b/tests/service/data/SyntaxTree/TypeParameters/Attribute.fs @@ -1,4 +1,5 @@ -type SomeThing<^S> = class end +[>>] +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 index 1d4983a7eb1..44ae2088062 100644 --- a/tests/service/data/SyntaxTree/TypeParameters/Attribute.fs.bsl +++ b/tests/service/data/SyntaxTree/TypeParameters/Attribute.fs.bsl @@ -4,38 +4,78 @@ ImplFile [], [], [SynModuleOrNamespace ([Attribute], false, AnonModule, - [Types - ([SynTypeDefn - (SynComponentInfo - ([], - Some - (PostfixList - ([SynTyparDecl - ([], SynTypar (S, HeadType, false), [], - { AmpersandRanges = [] })], [], (1,14--1,18))), - [], [SomeThing], - PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), - true, None, (1,5--1,14)), - ObjectModel (Class, [], (1,21--1,30)), [], None, (1,5--1,30), - { LeadingKeyword = Type (1,0--1,4) - EqualsRange = Some (1,19--1,20) - WithKeyword = None })], (1,0--1,30)); - Attributes + [Attributes ([{ Attributes = [{ TypeName = SynLongIdent ([AGoodAttribute], [], [None]) TypeArgs = - [Var (SynTypar (A, HeadType, false), (3,17--3,19)); + [Var (SynTypar (A, HeadType, false), (1,17--1,19)); App (LongIdent (SynLongIdent ([SomeThing], [], [None])), - Some (3,30--3,31), + Some (1,30--1,31), [LongIdent (SynLongIdent ([int], [], [None]))], [], - Some (3,34--3,35), false, (3,21--3,35))] - ArgExpr = Const (Unit, (3,2--3,16)) + Some (1,34--1,35), false, (1,21--1,35))] + ArgExpr = Const (Unit, (1,2--1,16)) + Target = None + AppliesToGetterAndSetter = false + Range = (1,2--1,16) }] + Range = (1,0--1,37) }], (1,0--1,37)); + 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 + (Some (SynTypar (T, HeadType, false)), + [App + (LongIdent (SynLongIdent ([List], [], [None])), + Some (4,33--4,34), + [LongIdent (SynLongIdent ([int], [], [None]))], [], + Some (4,37--4,38), false, (4,29--4,38))], + (4,24--4,38), { AmpersandRanges = [(4,27--4,28)] })] + ArgExpr = + Paren + (Tuple + (false, + [App + (NonAtomic, false, + App + (NonAtomic, true, + LongIdent + (false, + SynLongIdent + ([op_Equality], [], + [Some (OriginalNotation "=")]), None, + (4,49--4,50)), Ident NamedArg1, + (4,40--4,50)), + Const + (String ("Foo", Regular, (4,50--4,55)), + (4,50--4,55)), (4,40--4,55)); + App + (NonAtomic, false, + App + (NonAtomic, true, + LongIdent + (false, + SynLongIdent + ([op_Equality], [], + [Some (OriginalNotation "=")]), None, + (4,66--4,67)), Ident NamedArg2, + (4,57--4,67)), + Const + (String ("Bar", Regular, (4,67--4,72)), + (4,67--4,72)), (4,57--4,72))], [(4,55--4,56)], + (4,40--4,72)), (4,39--4,40), Some (4,72--4,73), + (4,39--4,73)) Target = None AppliesToGetterAndSetter = false - Range = (3,2--3,16) }] - Range = (3,0--3,39) }], (3,0--3,39)); - Expr (Do (Const (Unit, (4,2--4,4)), (4,0--4,4)), (4,0--4,4))], - PreXmlDocEmpty, [], None, (1,0--4,4), { LeadingKeyword = None })], - (true, true), { ConditionalDirectives = [] - CodeComments = [] }, set [])) + Range = (4,2--4,73) }] + Range = (4,0--4,75) }], (4,0--4,75))], PreXmlDocEmpty, [], None, + (1,0--4,75), { LeadingKeyword = None })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(1,36)-(1,37) parse error Unexpected symbol '>' in attribute list +(4,29)-(4,38) parse error Constraint intersection syntax may only be used with flexible types, e.g. '#IDisposable & #ISomeInterface'. +(4,0)-(4,75) parse error Cannot find code target for this attribute, possibly because the code after the attribute is incomplete. From 796a4ba8fbc073719cb398c04acc15dad8ef4041 Mon Sep 17 00:00:00 2001 From: mflibby Date: Thu, 30 May 2024 00:22:33 -0400 Subject: [PATCH 10/19] fixed type level generic attributes not being digested properly in IsSecurityAttribute (ILxGen) --- src/Compiler/Checking/AttributeChecking.fs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Compiler/Checking/AttributeChecking.fs b/src/Compiler/Checking/AttributeChecking.fs index 1ad38f8a8d1..867555ac6d6 100644 --- a/src/Compiler/Checking/AttributeChecking.fs +++ b/src/Compiler/Checking/AttributeChecking.fs @@ -533,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 @@ -544,7 +544,7 @@ 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 From 97c326eef8a0fad56a12969307a5e8ba6906adfe Mon Sep 17 00:00:00 2001 From: Mackenzie F Libby Date: Fri, 31 May 2024 03:42:43 -0400 Subject: [PATCH 11/19] fixed lexing issue where type args adjacent to >] clashed --- src/Compiler/Facilities/prim-parsing.fs | 2 +- src/Compiler/Service/ServiceLexing.fs | 3 + src/Compiler/Service/ServiceLexing.fsi | 1 + src/Compiler/SyntaxTree/LexFilter.fs | 21 ++++++- src/Compiler/lex.fsl | 19 +++--- src/Compiler/pars.fsy | 17 +++--- .../Attribute/AttributeWithTypeParam.fs | 2 +- .../RecordTypeAttributesWithTypeParam.fs | 4 +- ...vice.SurfaceArea.netstandard20.release.bsl | 5 ++ .../FSharp.Compiler.Service.Tests/Symbols.fs | 4 +- .../SyntaxTree/Attribute/ArglessAttribute.fs | 3 + .../Attribute/ArglessAttribute.fs.bsl | 19 ++++++ .../RecordAttributeWithTypeArg.fs.bsl | 8 +-- .../SyntaxTree/TypeParameters/Attribute.fs | 2 +- .../TypeParameters/Attribute.fs.bsl | 61 ++++++++++--------- 15 files changed, 110 insertions(+), 61 deletions(-) create mode 100644 tests/service/data/SyntaxTree/Attribute/ArglessAttribute.fs create mode 100644 tests/service/data/SyntaxTree/Attribute/ArglessAttribute.fs.bsl diff --git a/src/Compiler/Facilities/prim-parsing.fs b/src/Compiler/Facilities/prim-parsing.fs index 3088a5579ed..3e76b886089 100644 --- a/src/Compiler/Facilities/prim-parsing.fs +++ b/src/Compiler/Facilities/prim-parsing.fs @@ -173,7 +173,7 @@ module internal Implementation = // First check the sparse lookaside table // Performance note: without this lookaside table the binary chop in ReadAssoc - // takes up around 10% of of parsing time + // takes up around 10% of parsing time // for parsing intensive samples such as the bootstrapped F# compiler. // // NOTE: using a .NET Dictionary for this int -> int table looks like it could be sub-optimal. diff --git a/src/Compiler/Service/ServiceLexing.fs b/src/Compiler/Service/ServiceLexing.fs index 9abe2199dc0..c4d430a77f3 100644 --- a/src/Compiler/Service/ServiceLexing.fs +++ b/src/Compiler/Service/ServiceLexing.fs @@ -392,6 +392,7 @@ module internal TokenClassifications = | HIGH_PRECEDENCE_PAREN_APP | FIXED | HIGH_PRECEDENCE_BRACK_APP + | HIGH_PRECEDENCE_GRBRACK_APP | TYPE_COMING_SOON | TYPE_IS_HERE | MODULE_COMING_SOON @@ -1313,6 +1314,7 @@ type FSharpTokenKind = | HighPrecedenceTypeApp | HighPrecedenceParenthesisApp | HighPrecedenceBracketApp + | HighPrecedenceGreaterRightBracketApp | Extern | Void | Public @@ -1524,6 +1526,7 @@ type FSharpToken = | HIGH_PRECEDENCE_TYAPP -> FSharpTokenKind.HighPrecedenceTypeApp | HIGH_PRECEDENCE_PAREN_APP -> FSharpTokenKind.HighPrecedenceParenthesisApp | HIGH_PRECEDENCE_BRACK_APP -> FSharpTokenKind.HighPrecedenceBracketApp + | HIGH_PRECEDENCE_GRBRACK_APP -> FSharpTokenKind.HighPrecedenceGreaterRightBracketApp | EXTERN -> FSharpTokenKind.Extern | VOID -> FSharpTokenKind.Void | PUBLIC -> FSharpTokenKind.Public diff --git a/src/Compiler/Service/ServiceLexing.fsi b/src/Compiler/Service/ServiceLexing.fsi index ee2ab7411d5..87c0a98317c 100755 --- a/src/Compiler/Service/ServiceLexing.fsi +++ b/src/Compiler/Service/ServiceLexing.fsi @@ -399,6 +399,7 @@ type public FSharpTokenKind = | HighPrecedenceTypeApp | HighPrecedenceParenthesisApp | HighPrecedenceBracketApp + | HighPrecedenceGreaterRightBracketApp | Extern | Void | Public diff --git a/src/Compiler/SyntaxTree/LexFilter.fs b/src/Compiler/SyntaxTree/LexFilter.fs index 79afdca04c3..ae24e907ab5 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,16 @@ type LexFilterImpl ( if afterOp.IsNone && nextTokenIsAdjacentLParen lookaheadTokenTup then let dotTokenTup = peekNextTokenTup() stack <- (pool.UseLocation(dotTokenTup, HIGH_PRECEDENCE_PAREN_APP), false) :: stack - true + true + else if afterOp.IsNone && nextTokenIsAdjacentRBrack lookaheadTokenTup 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, HIGH_PRECEDENCE_GRBRACK_APP, -1, 0), false) :: stack + stack <- (pool.UseShiftedLocation(dotTokenTop, GREATER_RBRACK, -1, 0), false) :: stack + false + else + true | LPAREN | LESS _ | LBRACK @@ -1212,6 +1227,8 @@ type LexFilterImpl ( | INFIX_COMPARE_OP (TyparsCloseOp(greaters, afterOp) as opstr) -> match afterOp with | ValueNone -> () + //delayToken(pool.UseShiftedLocation(tokenTup,GREATER false, 1, 0)) + //delayToken(pool.UseShiftedLocation(tokenTup,)) | ValueSome tok -> delayToken (pool.UseShiftedLocation(tokenTup, tok, greaters.Length, 0)) for i = greaters.Length - 1 downto 0 do delayToken (pool.UseShiftedLocation(tokenTup, greaters[i] res, i, -opstr.Length + i + 1)) diff --git a/src/Compiler/lex.fsl b/src/Compiler/lex.fsl index cd73aa454c2..71974557cce 100644 --- a/src/Compiler/lex.fsl +++ b/src/Compiler/lex.fsl @@ -950,24 +950,23 @@ rule token (args: LexArgs) (skip: bool) = parse | "~" { errorR (Error(FSComp.SR.lexInvalidIdentifier(), lexbuf.LexemeRange)) RESERVED } + | ignored_op_char* '*' '*' op_char* { checkExprOp lexbuf; INFIX_STAR_STAR_OP(lexeme lexbuf) } - | ignored_op_char* '*' '*' op_char* { checkExprOp lexbuf; INFIX_STAR_STAR_OP(lexeme lexbuf) } + | ignored_op_char* ('*' | '/'|'%') op_char* { checkExprOp lexbuf; INFIX_STAR_DIV_MOD_OP(lexeme lexbuf) } - | ignored_op_char* ('*' | '/'|'%') op_char* { checkExprOp lexbuf; INFIX_STAR_DIV_MOD_OP(lexeme lexbuf) } + | ignored_op_char* ('+'|'-') op_char* { checkExprOp lexbuf; PLUS_MINUS_OP(lexeme lexbuf) } - | ignored_op_char* ('+'|'-') op_char* { checkExprOp lexbuf; PLUS_MINUS_OP(lexeme lexbuf) } + | ignored_op_char* ('@'|'^') op_char* { checkExprOp lexbuf; INFIX_AT_HAT_OP(lexeme lexbuf) } - | ignored_op_char* ('@'|'^') op_char* { checkExprOp lexbuf; INFIX_AT_HAT_OP(lexeme lexbuf) } - - | ignored_op_char* ('=' | "!=" | '<' | '$') op_char* { checkExprOp lexbuf; INFIX_COMPARE_OP(lexeme lexbuf) } + | ignored_op_char* ('=' | "!=" | '<' | '$') op_char* { checkExprOp lexbuf; INFIX_COMPARE_OP(lexeme lexbuf) } - | ignored_op_char* ('>') op_char* { checkExprGreaterColonOp lexbuf; INFIX_COMPARE_OP(lexeme lexbuf) } + | ignored_op_char* ('>') op_char* { checkExprGreaterColonOp lexbuf; INFIX_COMPARE_OP(lexeme lexbuf) } - | ignored_op_char* ('&') op_char* { checkExprOp lexbuf; INFIX_AMP_OP(lexeme lexbuf) } + | ignored_op_char* ('&') op_char* { checkExprOp lexbuf; INFIX_AMP_OP(lexeme lexbuf) } - | ignored_op_char* '|' op_char* { checkExprOp lexbuf; INFIX_BAR_OP(lexeme lexbuf) } + | ignored_op_char* '|' op_char* { checkExprOp lexbuf; INFIX_BAR_OP(lexeme lexbuf) } - | ignored_op_char* ('!' | '~' ) op_char* { checkExprOp lexbuf; PREFIX_OP(lexeme lexbuf) } + | ignored_op_char* ('!' | '~' ) op_char* { checkExprOp lexbuf; PREFIX_OP(lexeme lexbuf) } | ".[]" | ".[]<-" | ".[,]<-" | ".[,,]<-" | ".[,,,]<-" | ".[,,,]" | ".[,,]" | ".[,]" | ".[..]" | ".[..,..]" | ".[..,..,..]" | ".[..,..,..,..]" diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index 2c1504c4ec7..6cd25eb6e76 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -1508,14 +1508,13 @@ attributeListElements: /* One custom attribute */ attribute: /* A custom attribute with generic type parameters - some.good.AttributeName<^SomeTyPar>(and, args)opt_HIGH_PRECEDENCE_APP - HIGH_PRECEDENCE_PAREN_APP + some.good.AttributeName<^SomeTyPar>(and, args) */ - | path HIGH_PRECEDENCE_TYAPP typeArgsActual opt_HIGH_PRECEDENCE_APP opt_atomicExprAfterType - { let arg = match $5 with None -> mkSynUnit $1.Range | Some e -> e - debugPrint("\nWe managed to get in here....\n") - let m = unionRanges $1.Range arg.Range + | 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 */ @@ -1523,7 +1522,6 @@ attribute: { let arg = match $3 with None -> mkSynUnit $1.Range | Some e -> e let m = unionRanges $1.Range arg.Range ({ TypeName = $1; ArgExpr = arg; TypeArgs = []; Target = None; AppliesToGetterAndSetter = false; Range = m }: SynAttribute) } - /* A custom attribute with an attribute target */ | attributeTarget path opt_HIGH_PRECEDENCE_APP opt_atomicExprAfterType @@ -6360,6 +6358,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 @@ -6759,7 +6759,7 @@ opt_equals: { let mEquals = rhs parseState 1 Some mEquals } | /* EMPTY */ { None } - + opt_OBLOCKSEP: | OBLOCKSEP { } | /* EMPTY */ { } @@ -6876,6 +6876,7 @@ interpolatedString: opt_HIGH_PRECEDENCE_APP: | HIGH_PRECEDENCE_BRACK_APP { } | HIGH_PRECEDENCE_PAREN_APP { } + | HIGH_PRECEDENCE_GRBRACK_APP { } | /* EMPTY */ { } opt_HIGH_PRECEDENCE_TYAPP: diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/AttributeWithTypeParam.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/AttributeWithTypeParam.fs index 3fa9806527e..fbbd6195694 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/AttributeWithTypeParam.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/AttributeWithTypeParam.fs @@ -4,5 +4,5 @@ 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/RecordTypeAttributesWithTypeParam.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/RecordTypeAttributesWithTypeParam.fs index 3fa5e7d5a48..226ce6cfd6a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/RecordTypeAttributesWithTypeParam.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/RecordTypeAttributesWithTypeParam.fs @@ -8,9 +8,9 @@ type RecordLevelAttribute<^T>()= type FieldLevelAttribute<^T>()= inherit Attribute() -[()>] +[>] type Test = { - [()>] + [>] someField : string } \ No newline at end of file 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 242f1dd1b02..dce7a9ddb9c 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 @@ -10894,6 +10894,7 @@ FSharp.Compiler.Tokenization.FSharpTokenKind+Tags: Int32 HashIf FSharp.Compiler.Tokenization.FSharpTokenKind+Tags: Int32 HashLight FSharp.Compiler.Tokenization.FSharpTokenKind+Tags: Int32 HashLine FSharp.Compiler.Tokenization.FSharpTokenKind+Tags: Int32 HighPrecedenceBracketApp +FSharp.Compiler.Tokenization.FSharpTokenKind+Tags: Int32 HighPrecedenceGreaterRightBracketApp FSharp.Compiler.Tokenization.FSharpTokenKind+Tags: Int32 HighPrecedenceParenthesisApp FSharp.Compiler.Tokenization.FSharpTokenKind+Tags: Int32 HighPrecedenceTypeApp FSharp.Compiler.Tokenization.FSharpTokenKind+Tags: Int32 Identifier @@ -11089,6 +11090,7 @@ FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean IsHashIf FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean IsHashLight FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean IsHashLine FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean IsHighPrecedenceBracketApp +FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean IsHighPrecedenceGreaterRightBracketApp FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean IsHighPrecedenceParenthesisApp FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean IsHighPrecedenceTypeApp FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean IsIdentifier @@ -11280,6 +11282,7 @@ FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean get_IsHashIf() FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean get_IsHashLight() FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean get_IsHashLine() FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean get_IsHighPrecedenceBracketApp() +FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean get_IsHighPrecedenceGreaterRightBracketApp() FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean get_IsHighPrecedenceParenthesisApp() FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean get_IsHighPrecedenceTypeApp() FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean get_IsIdentifier() @@ -11471,6 +11474,7 @@ FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FShar FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FSharpTokenKind HashLight FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FSharpTokenKind HashLine FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FSharpTokenKind HighPrecedenceBracketApp +FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FSharpTokenKind HighPrecedenceGreaterRightBracketApp FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FSharpTokenKind HighPrecedenceParenthesisApp FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FSharpTokenKind HighPrecedenceTypeApp FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FSharpTokenKind Identifier @@ -11662,6 +11666,7 @@ FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FShar FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FSharpTokenKind get_HashLight() FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FSharpTokenKind get_HashLine() FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FSharpTokenKind get_HighPrecedenceBracketApp() +FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FSharpTokenKind get_HighPrecedenceGreaterRightBracketApp() FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FSharpTokenKind get_HighPrecedenceParenthesisApp() FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FSharpTokenKind get_HighPrecedenceTypeApp() FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FSharpTokenKind get_Identifier() diff --git a/tests/FSharp.Compiler.Service.Tests/Symbols.fs b/tests/FSharp.Compiler.Service.Tests/Symbols.fs index 67b62e36827..812dfb15e3a 100644 --- a/tests/FSharp.Compiler.Service.Tests/Symbols.fs +++ b/tests/FSharp.Compiler.Service.Tests/Symbols.fs @@ -258,7 +258,7 @@ 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 @@ -282,7 +282,7 @@ let x = 123 symbol.Attributes[0].TypeArgs[0].AbbreviatedType.TypeDefinition.CompiledName |> should equal "Int32" ) - [] + [] let ``Digest record attribute type parameters`` () = let source = """ open System 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/RecordAttributeWithTypeArg.fs.bsl b/tests/service/data/SyntaxTree/Attribute/RecordAttributeWithTypeArg.fs.bsl index 90ac718489c..59cd3d93571 100644 --- a/tests/service/data/SyntaxTree/Attribute/RecordAttributeWithTypeArg.fs.bsl +++ b/tests/service/data/SyntaxTree/Attribute/RecordAttributeWithTypeArg.fs.bsl @@ -11,11 +11,11 @@ ImplFile [{ TypeName = SynLongIdent ([Foo], [], [None]) TypeArgs = [LongIdent (SynLongIdent ([int], [], [None]))] - ArgExpr = Const (Unit, (1,2--1,5)) + ArgExpr = Const (Unit, (1,2--1,10)) Target = None AppliesToGetterAndSetter = false - Range = (1,2--1,5) }] - Range = (1,0--1,11) }], None, [], [Bar], + 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 @@ -35,5 +35,3 @@ ImplFile None, (1,0--5,5), { LeadingKeyword = None })], (true, true), { ConditionalDirectives = [] CodeComments = [] }, set [])) - -(1,10)-(1,11) parse error Unexpected symbol '>' in attribute list diff --git a/tests/service/data/SyntaxTree/TypeParameters/Attribute.fs b/tests/service/data/SyntaxTree/TypeParameters/Attribute.fs index df575c8551a..30b00371ce6 100644 --- a/tests/service/data/SyntaxTree/TypeParameters/Attribute.fs +++ b/tests/service/data/SyntaxTree/TypeParameters/Attribute.fs @@ -1,5 +1,5 @@ [>>] do() -[>(NamedArg1="Foo", NamedArg2="Bar")>] +[>(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 index 44ae2088062..f870a9d1214 100644 --- a/tests/service/data/SyntaxTree/TypeParameters/Attribute.fs.bsl +++ b/tests/service/data/SyntaxTree/TypeParameters/Attribute.fs.bsl @@ -14,11 +14,11 @@ ImplFile 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,16)) + ArgExpr = Const (Unit, (1,2--1,36)) Target = None AppliesToGetterAndSetter = false - Range = (1,2--1,16) }] - Range = (1,0--1,37) }], (1,0--1,37)); + 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 = @@ -27,13 +27,19 @@ ImplFile [Var (SynTypar (a, None, false), (4,14--4,16)); LongIdent (SynLongIdent ([string], [], [None])); Intersection - (Some (SynTypar (T, HeadType, false)), - [App - (LongIdent (SynLongIdent ([List], [], [None])), - Some (4,33--4,34), - [LongIdent (SynLongIdent ([int], [], [None]))], [], - Some (4,37--4,38), false, (4,29--4,38))], - (4,24--4,38), { AmpersandRanges = [(4,27--4,28)] })] + (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 @@ -47,11 +53,11 @@ ImplFile SynLongIdent ([op_Equality], [], [Some (OriginalNotation "=")]), None, - (4,49--4,50)), Ident NamedArg1, - (4,40--4,50)), + (4,61--4,62)), Ident NamedArg1, + (4,52--4,62)), Const - (String ("Foo", Regular, (4,50--4,55)), - (4,50--4,55)), (4,40--4,55)); + (String ("Foo", Regular, (4,62--4,67)), + (4,62--4,67)), (4,52--4,67)); App (NonAtomic, false, App @@ -61,21 +67,18 @@ ImplFile SynLongIdent ([op_Equality], [], [Some (OriginalNotation "=")]), None, - (4,66--4,67)), Ident NamedArg2, - (4,57--4,67)), + (4,78--4,79)), Ident NamedArg2, + (4,69--4,79)), Const - (String ("Bar", Regular, (4,67--4,72)), - (4,67--4,72)), (4,57--4,72))], [(4,55--4,56)], - (4,40--4,72)), (4,39--4,40), Some (4,72--4,73), - (4,39--4,73)) + (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,73) }] - Range = (4,0--4,75) }], (4,0--4,75))], PreXmlDocEmpty, [], None, - (1,0--4,75), { LeadingKeyword = None })], (true, true), - { ConditionalDirectives = [] - CodeComments = [] }, set [])) - -(1,36)-(1,37) parse error Unexpected symbol '>' in attribute list -(4,29)-(4,38) parse error Constraint intersection syntax may only be used with flexible types, e.g. '#IDisposable & #ISomeInterface'. -(4,0)-(4,75) parse error Cannot find code target for this attribute, possibly because the code after the attribute is incomplete. + 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 [])) From 65664608a548973fe04b1a3724ba82677dc0137f Mon Sep 17 00:00:00 2001 From: Mackenzie F Libby Date: Sat, 1 Jun 2024 03:26:24 -0400 Subject: [PATCH 12/19] cleanup --- src/Compiler/Service/ServiceLexing.fs | 3 --- src/Compiler/Service/ServiceLexing.fsi | 1 - src/Compiler/SyntaxTree/LexFilter.fs | 2 +- src/Compiler/pars.fsy | 1 - ...rp.Compiler.Service.SurfaceArea.netstandard20.release.bsl | 5 ----- 5 files changed, 1 insertion(+), 11 deletions(-) diff --git a/src/Compiler/Service/ServiceLexing.fs b/src/Compiler/Service/ServiceLexing.fs index c4d430a77f3..9abe2199dc0 100644 --- a/src/Compiler/Service/ServiceLexing.fs +++ b/src/Compiler/Service/ServiceLexing.fs @@ -392,7 +392,6 @@ module internal TokenClassifications = | HIGH_PRECEDENCE_PAREN_APP | FIXED | HIGH_PRECEDENCE_BRACK_APP - | HIGH_PRECEDENCE_GRBRACK_APP | TYPE_COMING_SOON | TYPE_IS_HERE | MODULE_COMING_SOON @@ -1314,7 +1313,6 @@ type FSharpTokenKind = | HighPrecedenceTypeApp | HighPrecedenceParenthesisApp | HighPrecedenceBracketApp - | HighPrecedenceGreaterRightBracketApp | Extern | Void | Public @@ -1526,7 +1524,6 @@ type FSharpToken = | HIGH_PRECEDENCE_TYAPP -> FSharpTokenKind.HighPrecedenceTypeApp | HIGH_PRECEDENCE_PAREN_APP -> FSharpTokenKind.HighPrecedenceParenthesisApp | HIGH_PRECEDENCE_BRACK_APP -> FSharpTokenKind.HighPrecedenceBracketApp - | HIGH_PRECEDENCE_GRBRACK_APP -> FSharpTokenKind.HighPrecedenceGreaterRightBracketApp | EXTERN -> FSharpTokenKind.Extern | VOID -> FSharpTokenKind.Void | PUBLIC -> FSharpTokenKind.Public diff --git a/src/Compiler/Service/ServiceLexing.fsi b/src/Compiler/Service/ServiceLexing.fsi index 87c0a98317c..ee2ab7411d5 100755 --- a/src/Compiler/Service/ServiceLexing.fsi +++ b/src/Compiler/Service/ServiceLexing.fsi @@ -399,7 +399,6 @@ type public FSharpTokenKind = | HighPrecedenceTypeApp | HighPrecedenceParenthesisApp | HighPrecedenceBracketApp - | HighPrecedenceGreaterRightBracketApp | Extern | Void | Public diff --git a/src/Compiler/SyntaxTree/LexFilter.fs b/src/Compiler/SyntaxTree/LexFilter.fs index ae24e907ab5..866295bea66 100644 --- a/src/Compiler/SyntaxTree/LexFilter.fs +++ b/src/Compiler/SyntaxTree/LexFilter.fs @@ -1131,7 +1131,7 @@ type LexFilterImpl ( 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, HIGH_PRECEDENCE_GRBRACK_APP, -1, 0), false) :: stack + //stack <- (pool.UseShiftedLocation(dotTokenTop, HIGH_PRECEDENCE_GRBRACK_APP, -1, 0), false) :: stack stack <- (pool.UseShiftedLocation(dotTokenTop, GREATER_RBRACK, -1, 0), false) :: stack false else diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index 6cd25eb6e76..cd2c1da6a7d 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -6876,7 +6876,6 @@ interpolatedString: opt_HIGH_PRECEDENCE_APP: | HIGH_PRECEDENCE_BRACK_APP { } | HIGH_PRECEDENCE_PAREN_APP { } - | HIGH_PRECEDENCE_GRBRACK_APP { } | /* EMPTY */ { } opt_HIGH_PRECEDENCE_TYAPP: 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 dce7a9ddb9c..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 @@ -10894,7 +10894,6 @@ FSharp.Compiler.Tokenization.FSharpTokenKind+Tags: Int32 HashIf FSharp.Compiler.Tokenization.FSharpTokenKind+Tags: Int32 HashLight FSharp.Compiler.Tokenization.FSharpTokenKind+Tags: Int32 HashLine FSharp.Compiler.Tokenization.FSharpTokenKind+Tags: Int32 HighPrecedenceBracketApp -FSharp.Compiler.Tokenization.FSharpTokenKind+Tags: Int32 HighPrecedenceGreaterRightBracketApp FSharp.Compiler.Tokenization.FSharpTokenKind+Tags: Int32 HighPrecedenceParenthesisApp FSharp.Compiler.Tokenization.FSharpTokenKind+Tags: Int32 HighPrecedenceTypeApp FSharp.Compiler.Tokenization.FSharpTokenKind+Tags: Int32 Identifier @@ -11090,7 +11089,6 @@ FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean IsHashIf FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean IsHashLight FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean IsHashLine FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean IsHighPrecedenceBracketApp -FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean IsHighPrecedenceGreaterRightBracketApp FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean IsHighPrecedenceParenthesisApp FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean IsHighPrecedenceTypeApp FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean IsIdentifier @@ -11282,7 +11280,6 @@ FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean get_IsHashIf() FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean get_IsHashLight() FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean get_IsHashLine() FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean get_IsHighPrecedenceBracketApp() -FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean get_IsHighPrecedenceGreaterRightBracketApp() FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean get_IsHighPrecedenceParenthesisApp() FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean get_IsHighPrecedenceTypeApp() FSharp.Compiler.Tokenization.FSharpTokenKind: Boolean get_IsIdentifier() @@ -11474,7 +11471,6 @@ FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FShar FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FSharpTokenKind HashLight FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FSharpTokenKind HashLine FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FSharpTokenKind HighPrecedenceBracketApp -FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FSharpTokenKind HighPrecedenceGreaterRightBracketApp FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FSharpTokenKind HighPrecedenceParenthesisApp FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FSharpTokenKind HighPrecedenceTypeApp FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FSharpTokenKind Identifier @@ -11666,7 +11662,6 @@ FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FShar FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FSharpTokenKind get_HashLight() FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FSharpTokenKind get_HashLine() FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FSharpTokenKind get_HighPrecedenceBracketApp() -FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FSharpTokenKind get_HighPrecedenceGreaterRightBracketApp() FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FSharpTokenKind get_HighPrecedenceParenthesisApp() FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FSharpTokenKind get_HighPrecedenceTypeApp() FSharp.Compiler.Tokenization.FSharpTokenKind: FSharp.Compiler.Tokenization.FSharpTokenKind get_Identifier() From d6c846ecb4283dcc3421de4c0cdd84f2e9f1d8fa Mon Sep 17 00:00:00 2001 From: Mackenzie F Libby Date: Sat, 1 Jun 2024 06:49:53 -0400 Subject: [PATCH 13/19] added missing baseline for new ILEmission test --- .../RecordTypeAttributesWithTypeParam.fs | 1 - ...peParam.fs.RealInternalSignatureOff.il.bsl | 456 ++++++++++++++++++ ...ypeParam.fs.RealInternalSignatureOn.il.bsl | 456 ++++++++++++++++++ 3 files changed, 912 insertions(+), 1 deletion(-) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/RecordTypeAttributesWithTypeParam.fs.RealInternalSignatureOff.il.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/RecordTypeAttributesWithTypeParam.fs.RealInternalSignatureOn.il.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/RecordTypeAttributesWithTypeParam.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/RecordTypeAttributesWithTypeParam.fs index 226ce6cfd6a..43cd029185e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/RecordTypeAttributesWithTypeParam.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/RecordTypeAttributesWithTypeParam.fs @@ -4,7 +4,6 @@ open System type RecordLevelAttribute<^T>()= inherit Attribute() -//[] type FieldLevelAttribute<^T>()= inherit Attribute() 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 +{ +} + + + + + + From cdb2b4e130d08d5576c23dbc57ed440406814411 Mon Sep 17 00:00:00 2001 From: mflibby Date: Sun, 2 Jun 2024 09:04:38 -0400 Subject: [PATCH 14/19] more cleanup --- src/Compiler/AbstractIL/ilwrite.fs | 3 +-- src/Compiler/Checking/CheckDeclarations.fs | 2 +- src/Compiler/Checking/CheckExpressions.fs | 25 ++++------------------ src/Compiler/CodeGen/IlxGen.fs | 4 ++-- src/Compiler/Symbols/Symbols.fs | 4 ---- src/Compiler/SyntaxTree/LexFilter.fs | 3 --- 6 files changed, 8 insertions(+), 33 deletions(-) diff --git a/src/Compiler/AbstractIL/ilwrite.fs b/src/Compiler/AbstractIL/ilwrite.fs index 258e68afdcb..7463247e7da 100644 --- a/src/Compiler/AbstractIL/ilwrite.fs +++ b/src/Compiler/AbstractIL/ilwrite.fs @@ -1475,7 +1475,7 @@ and GetMethodRefAsCustomAttribType cenv _env fenv (mspec: ILMethodSpec) = (cat_MemberRef, GetMethodRefAsMemberRefIdx cenv fenv fenv mspec.MethodRef) else (cat_MemberRef, GetMethodRefAsMemberRefIdx cenv fenv fenv mspec.MethodRef) - //tenv + // -------------------------------------------------------------------- // ILAttributes --> CustomAttribute rows // -------------------------------------------------------------------- @@ -1941,7 +1941,6 @@ module Codebuf = | Unaligned4 -> emitInstrCode codebuf i_unaligned; codebuf.EmitByte 0x4 let rec emitInstr cenv codebuf env instr = - //printfn "%A" instr match instr with | si when isNoArgInstr si -> emitInstrCode codebuf (encodingsOfNoArgInstr si) diff --git a/src/Compiler/Checking/CheckDeclarations.fs b/src/Compiler/Checking/CheckDeclarations.fs index 8601b30cfe8..3ec30a82723 100644 --- a/src/Compiler/Checking/CheckDeclarations.fs +++ b/src/Compiler/Checking/CheckDeclarations.fs @@ -5808,7 +5808,7 @@ let CheckOneImplFile // Warn on version attributes. topAttrs.assemblyAttrs |> List.iter (function - | Attrib(tref, _, _typeParams, [ 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 4f13a61dd4a..0155d213fa6 100644 --- a/src/Compiler/Checking/CheckExpressions.fs +++ b/src/Compiler/Checking/CheckExpressions.fs @@ -11095,29 +11095,12 @@ and TcAttributeEx canFail (cenv: cenv) (env: TcEnv) attrTgt attrEx (synAttr: Syn let (SynLongIdent(tycon, _, _)) = synAttr.TypeName let arg = synAttr.ArgExpr let paramSynTypes = synAttr.TypeArgs - //check type parameters. tpenv remains empty if synAttr.TypeParams = [] - // let paramTTypes, tpenv = - // List.mapFold ( - // fun typeParameterEnv -> - // TcTypeOrMeasure - // (Some TyparKind.Type) - // cenv - // ImplicitlyBoundTyparsAllowed.NewTyparsOKButWarnIfNotRigid - // CheckConstraints.CheckCxs - // ItemOccurence.Open - // WarnOnIWSAM.Yes - // env - // typeParameterEnv ) - // emptyUnscopedTyparEnv - // synAttr.TypeParams - let tyParEnv = emptyUnscopedTyparEnv 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 - // let envinner = AddDeclaredTypars CheckForDuplicateTypars declaredTypars env - // let tpenv = TcTyparConstraints cenv ImplicitlyBoundTyparsAllowed.NewTyparsOK CheckConstraints.CheckCxs ItemOccurence.UseInAttribute envinner emptyUnscopedTyparEnv synTyparConstraints // 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 @@ -11129,7 +11112,7 @@ and TcAttributeEx canFail (cenv: cenv) (env: TcEnv) attrTgt attrEx (synAttr: Syn 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 tyParEnv mAttr tcref tinstEnclosing paramSynTypes 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))) @@ -11261,9 +11244,9 @@ and TcAttributeEx canFail (cenv: cenv) (env: TcEnv) attrTgt attrEx (synAttr: Syn let args = args |> List.map mkAttribExpr Attrib(tcref, ILAttrib ilMethRef, [], args, namedAttribArgMap, isAppliedToGetterOrSetter, Some constrainedTgts, m) - | Expr.App (InnerExprPat(ExprValWithPossibleTypeInst(vref, _, _, _)), _formalType, _typeArgs, args, _range) -> + | 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, _typeArgs, args, namedAttribArgMap, isAppliedToGetterOrSetter, Some constrainedTgts, mAttr) + Attrib(tcref, FSAttrib vref, typeArgs, args, namedAttribArgMap, isAppliedToGetterOrSetter, Some constrainedTgts, mAttr) | _ -> error (Error(FSComp.SR.tcCustomAttributeMustInvokeConstructor(), mAttr)) diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index 0da5938d4a1..379e36a43a0 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -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, _typeParams, args, props, _, _, m)) = +and GenAttr cenv g eenv (Attrib(_, k, typeArgs, args, props, _, _, m)) = let props = props |> List.map (fun (AttribNamedArg(s, ty, fld, AttribExpr(_, expr))) -> @@ -9967,7 +9967,7 @@ and GenAttr cenv g eenv (Attrib(_, k, _typeParams, args, props, _, _, m)) = let cval = GenAttribArg cenv g eenv expr ilTy (s, ilTy, fld, cval)) - let ilTyArgs = GenTypeArgs cenv m eenv.tyenv _typeParams + let ilTyArgs = GenTypeArgs cenv m eenv.tyenv typeArgs let mspec = match k with diff --git a/src/Compiler/Symbols/Symbols.fs b/src/Compiler/Symbols/Symbols.fs index c994db6a263..e7803b3627a 100644 --- a/src/Compiler/Symbols/Symbols.fs +++ b/src/Compiler/Symbols/Symbols.fs @@ -2720,10 +2720,6 @@ type FSharpAttribute(cenv: SymbolEnv, attrib: AttribInfo) = member _.AttributeType = FSharpEntity(cenv, attrib.TyconRef, []) - // member _.GenericArguments = - // protect <| fun () -> - // (attrib.TypeParams |> List.map (fun ty -> FSharpType(cenv, ty)) |> makeReadOnlyCollection) - member _.IsUnresolved = entityIsUnresolved(attrib.TyconRef) member _.ConstructorArguments = diff --git a/src/Compiler/SyntaxTree/LexFilter.fs b/src/Compiler/SyntaxTree/LexFilter.fs index 866295bea66..7d54ec49f75 100644 --- a/src/Compiler/SyntaxTree/LexFilter.fs +++ b/src/Compiler/SyntaxTree/LexFilter.fs @@ -1131,7 +1131,6 @@ type LexFilterImpl ( 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, HIGH_PRECEDENCE_GRBRACK_APP, -1, 0), false) :: stack stack <- (pool.UseShiftedLocation(dotTokenTop, GREATER_RBRACK, -1, 0), false) :: stack false else @@ -1227,8 +1226,6 @@ type LexFilterImpl ( | INFIX_COMPARE_OP (TyparsCloseOp(greaters, afterOp) as opstr) -> match afterOp with | ValueNone -> () - //delayToken(pool.UseShiftedLocation(tokenTup,GREATER false, 1, 0)) - //delayToken(pool.UseShiftedLocation(tokenTup,)) | ValueSome tok -> delayToken (pool.UseShiftedLocation(tokenTup, tok, greaters.Length, 0)) for i = greaters.Length - 1 downto 0 do delayToken (pool.UseShiftedLocation(tokenTup, greaters[i] res, i, -opstr.Length + i + 1)) From 24d679a42db6c450d12d6a147ab1700f5975a14e Mon Sep 17 00:00:00 2001 From: Mackenzie F Libby Date: Thu, 6 Jun 2024 23:40:43 -0400 Subject: [PATCH 15/19] fully implemented type args into other production cases and added testing to suit --- src/Compiler/pars.fsy | 38 +++++++++++++------ .../AttributeWithTargetAndTypeArgs.fs | 3 ++ .../AttributeWithTargetAndTypeArgs.fs.bsl | 24 ++++++++++++ 3 files changed, 54 insertions(+), 11 deletions(-) create mode 100644 tests/service/data/SyntaxTree/Attribute/AttributeWithTargetAndTypeArgs.fs create mode 100644 tests/service/data/SyntaxTree/Attribute/AttributeWithTargetAndTypeArgs.fs.bsl diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index cd2c1da6a7d..a27f083b49c 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -1506,22 +1506,20 @@ attributeListElements: /* One custom attribute */ -attribute: - /* A custom attribute with generic type parameters - some.good.AttributeName<^SomeTyPar>(and, args) - */ +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; 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 */ - | 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; TypeArgs = []; Target = None; AppliesToGetterAndSetter = false; Range = m }: SynAttribute) } /* A custom attribute with an attribute target */ | attributeTarget path opt_HIGH_PRECEDENCE_APP opt_atomicExprAfterType @@ -1529,13 +1527,31 @@ attribute: let startRange = match $1 with Some(ident:Ident) -> ident.idRange | None -> $2.Range let m = unionRanges startRange arg.Range ({ 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; 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 */ 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 [])) From 1e886bea81f0f5613273511f867520630f411fea Mon Sep 17 00:00:00 2001 From: Mackenzie F Libby Date: Thu, 13 Jun 2024 03:56:18 -0400 Subject: [PATCH 16/19] revert irrelevant formatting change --- src/Compiler/Facilities/prim-parsing.fs | 2 +- src/Compiler/lex.fsl | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Compiler/Facilities/prim-parsing.fs b/src/Compiler/Facilities/prim-parsing.fs index 3e76b886089..3088a5579ed 100644 --- a/src/Compiler/Facilities/prim-parsing.fs +++ b/src/Compiler/Facilities/prim-parsing.fs @@ -173,7 +173,7 @@ module internal Implementation = // First check the sparse lookaside table // Performance note: without this lookaside table the binary chop in ReadAssoc - // takes up around 10% of parsing time + // takes up around 10% of of parsing time // for parsing intensive samples such as the bootstrapped F# compiler. // // NOTE: using a .NET Dictionary for this int -> int table looks like it could be sub-optimal. diff --git a/src/Compiler/lex.fsl b/src/Compiler/lex.fsl index 71974557cce..cd73aa454c2 100644 --- a/src/Compiler/lex.fsl +++ b/src/Compiler/lex.fsl @@ -950,23 +950,24 @@ rule token (args: LexArgs) (skip: bool) = parse | "~" { errorR (Error(FSComp.SR.lexInvalidIdentifier(), lexbuf.LexemeRange)) RESERVED } - | ignored_op_char* '*' '*' op_char* { checkExprOp lexbuf; INFIX_STAR_STAR_OP(lexeme lexbuf) } - | ignored_op_char* ('*' | '/'|'%') op_char* { checkExprOp lexbuf; INFIX_STAR_DIV_MOD_OP(lexeme lexbuf) } + | ignored_op_char* '*' '*' op_char* { checkExprOp lexbuf; INFIX_STAR_STAR_OP(lexeme lexbuf) } - | ignored_op_char* ('+'|'-') op_char* { checkExprOp lexbuf; PLUS_MINUS_OP(lexeme lexbuf) } + | ignored_op_char* ('*' | '/'|'%') op_char* { checkExprOp lexbuf; INFIX_STAR_DIV_MOD_OP(lexeme lexbuf) } - | ignored_op_char* ('@'|'^') op_char* { checkExprOp lexbuf; INFIX_AT_HAT_OP(lexeme lexbuf) } + | ignored_op_char* ('+'|'-') op_char* { checkExprOp lexbuf; PLUS_MINUS_OP(lexeme lexbuf) } - | ignored_op_char* ('=' | "!=" | '<' | '$') op_char* { checkExprOp lexbuf; INFIX_COMPARE_OP(lexeme lexbuf) } + | ignored_op_char* ('@'|'^') op_char* { checkExprOp lexbuf; INFIX_AT_HAT_OP(lexeme lexbuf) } + + | ignored_op_char* ('=' | "!=" | '<' | '$') op_char* { checkExprOp lexbuf; INFIX_COMPARE_OP(lexeme lexbuf) } - | ignored_op_char* ('>') op_char* { checkExprGreaterColonOp lexbuf; INFIX_COMPARE_OP(lexeme lexbuf) } + | ignored_op_char* ('>') op_char* { checkExprGreaterColonOp lexbuf; INFIX_COMPARE_OP(lexeme lexbuf) } - | ignored_op_char* ('&') op_char* { checkExprOp lexbuf; INFIX_AMP_OP(lexeme lexbuf) } + | ignored_op_char* ('&') op_char* { checkExprOp lexbuf; INFIX_AMP_OP(lexeme lexbuf) } - | ignored_op_char* '|' op_char* { checkExprOp lexbuf; INFIX_BAR_OP(lexeme lexbuf) } + | ignored_op_char* '|' op_char* { checkExprOp lexbuf; INFIX_BAR_OP(lexeme lexbuf) } - | ignored_op_char* ('!' | '~' ) op_char* { checkExprOp lexbuf; PREFIX_OP(lexeme lexbuf) } + | ignored_op_char* ('!' | '~' ) op_char* { checkExprOp lexbuf; PREFIX_OP(lexeme lexbuf) } | ".[]" | ".[]<-" | ".[,]<-" | ".[,,]<-" | ".[,,,]<-" | ".[,,,]" | ".[,,]" | ".[,]" | ".[..]" | ".[..,..]" | ".[..,..,..]" | ".[..,..,..,..]" From 47c5dc776d006c4367c89fa601211df70d69831b Mon Sep 17 00:00:00 2001 From: Mackenzie F Libby Date: Fri, 14 Jun 2024 02:53:24 -0400 Subject: [PATCH 17/19] formatting adjustment to avoid unnecessary diff --- .../data/SyntaxTree/Attribute/RangeOfAttribute.fs | 2 +- .../data/SyntaxTree/Attribute/RangeOfAttribute.fs.bsl | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs b/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs index 0d30faed047..f69eaad8c30 100644 --- a/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs +++ b/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs @@ -1,3 +1,3 @@ -[] +[] do () diff --git a/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs.bsl b/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs.bsl index f7ad46641f7..1fb65e4838c 100644 --- a/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs.bsl +++ b/tests/service/data/SyntaxTree/Attribute/RangeOfAttribute.fs.bsl @@ -21,13 +21,13 @@ ImplFile [Some (OriginalNotation "=")]), None, (2,18--2,19)), Ident foo, (2,14--2,19)), Const - (String ("bar", Regular, (2,20--2,25)), - (2,20--2,25)), (2,14--2,25)), (2,13--2,14), - Some (2,25--2,26), (2,13--2,26)) + (String ("bar", Regular, (2,19--2,24)), + (2,19--2,24)), (2,14--2,24)), (2,13--2,14), + Some (2,24--2,25), (2,13--2,25)) Target = None AppliesToGetterAndSetter = false - Range = (2,2--2,26) }] - Range = (2,0--2,28) }], (2,0--2,28)); + Range = (2,2--2,25) }] + Range = (2,0--2,27) }], (2,0--2,27)); Expr (Do (Const (Unit, (3,3--3,5)), (3,0--3,5)), (3,0--3,5))], PreXmlDocEmpty, [], None, (2,0--4,0), { LeadingKeyword = None })], (true, true), { ConditionalDirectives = [] From 993d1febb0ab1feb8c1d3de74dde26bcf84499b3 Mon Sep 17 00:00:00 2001 From: Mackenzie F Libby Date: Thu, 20 Jun 2024 03:37:01 -0400 Subject: [PATCH 18/19] added alias generic test --- src/Compiler/SyntaxTree/LexFilter.fs | 5 +- .../Attribute/AliasedGenericAttribute.fs | 10 ++ ...tribute.fs.RealInternalSignatureOff.il.bsl | 103 ++++++++++++++++++ ...ttribute.fs.RealInternalSignatureOn.il.bsl | 89 +++++++++++++++ .../EmittedIL/Attribute/Attribute.fs | 58 +++++++++- 5 files changed, 262 insertions(+), 3 deletions(-) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/AliasedGenericAttribute.fs create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/AliasedGenericAttribute.fs.RealInternalSignatureOff.il.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/AliasedGenericAttribute.fs.RealInternalSignatureOn.il.bsl diff --git a/src/Compiler/SyntaxTree/LexFilter.fs b/src/Compiler/SyntaxTree/LexFilter.fs index 7d54ec49f75..cf2f03b87ec 100644 --- a/src/Compiler/SyntaxTree/LexFilter.fs +++ b/src/Compiler/SyntaxTree/LexFilter.fs @@ -1127,7 +1127,10 @@ type LexFilterImpl ( let dotTokenTup = peekNextTokenTup() stack <- (pool.UseLocation(dotTokenTup, HIGH_PRECEDENCE_PAREN_APP), false) :: stack true - else if afterOp.IsNone && nextTokenIsAdjacentRBrack lookaheadTokenTup then + // 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 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 index c034cda6607..669a983826a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/Attribute.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/Attribute.fs @@ -16,7 +16,8 @@ module Attribute = |> ignoreWarnings |> verifyBaseline |> verifyILBaseline - + + //AttributeWithTypeParam [] let ``AttributeWithTypeParam_RealInternalSignatureOn_fs`` compilation = compilation @@ -28,7 +29,8 @@ module Attribute = compilation |> withRealInternalSignatureOff |> verifyCompilation - + + //RecordTypeAttributesWithTypeParam [] let ``RecordTypeAttributesWithTypeParam_RealInternalSignatureOn_fs`` compilation = compilation @@ -37,6 +39,58 @@ module Attribute = [] 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 \ No newline at end of file From 4255a3f3d6fd7ca4c6d28366bb080a4147996322 Mon Sep 17 00:00:00 2001 From: Mackenzie F Libby Date: Sun, 23 Jun 2024 02:05:37 -0400 Subject: [PATCH 19/19] added self reference generic attribute usage test --- .../EmittedIL/Attribute/Attribute.fs | 13 +++ .../SelfReferenceGenericAttributeUsage.fs | 8 ++ ...teUsage.fs.RealInternalSignatureOff.il.bsl | 92 +++++++++++++++++++ ...uteUsage.fs.RealInternalSignatureOn.il.bsl | 92 +++++++++++++++++++ 4 files changed, 205 insertions(+) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/SelfReferenceGenericAttributeUsage.fs create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/SelfReferenceGenericAttributeUsage.fs.RealInternalSignatureOff.il.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/SelfReferenceGenericAttributeUsage.fs.RealInternalSignatureOn.il.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/Attribute.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/Attribute.fs index 669a983826a..a0410c8a838 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/Attribute.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Attribute/Attribute.fs @@ -91,6 +91,19 @@ module Attribute = [] 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/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 +{ +} + + + + + +