Skip to content

Commit 0307ff6

Browse files
authored
Handle optional extra field in warn_unused_result (#863)
Fixes #861
1 parent d3c9135 commit 0307ff6

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

ast/warn_unused_result_attr.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ type WarnUnusedResultAttr struct {
1010
}
1111

1212
func parseWarnUnusedResultAttr(line string) *WarnUnusedResultAttr {
13-
groups := groupsFromRegex(`<(?P<position>.*)>(?P<inherited> Inherited)?( warn_unused_result)?`, line)
13+
groups := groupsFromRegex(`<(?P<position>.*)>(?P<inherited> Inherited)?( warn_unused_result)?( "")?`, line)
1414

1515
return &WarnUnusedResultAttr{
1616
Addr: ParseAddress(groups["address"]),

ast/warn_unused_result_attr_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ func TestWarnUnusedResultAttr(t *testing.T) {
2424
Inherited: true,
2525
ChildNodes: []Node{},
2626
},
27+
`0x55c2df4f93b8 <col:53> warn_unused_result ""`: &WarnUnusedResultAttr{
28+
Addr: 0x55c2df4f93b8,
29+
Pos: NewPositionFromString("col:53"),
30+
Inherited: false,
31+
ChildNodes: []Node{},
32+
},
2733
}
2834

2935
runNodeTests(t, nodes)

0 commit comments

Comments
 (0)