Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Compiler/pars.fsy
Original file line number Diff line number Diff line change
Expand Up @@ -1530,9 +1530,11 @@ attributeListElements:
| attribute
{ [$1] }

| attributeListElements seps attribute
| attributeListElements SEMICOLON attribute /* Same line requires semicolon */
{ $1 @ [$3] }

| attributeListElements OBLOCKSEP attribute /* Different lines - no separator needed */
{ $1 @ [$3] }

/* One custom attribute */
attribute:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

[<MyAttribute(foo ="bar"); MyAttribute(foo ="bar")>]
do ()
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
ImplFile
(ParsedImplFileInput
("/root/Attribute/MultipleAttributes01.fs", false,
QualifiedNameOfFile MultipleAttributes01, [], [],
[SynModuleOrNamespace
([MultipleAttributes01], false, AnonModule,
[Attributes
([{ Attributes =
[{ TypeName = SynLongIdent ([MyAttribute], [], [None])
ArgExpr =
Paren
(App
(NonAtomic, false,
App
(NonAtomic, true,
LongIdent
(false,
SynLongIdent
([op_Equality], [],
[Some (OriginalNotation "=")]), None,
(2,18--2,19)), Ident foo, (2,14--2,19)),
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))
Target = None
AppliesToGetterAndSetter = false
Range = (2,2--2,25) };
{ TypeName = SynLongIdent ([MyAttribute], [], [None])
ArgExpr =
Paren
(App
(NonAtomic, false,
App
(NonAtomic, true,
LongIdent
(false,
SynLongIdent
([op_Equality], [],
[Some (OriginalNotation "=")]), None,
(2,43--2,44)), Ident foo, (2,39--2,44)),
Const
(String ("bar", Regular, (2,44--2,49)),
(2,44--2,49)), (2,39--2,49)), (2,38--2,39),
Some (2,49--2,50), (2,38--2,50))
Target = None
AppliesToGetterAndSetter = false
Range = (2,27--2,50) }]
Range = (2,0--2,52) }], (2,0--2,52));
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 = []
CodeComments = [] }, set []))
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

[<MyAttribute(foo ="bar")
MyAttribute(foo ="bar")>]
Comment on lines +2 to +3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth having a test where the second one is not indented far enough? Would it be considered offsides? What about a mixture of semicolons and newlines?

do ()
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
ImplFile
(ParsedImplFileInput
("/root/Attribute/MultipleAttributes02.fs", false,
QualifiedNameOfFile MultipleAttributes02, [], [],
[SynModuleOrNamespace
([MultipleAttributes02], false, AnonModule,
[Attributes
([{ Attributes =
[{ TypeName = SynLongIdent ([MyAttribute], [], [None])
ArgExpr =
Paren
(App
(NonAtomic, false,
App
(NonAtomic, true,
LongIdent
(false,
SynLongIdent
([op_Equality], [],
[Some (OriginalNotation "=")]), None,
(2,18--2,19)), Ident foo, (2,14--2,19)),
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))
Target = None
AppliesToGetterAndSetter = false
Range = (2,2--2,25) }]
Range = (2,0--2,25) }], (2,0--2,25));
Expr
(App
(Atomic, false, Ident MyAttribute,
Paren
(App
(NonAtomic, false,
App
(NonAtomic, true,
LongIdent
(false,
SynLongIdent
([op_Equality], [], [Some (OriginalNotation "=")]),
None, (3,18--3,19)), Ident foo, (3,14--3,19)),
Const
(String ("bar", Regular, (3,19--3,24)), (3,19--3,24)),
(3,14--3,24)), (3,13--3,14), Some (3,24--3,25),
(3,13--3,25)), (3,2--3,25)), (3,2--3,25))], PreXmlDocEmpty,
[], None, (2,0--3,25), { LeadingKeyword = None })], (true, true),
{ ConditionalDirectives = []
CodeComments = [] }, set []))

(3,2)-(3,13) parse error Unexpected identifier in attribute list
(3,25)-(3,27) parse error Unexpected symbol '>]' in implementation file
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

[<MyAttribute(foo ="bar");
MyAttribute(foo ="bar")>]
do ()
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
ImplFile
(ParsedImplFileInput
("/root/Attribute/MultipleAttributes03.fs", false,
QualifiedNameOfFile MultipleAttributes03, [], [],
[SynModuleOrNamespace
([MultipleAttributes03], false, AnonModule,
[Attributes
([{ Attributes =
[{ TypeName = SynLongIdent ([MyAttribute], [], [None])
ArgExpr =
Paren
(App
(NonAtomic, false,
App
(NonAtomic, true,
LongIdent
(false,
SynLongIdent
([op_Equality], [],
[Some (OriginalNotation "=")]), None,
(2,18--2,19)), Ident foo, (2,14--2,19)),
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))
Target = None
AppliesToGetterAndSetter = false
Range = (2,2--2,25) };
{ TypeName = SynLongIdent ([MyAttribute], [], [None])
ArgExpr =
Paren
(App
(NonAtomic, false,
App
(NonAtomic, true,
LongIdent
(false,
SynLongIdent
([op_Equality], [],
[Some (OriginalNotation "=")]), None,
(3,18--3,19)), Ident foo, (3,14--3,19)),
Const
(String ("bar", Regular, (3,19--3,24)),
(3,19--3,24)), (3,14--3,24)), (3,13--3,14),
Some (3,24--3,25), (3,13--3,25))
Target = None
AppliesToGetterAndSetter = false
Range = (3,2--3,25) }]
Range = (2,0--3,27) }], (2,0--3,27));
Expr (Do (Const (Unit, (4,3--4,5)), (4,0--4,5)), (4,0--4,5))],
PreXmlDocEmpty, [], None, (2,0--5,0), { LeadingKeyword = None })],
(true, true), { ConditionalDirectives = []
CodeComments = [] }, set []))
Loading