const char *curPointer = getToken().getLoc().getPointer();
consumeToken(Token::colon);
if (!consumeIf(Token::colon)) {
- state.lex.resetPointer(curPointer);
- consumeToken();
+ if (getToken().isNot(Token::eof, Token::error)) {
+ state.lex.resetPointer(curPointer);
+ consumeToken();
+ }
break;
}
// Parse the reference itself.
nameId = builder.getStringAttr(getTokenSpelling());
else
return emitError("expected attribute name");
+
+ if (nameId->size() == 0)
+ return emitError("expected valid attribute name");
+
if (!seenKeys.insert(*nameId).second)
return emitError("duplicate key '")
<< nameId->getValue() << "' in dictionary attribute";
// -----
func @foo() {} // expected-error {{expected non-empty function body}}
+
+// -----
+
+// expected-error@+1 {{expected valid attribute name}}
+"t"(){""}
+
+// -----
+
+// expected-error@+2 {{expected ']'}}
+"f"() { b = [@m:
+