Skip to content

Commit ebf028b

Browse files
gordyffacebook-github-bot
authored andcommitted
Use directive location where it makes sense
Reviewed By: captbaritone Differential Revision: D64558729 fbshipit-source-id: 22d1e4e7bfaf28a3c2787fff5912a16d65b3807d
1 parent b0c92e8 commit ebf028b

File tree

56 files changed

+91
-86
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+91
-86
lines changed

compiler/crates/graphql-ir/src/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,9 +1351,9 @@ impl<'schema, 'signatures, 'options> Builder<'schema, 'signatures, 'options> {
13511351
ValidationMessage::RepeatedNonRepeatableDirective {
13521352
name: directive.name.item,
13531353
},
1354-
repeated_directive.name.location,
1354+
repeated_directive.location,
13551355
)
1356-
.annotate("previously used here", directive.name.location),
1356+
.annotate("previously used here", directive.location),
13571357
]);
13581358
}
13591359
}

compiler/crates/graphql-ir/src/ir.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ impl InlineFragment {
452452
))),
453453
None => Err(vec![Diagnostic::error(
454454
ValidationMessage::FragmentAliasDirectiveMissingAs,
455-
directive.name.location,
455+
directive.location,
456456
)]),
457457
}
458458
}
@@ -722,7 +722,7 @@ fn alias_arg_as(alias_directive: &Directive) -> DiagnosticsResult<Option<WithLoc
722722
}
723723
_ => Err(vec![Diagnostic::error(
724724
ValidationMessage::FragmentAliasDirectiveDynamicNameArg,
725-
alias_directive.name.location,
725+
alias_directive.location,
726726
)]),
727727
},
728728
None => Ok(None),

compiler/crates/relay-compiler/tests/compile_relay_artifacts/fixtures/duplicate-directive.invalid.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ fragment duplicateDirectiveOnField on User {
1616
duplicate-directive.invalid.graphql:10:37
1717
9 │ fragment duplicateDirectiveOnField on User {
1818
10 │ name @customDirective(level: 1) @customDirective(level: 2)
19-
│ ^^^^^^^^^^^^^^^^
19+
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^
2020
11 │ }
2121

2222
ℹ︎ previously used here
2323

2424
duplicate-directive.invalid.graphql:10:10
2525
9 │ fragment duplicateDirectiveOnField on User {
2626
10 │ name @customDirective(level: 1) @customDirective(level: 2)
27-
│ ^^^^^^^^^^^^^^^^
27+
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^
2828
11 │ }
2929

3030

compiler/crates/relay-transforms/src/apply_fragment_arguments.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ impl ApplyFragmentArgumentsTransform<'_, '_, '_> {
443443
"Invalid usage of @no_inline on fragment '{}': this feature is gated and currently set to: {}",
444444
fragment.name.item, self.no_inline_feature
445445
),
446-
directive.name.location,
446+
directive.location,
447447
));
448448
}
449449

compiler/crates/relay-transforms/src/assignable_fragment_spread/transform_assignable_fragment_spreads_in_regular_queries.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ impl<'s> Transformer for AssignableFragmentSpread<'s> {
214214
ValidationMessage::AssignableFragmentSpreadNoOtherDirectives {
215215
disallowed_directive_name: directive.name.item.0,
216216
},
217-
directive.name.location,
217+
directive.location,
218218
));
219219
}
220220

compiler/crates/relay-transforms/src/assignable_fragment_spread/validate_assignable_directive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl<'a> Validator for AssignableDirective<'a> {
8484
ValidationMessage::AssignableDisallowOtherDirectives {
8585
disallowed_directive_name: directive.name.item.0,
8686
},
87-
directive.name.location,
87+
directive.location,
8888
))
8989
}
9090
}

