File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -159,6 +159,12 @@ func (bl *blockLabels) Current() []string {
159
159
if ! diags .HasErrors () {
160
160
labelNames = append (labelNames , labelString )
161
161
}
162
+ } else if len (tokens ) == 2 &&
163
+ tokens [0 ].Type == hclsyntax .TokenOQuote &&
164
+ tokens [1 ].Type == hclsyntax .TokenCQuote {
165
+ // An open quote followed immediately by a closing quote is a
166
+ // valid but unusual blank string label.
167
+ labelNames = append (labelNames , "" )
162
168
}
163
169
164
170
default :
Original file line number Diff line number Diff line change @@ -107,6 +107,13 @@ escape "\u0041" {
107
107
` ,
108
108
[]string {"\u0041 " },
109
109
},
110
+ {
111
+ `
112
+ blank "" {
113
+ }
114
+ ` ,
115
+ []string {"" },
116
+ },
110
117
}
111
118
112
119
for _ , test := range tests {
@@ -414,7 +421,7 @@ func TestBlockSetLabels(t *testing.T) {
414
421
{
415
422
`foo "hoge" /* foo */ "" {}` ,
416
423
"foo" ,
417
- []string {"hoge" },
424
+ []string {"hoge" , "" },
418
425
[]string {"fuga" }, // force quoted form even if the old one is unquoted.
419
426
Tokens {
420
427
{
You can’t perform that action at this time.
0 commit comments