// Check for a child location.
if (consumeIf(Token::l_paren)) {
- auto childSourceLoc = getToken().getLoc();
-
// Parse the child location.
LocationAttr childLoc;
if (parseLocationInstance(childLoc))
return failure();
- // The child must not be another NameLoc.
- if (childLoc.isa<NameLoc>())
- return emitError(childSourceLoc,
- "child of NameLoc cannot be another NameLoc");
loc = NameLoc::get(StringAttr::get(ctx, str), childLoc);
// Parse the closing ')'.
// -----
-func @location_name_child_is_name() {
-^bb:
- return loc("foo"("foo")) // expected-error {{child of NameLoc cannot be another NameLoc}}
-}
-
-// -----
-
func @location_callsite_missing_l_paren() {
^bb:
return loc(callsite unknown // expected-error {{expected '(' in callsite location}}
"foo.yield"(%1) : (i32) -> ()
}) : () -> ()
+// CHECK-LABEL: func @location_name_child_is_name
+func @location_name_child_is_name() {
+ // CHECK: "foo"("foo")
+ return loc("foo"("foo"))
+}
+
// CHECK-ALIAS: #[[LOC]] = loc("out_of_line_location")
#loc = loc("out_of_line_location")