compiler/crates/relay-transforms/src/assignable_fragment_spread/validate_updatable_directive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ impl<'a> Validator for UpdatableDirective<'a> {
304304
disallowed_directive_name: directive.name.item.0,
305305
outer_type_plural: self.executable_definition_info.unwrap().type_plural,
306306
},
307-
directive.name.location,
307+
directive.location,
308308
)])
309309
} else {
310310
Ok(())

compiler/crates/relay-transforms/src/client_edges.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ impl<'program, 'pc> ClientEdgesTransform<'program, 'pc> {
332332
ValidationMessage::ClientEdgeUnsupportedDirective {
333333
directive_name: directive.name.item,
334334
},
335-
directive.name.location,
335+
directive.location,
336336
));
337337
}
338338
}
@@ -350,7 +350,7 @@ impl<'program, 'pc> ClientEdgesTransform<'program, 'pc> {
350350
if let Some(directive) = waterfall_directive {
351351
self.errors.push(Diagnostic::error_with_data(
352352
ValidationMessageWithData::RelayResolversUnexpectedWaterfall,
353-
directive.name.location,
353+
directive.location,
354354
));
355355
}
356356

@@ -542,7 +542,7 @@ impl<'program, 'pc> ClientEdgesTransform<'program, 'pc> {
542542
if let Some(directive) = waterfall_directive {
543543
self.errors.push(Diagnostic::error_with_data(
544544
ValidationMessageWithData::RelayResolversUnexpectedWaterfall,
545-
directive.name.location,
545+
directive.location,
546546
));
547547
}
548548
return self.default_transform_linked_field(field);
@@ -684,7 +684,7 @@ impl Transformer for ClientEdgesTransform<'_, '_> {
684684
{
685685
self.errors.push(Diagnostic::error_with_data(
686686
ValidationMessageWithData::RelayResolversUnexpectedWaterfall,
687-
directive.name.location,
687+
directive.location,
688688
));
689689
}
690690
self.default_transform_scalar_field(field)

compiler/crates/relay-transforms/src/declarative_connection.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ impl Transformer for DeclarativeConnectionMutationTransform<'_> {
142142
field_name: field.alias_or_name(self.schema),
143143
current_type: self.schema.get_type_string(&field_definition.type_),
144144
},
145-
delete_directive.name.location,
145+
delete_directive.location,
146146
));
147147
Transformed::Keep
148148
} else {
@@ -198,7 +198,7 @@ impl Transformer for DeclarativeConnectionMutationTransform<'_> {
198198
node_directive_name: node_directive.name.item,
199199
field_name: field.alias_or_name(self.schema),
200200
},
201-
edge_directive.name.location,
201+
edge_directive.location,
202202
));
203203
transformed_field
204204
}
@@ -211,7 +211,7 @@ impl Transformer for DeclarativeConnectionMutationTransform<'_> {
211211
ValidationMessage::ConnectionsArgumentRequired {
212212
directive_name: edge_directive.name.item,
213213
},
214-
edge_directive.name.location,
214+
edge_directive.location,
215215
));
216216
transformed_field
217217
}
@@ -262,7 +262,7 @@ impl Transformer for DeclarativeConnectionMutationTransform<'_> {
262262
directive_name: edge_directive.name.item,
263263
field_name: field.alias_or_name(self.schema),
264264
},
265-
edge_directive.name.location,
265+
edge_directive.location,
266266
));
267267
Transformed::Keep
268268
}
@@ -277,7 +277,7 @@ impl Transformer for DeclarativeConnectionMutationTransform<'_> {
277277
ValidationMessage::ConnectionsArgumentRequired {
278278
directive_name: node_directive.name.item,
279279
},
280-
node_directive.name.location,
280+
node_directive.location,
281281
));
282282
transformed_field
283283
}
@@ -359,7 +359,7 @@ impl Transformer for DeclarativeConnectionMutationTransform<'_> {
359359
.schema
360360
.get_type_string(&field_definition.type_),
361361
},
362-
node_directive.name.location,
362+
node_directive.location,
363363
));
364364
Transformed::Keep
365365
}
@@ -370,7 +370,7 @@ impl Transformer for DeclarativeConnectionMutationTransform<'_> {
370370
directive_name: node_directive.name.item,
371371
field_name: field.alias_or_name(self.schema),
372372
},
373-
node_directive.name.location,
373+
node_directive.location,
374374
));
375375
Transformed::Keep
376376
}

compiler/crates/relay-transforms/src/defer_stream.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl DeferStreamTransform<'_> {
9595
},
9696
prev.name.location,
9797
)
98-
.annotate("related location", directive.name.location),
98+
.annotate("related location", directive.location),
9999
);
100100
}
101101
None => {
@@ -318,7 +318,7 @@ impl<'s> Transformer for DeferStreamTransform<'s> {
318318
}
319319
self.errors.push(Diagnostic::error(
320320
ValidationMessage::InvalidDeferOnInlineFragment,
321-
directive.name.location,
321+
directive.location,
322322
));
323323
}
324324

@@ -353,7 +353,7 @@ impl<'s> Transformer for DeferStreamTransform<'s> {
353353
ValidationMessage::InvalidStreamOnScalarField {
354354
field_name: scalar_field.alias_or_name(&self.program.schema),
355355
},
356-
directive.name.location,
356+
directive.location,
357357
));
358358
}
359359
self.default_transform_scalar_field(scalar_field)
@@ -410,7 +410,7 @@ fn get_literal_string_argument(
410410
arg_name: arg.name.item,
411411
directive_name: directive.name.item,
412412
},
413-
directive.name.location,
413+
directive.location,
414414
))
415415
}
416416
} else {

0 commit comments

Comments
 (0)