Provide local paths for file tests. (#2830)

The intent of this change is that instead of paths looking like `explorer/testdata/foo/bar.carbon` (repo-relative), they're now just `bar.carbon` (local). The consequence is that paths should be a bit more durable in various environments, and just paths should be shorter and easier to read.

The explorer's prelude is an exception to this since it comes from data, rather than being the test target. Due to the change in approaches, it needs the regex again.

Uses #2829
This commit is contained in:
Jon Ross-Perkins
2023-05-18 10:20:51 -07:00
committed by GitHub
parent 3c15882f4e
commit 6b7a522b3f
495 changed files with 701 additions and 641 deletions
@@ -27,10 +27,10 @@
// NOTE: Move to its own directory when more tests are added.
fn F() {
// CHECK:STDERR: toolchain/parser/testdata/basics/fail_invalid_designators.carbon:[[@LINE+1]]:5: Expected identifier after `.`.
// CHECK:STDERR: fail_invalid_designators.carbon:[[@LINE+1]]:5: Expected identifier after `.`.
a.;
// CHECK:STDERR: toolchain/parser/testdata/basics/fail_invalid_designators.carbon:[[@LINE+1]]:5: Expected identifier after `.`.
// CHECK:STDERR: fail_invalid_designators.carbon:[[@LINE+1]]:5: Expected identifier after `.`.
a.fn;
// CHECK:STDERR: toolchain/parser/testdata/basics/fail_invalid_designators.carbon:[[@LINE+1]]:5: Expected identifier after `.`.
// CHECK:STDERR: fail_invalid_designators.carbon:[[@LINE+1]]:5: Expected identifier after `.`.
a.42;
}
@@ -8,5 +8,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/basics/fail_no_intro_with_semi.carbon:[[@LINE+1]]:1: Unrecognized declaration introducer.
// CHECK:STDERR: fail_no_intro_with_semi.carbon:[[@LINE+1]]:1: Unrecognized declaration introducer.
foo;
@@ -8,5 +8,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/basics/fail_no_intro_without_semi.carbon:[[@LINE+1]]:1: Unrecognized declaration introducer.
// CHECK:STDERR: fail_no_intro_without_semi.carbon:[[@LINE+1]]:1: Unrecognized declaration introducer.
foo bar baz
@@ -16,7 +16,7 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/basics/fail_paren_match_regression.carbon:[[@LINE+3]]:5: Expected pattern in `var` declaration.
// CHECK:STDERR: toolchain/parser/testdata/basics/fail_paren_match_regression.carbon:[[@LINE+2]]:12: Expected `,` or `)`.
// CHECK:STDERR: toolchain/parser/testdata/basics/fail_paren_match_regression.carbon:[[@LINE+1]]:15: Expected `;` after expression.
// CHECK:STDERR: fail_paren_match_regression.carbon:[[@LINE+3]]:5: Expected pattern in `var` declaration.
// CHECK:STDERR: fail_paren_match_regression.carbon:[[@LINE+2]]:12: Expected `,` or `)`.
// CHECK:STDERR: fail_paren_match_regression.carbon:[[@LINE+1]]:15: Expected `;` after expression.
var = (foo {})
@@ -30,7 +30,7 @@
// CHECK:STDOUT: ]
fn foo() {
// CHECK:STDERR: toolchain/parser/testdata/for/fail_colon_instead_of_in.carbon:[[@LINE+1]]:19: `:` should be replaced by `in`.
// CHECK:STDERR: fail_colon_instead_of_in.carbon:[[@LINE+1]]:19: `:` should be replaced by `in`.
for (var x: i32 : y) {
Print(x);
}
+1 -1
View File
@@ -30,7 +30,7 @@
// CHECK:STDOUT: ]
fn foo() {
// CHECK:STDERR: toolchain/parser/testdata/for/fail_missing_in.carbon:[[@LINE+1]]:19: Expected `in` after loop `var` declaration.
// CHECK:STDERR: fail_missing_in.carbon:[[@LINE+1]]:19: Expected `in` after loop `var` declaration.
for (var x: i32 y) {
Print(x);
}
+1 -1
View File
@@ -25,7 +25,7 @@
// CHECK:STDOUT: ]
fn foo() {
// CHECK:STDERR: toolchain/parser/testdata/for/fail_missing_var.carbon:[[@LINE+1]]:8: Expected `var` declaration.
// CHECK:STDERR: fail_missing_var.carbon:[[@LINE+1]]:8: Expected `var` declaration.
for (x: i32 in y) {
Print(x);
}
@@ -10,5 +10,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/function/declaration/fail_identifier_instead_of_sig.carbon:[[@LINE+1]]:8: `fn` requires a `(` for parameters.
// CHECK:STDERR: fail_identifier_instead_of_sig.carbon:[[@LINE+1]]:8: `fn` requires a `(` for parameters.
fn foo bar;
@@ -16,7 +16,7 @@
// CHECK:STDOUT: ]
// Fix and uncomment this to test error handling.
// CHECK:STDERR: toolchain/parser/testdata/function/declaration/fail_missing_deduced_close.carbon:[[@LINE+2]]:7: Closing symbol does not match most recent opening symbol.
// CHECK:STDERR: toolchain/parser/testdata/function/declaration/fail_missing_deduced_close.carbon:[[@LINE+1]]:8: Expected parameter declaration.
// CHECK:STDERR: fail_missing_deduced_close.carbon:[[@LINE+2]]:7: Closing symbol does not match most recent opening symbol.
// CHECK:STDERR: fail_missing_deduced_close.carbon:[[@LINE+1]]:8: Expected parameter declaration.
fn Div[();
// CHECK:STDERR: toolchain/parser/testdata/function/declaration/fail_missing_deduced_close.carbon:[[@LINE+0]]:174: A `(` for parameters is required after deduced parameters.
// CHECK:STDERR: fail_missing_deduced_close.carbon:[[@LINE+0]]:127: A `(` for parameters is required after deduced parameters.
@@ -9,5 +9,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/function/declaration/fail_missing_name.carbon:[[@LINE+1]]:4: `fn` introducer should be followed by a name.
// CHECK:STDERR: fail_missing_name.carbon:[[@LINE+1]]:4: `fn` introducer should be followed by a name.
fn ();
@@ -10,5 +10,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/function/declaration/fail_no_sig_or_semi.carbon:[[@LINE+1]]:7: `fn` requires a `(` for parameters.
// CHECK:STDERR: fail_no_sig_or_semi.carbon:[[@LINE+1]]:7: `fn` requires a `(` for parameters.
fn foo
@@ -9,5 +9,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/function/declaration/fail_only_fn_and_semi.carbon:[[@LINE+1]]:3: `fn` introducer should be followed by a name.
// CHECK:STDERR: fail_only_fn_and_semi.carbon:[[@LINE+1]]:3: `fn` introducer should be followed by a name.
fn;
@@ -9,5 +9,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/function/declaration/fail_repeated_fn_and_semi.carbon:[[@LINE+1]]:4: `fn` introducer should be followed by a name.
// CHECK:STDERR: fail_repeated_fn_and_semi.carbon:[[@LINE+1]]:4: `fn` introducer should be followed by a name.
fn fn;
@@ -14,7 +14,7 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/function/declaration/fail_skip_indented_newline_until_outdent.carbon:[[@LINE+1]]:6: `fn` introducer should be followed by a name.
// CHECK:STDERR: fail_skip_indented_newline_until_outdent.carbon:[[@LINE+1]]:6: `fn` introducer should be followed by a name.
fn (x,
y,
z)
@@ -14,7 +14,7 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/function/declaration/fail_skip_indented_newline_with_semi.carbon:[[@LINE+1]]:4: `fn` introducer should be followed by a name.
// CHECK:STDERR: fail_skip_indented_newline_with_semi.carbon:[[@LINE+1]]:4: `fn` introducer should be followed by a name.
fn (x,
y,
z);
@@ -14,7 +14,7 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/function/declaration/fail_skip_indented_newline_without_semi.carbon:[[@LINE+1]]:4: `fn` introducer should be followed by a name.
// CHECK:STDERR: fail_skip_indented_newline_without_semi.carbon:[[@LINE+1]]:4: `fn` introducer should be followed by a name.
fn (x,
y,
z)
@@ -14,6 +14,6 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/function/declaration/fail_skip_to_newline_without_semi.carbon:[[@LINE+1]]:4: `fn` introducer should be followed by a name.
// CHECK:STDERR: fail_skip_to_newline_without_semi.carbon:[[@LINE+1]]:4: `fn` introducer should be followed by a name.
fn ()
fn F();
@@ -13,6 +13,6 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/function/declaration/fail_skip_without_semi_to_curly.carbon:[[@LINE+1]]:1: Unrecognized declaration introducer.
// CHECK:STDERR: fail_skip_without_semi_to_curly.carbon:[[@LINE+1]]:1: Unrecognized declaration introducer.
struct X { fn () }
fn F();
@@ -15,5 +15,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/function/declaration/fail_with_identifier_as_param.carbon:[[@LINE+1]]:11: Expected parameter declaration.
// CHECK:STDERR: fail_with_identifier_as_param.carbon:[[@LINE+1]]:11: Expected parameter declaration.
fn foo(bar);
@@ -9,5 +9,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/function/declaration/fail_without_name_and_many_tokens_in_params.carbon:[[@LINE+1]]:4: `fn` introducer should be followed by a name.
// CHECK:STDERR: fail_without_name_and_many_tokens_in_params.carbon:[[@LINE+1]]:4: `fn` introducer should be followed by a name.
fn (a tokens c d e f g h i j k l m n o p q r s t u v w x y z);
@@ -18,5 +18,5 @@ fn F() {
// Note: this might become valid depending on the expression syntax. This test
// shouldn't be taken as a sign it should remain invalid.
bar
// CHECK:STDERR: toolchain/parser/testdata/function/definition/fail_identifier_in_statements.carbon:[[@LINE+1]]:1: Expected `;` after expression.
// CHECK:STDERR: fail_identifier_in_statements.carbon:[[@LINE+1]]:1: Expected `;` after expression.
}
@@ -33,14 +33,14 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/generics/deduced_params/fail_no_parens.carbon:[[@LINE+1]]:12: A `(` for parameters is required after deduced parameters.
// CHECK:STDERR: fail_no_parens.carbon:[[@LINE+1]]:12: A `(` for parameters is required after deduced parameters.
class Foo[];
// CHECK:STDERR: toolchain/parser/testdata/generics/deduced_params/fail_no_parens.carbon:[[@LINE+1]]:18: A `(` for parameters is required after deduced parameters.
// CHECK:STDERR: fail_no_parens.carbon:[[@LINE+1]]:18: A `(` for parameters is required after deduced parameters.
class Foo[a: i32];
// CHECK:STDERR: toolchain/parser/testdata/generics/deduced_params/fail_no_parens.carbon:[[@LINE+1]]:17: A `(` for parameters is required after deduced parameters.
// CHECK:STDERR: fail_no_parens.carbon:[[@LINE+1]]:17: A `(` for parameters is required after deduced parameters.
interface Bar[] {}
// CHECK:STDERR: toolchain/parser/testdata/generics/deduced_params/fail_no_parens.carbon:[[@LINE+1]]:23: A `(` for parameters is required after deduced parameters.
// CHECK:STDERR: fail_no_parens.carbon:[[@LINE+1]]:23: A `(` for parameters is required after deduced parameters.
interface Bar[a: i32] {}
@@ -9,6 +9,6 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/generics/interface/fail_missing_name.carbon:[[@LINE+1]]:11: `interface` introducer should be followed by a name.
// CHECK:STDERR: fail_missing_name.carbon:[[@LINE+1]]:11: `interface` introducer should be followed by a name.
interface {
}
@@ -13,8 +13,8 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/generics/interface/fail_missing_open_curly.carbon:[[@LINE+1]]:15: `interface` should either end with a `;` for a declaration or have a `{ ... }` block for a definition.
// CHECK:STDERR: fail_missing_open_curly.carbon:[[@LINE+1]]:15: `interface` should either end with a `;` for a declaration or have a `{ ... }` block for a definition.
interface Bar Baz {}
// CHECK:STDERR: toolchain/parser/testdata/generics/interface/fail_missing_open_curly.carbon:[[@LINE+1]]:14: `interface` should either end with a `;` for a declaration or have a `{ ... }` block for a definition.
// CHECK:STDERR: fail_missing_open_curly.carbon:[[@LINE+1]]:14: `interface` should either end with a `;` for a declaration or have a `{ ... }` block for a definition.
interface Foo
@@ -27,7 +27,7 @@
// CHECK:STDOUT: ]
interface Foo {
// CHECK:STDERR: toolchain/parser/testdata/generics/interface/fail_no_impl_allowed.carbon:[[@LINE+1]]:39: Method implementations are not allowed in interfaces.
// CHECK:STDERR: fail_no_impl_allowed.carbon:[[@LINE+1]]:39: Method implementations are not allowed in interfaces.
fn Add[self: Self](b: Self) -> Self {
print("You can't do that.");
}
@@ -42,9 +42,9 @@
// CHECK:STDOUT: ]
interface Foo {
// CHECK:STDERR: toolchain/parser/testdata/generics/interface/fail_self_param_syntax.carbon:[[@LINE+1]]:13: Expected parameter declaration.
// CHECK:STDERR: fail_self_param_syntax.carbon:[[@LINE+1]]:13: Expected parameter declaration.
fn Sub[me Self](b: Self) -> Self;
// CHECK:STDERR: toolchain/parser/testdata/generics/interface/fail_self_param_syntax.carbon:[[@LINE+1]]:10: Expected parameter declaration.
// CHECK:STDERR: fail_self_param_syntax.carbon:[[@LINE+1]]:10: Expected parameter declaration.
fn Mul[Self](b: Self) -> Self;
}
@@ -27,6 +27,6 @@
// CHECK:STDOUT: ]
constraint Foo {
// CHECK:STDERR: toolchain/parser/testdata/generics/named_constraint/fail_no_impl_allowed.carbon:[[@LINE+1]]:39: Method implementations are not allowed in interfaces.
// CHECK:STDERR: fail_no_impl_allowed.carbon:[[@LINE+1]]:39: Method implementations are not allowed in interfaces.
fn Add[self: Self](b: Self) -> Self {}
}
+4 -4
View File
@@ -61,15 +61,15 @@
fn F() {
if (a)
// CHECK:STDERR: toolchain/parser/testdata/if/fail_else_unbraced.carbon:[[@LINE+1]]:5: Expected braced code block.
// CHECK:STDERR: fail_else_unbraced.carbon:[[@LINE+1]]:5: Expected braced code block.
if (b)
// CHECK:STDERR: toolchain/parser/testdata/if/fail_else_unbraced.carbon:[[@LINE+1]]:7: Expected braced code block.
// CHECK:STDERR: fail_else_unbraced.carbon:[[@LINE+1]]:7: Expected braced code block.
c;
else
// CHECK:STDERR: toolchain/parser/testdata/if/fail_else_unbraced.carbon:[[@LINE+1]]:7: Expected braced code block.
// CHECK:STDERR: fail_else_unbraced.carbon:[[@LINE+1]]:7: Expected braced code block.
d;
else
// CHECK:STDERR: toolchain/parser/testdata/if/fail_else_unbraced.carbon:[[@LINE+1]]:5: Expected braced code block.
// CHECK:STDERR: fail_else_unbraced.carbon:[[@LINE+1]]:5: Expected braced code block.
e;
if (x) { f; }
else if (x) { g; }
+5 -5
View File
@@ -39,13 +39,13 @@
// CHECK:STDOUT: ]
fn F() {
// CHECK:STDERR: toolchain/parser/testdata/if/fail_errors.carbon:[[@LINE+1]]:6: Expected `(` after `if`.
// CHECK:STDERR: fail_errors.carbon:[[@LINE+1]]:6: Expected `(` after `if`.
if a {}
// CHECK:STDERR: toolchain/parser/testdata/if/fail_errors.carbon:[[@LINE+1]]:7: Expected expression.
// CHECK:STDERR: fail_errors.carbon:[[@LINE+1]]:7: Expected expression.
if () {}
// CHECK:STDERR: toolchain/parser/testdata/if/fail_errors.carbon:[[@LINE+1]]:9: Unexpected tokens before `)`.
// CHECK:STDERR: fail_errors.carbon:[[@LINE+1]]:9: Unexpected tokens before `)`.
if (b c) {}
if (d)
// CHECK:STDERR: toolchain/parser/testdata/if/fail_errors.carbon:[[@LINE+2]]:1: Expected braced code block.
// CHECK:STDERR: toolchain/parser/testdata/if/fail_errors.carbon:[[@LINE+1]]:1: Expected expression.
// CHECK:STDERR: fail_errors.carbon:[[@LINE+2]]:1: Expected braced code block.
// CHECK:STDERR: fail_errors.carbon:[[@LINE+1]]:1: Expected expression.
}
+3 -3
View File
@@ -36,10 +36,10 @@
fn F() {
if (a)
// CHECK:STDERR: toolchain/parser/testdata/if/fail_unbraced.carbon:[[@LINE+1]]:5: Expected braced code block.
// CHECK:STDERR: fail_unbraced.carbon:[[@LINE+1]]:5: Expected braced code block.
if (b)
// CHECK:STDERR: toolchain/parser/testdata/if/fail_unbraced.carbon:[[@LINE+1]]:7: Expected braced code block.
// CHECK:STDERR: fail_unbraced.carbon:[[@LINE+1]]:7: Expected braced code block.
if (c)
// CHECK:STDERR: toolchain/parser/testdata/if/fail_unbraced.carbon:[[@LINE+1]]:9: Expected braced code block.
// CHECK:STDERR: fail_unbraced.carbon:[[@LINE+1]]:9: Expected braced code block.
d;
}
@@ -17,5 +17,5 @@
// TODO: We could figure out that this first Failed example is infix
// with one-token lookahead.
// CHECK:STDERR: toolchain/parser/testdata/operators/fail_infix_uneven_space_after.carbon:[[@LINE+1]]:16: Expected `;` after expression.
// CHECK:STDERR: fail_infix_uneven_space_after.carbon:[[@LINE+1]]:16: Expected `;` after expression.
var n: i8 = n* n;
@@ -34,10 +34,10 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/operators/fail_invalid_infix.carbon:[[@LINE+1]]:19: Expected expression.
// CHECK:STDERR: fail_invalid_infix.carbon:[[@LINE+1]]:19: Expected expression.
var a: i32 = n == ;
// CHECK:STDERR: toolchain/parser/testdata/operators/fail_invalid_infix.carbon:[[@LINE+1]]:14: Expected expression.
// CHECK:STDERR: fail_invalid_infix.carbon:[[@LINE+1]]:14: Expected expression.
var b: i32 = == n;
// CHECK:STDERR: toolchain/parser/testdata/operators/fail_invalid_infix.carbon:[[@LINE+2]]:14: Expected expression.
// CHECK:STDERR: toolchain/parser/testdata/operators/fail_invalid_infix.carbon:[[@LINE+1]]:17: Expected expression.
// CHECK:STDERR: fail_invalid_infix.carbon:[[@LINE+2]]:14: Expected expression.
// CHECK:STDERR: fail_invalid_infix.carbon:[[@LINE+1]]:17: Expected expression.
var c: i32 = == ;
@@ -20,6 +20,6 @@
// CHECK:STDOUT: ]
fn F() {
// CHECK:STDERR: toolchain/parser/testdata/operators/fail_precedence_and_or.carbon:[[@LINE+1]]:11: Parentheses are required to disambiguate operator precedence.
// CHECK:STDERR: fail_precedence_and_or.carbon:[[@LINE+1]]:11: Parentheses are required to disambiguate operator precedence.
a and b or c;
}
@@ -20,6 +20,6 @@
// CHECK:STDOUT: ]
fn F() {
// CHECK:STDERR: toolchain/parser/testdata/operators/fail_precedence_or_and.carbon:[[@LINE+1]]:10: Parentheses are required to disambiguate operator precedence.
// CHECK:STDERR: fail_precedence_or_and.carbon:[[@LINE+1]]:10: Parentheses are required to disambiguate operator precedence.
a or b and c;
}
@@ -17,5 +17,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/operators/fail_precedence_star_minus.carbon:[[@LINE+1]]:16: Parentheses are required to disambiguate operator precedence.
// CHECK:STDERR: fail_precedence_star_minus.carbon:[[@LINE+1]]:16: Parentheses are required to disambiguate operator precedence.
var n: i8 = n* -n;
@@ -17,5 +17,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/operators/fail_precedence_star_star.carbon:[[@LINE+1]]:16: Parentheses are required to disambiguate operator precedence.
// CHECK:STDERR: fail_precedence_star_star.carbon:[[@LINE+1]]:16: Parentheses are required to disambiguate operator precedence.
var n: i8 = n* *p;
@@ -20,5 +20,5 @@
// before we notice the missing whitespace around the second `*`.
// It'd be better to (somehow) form n*(*p) and reject due to the missing
// whitespace around the first `*`.
// CHECK:STDERR: toolchain/parser/testdata/operators/fail_star_star_no_space.carbon:[[@LINE+1]]:16: Expected `;` after expression.
// CHECK:STDERR: fail_star_star_no_space.carbon:[[@LINE+1]]:16: Expected `;` after expression.
var n: i8 = n**p;
+4 -4
View File
@@ -35,9 +35,9 @@
// CHECK:STDOUT: ]
fn F() {
// CHECK:STDERR: toolchain/parser/testdata/operators/fail_variety.carbon:[[@LINE+4]]:29: Parentheses are required to disambiguate operator precedence.
// CHECK:STDERR: toolchain/parser/testdata/operators/fail_variety.carbon:[[@LINE+3]]:34: Parentheses are required to disambiguate operator precedence.
// CHECK:STDERR: toolchain/parser/testdata/operators/fail_variety.carbon:[[@LINE+2]]:38: Parentheses are required to disambiguate operator precedence.
// CHECK:STDERR: toolchain/parser/testdata/operators/fail_variety.carbon:[[@LINE+1]]:40: Parentheses are required to disambiguate operator precedence.
// CHECK:STDERR: fail_variety.carbon:[[@LINE+4]]:29: Parentheses are required to disambiguate operator precedence.
// CHECK:STDERR: fail_variety.carbon:[[@LINE+3]]:34: Parentheses are required to disambiguate operator precedence.
// CHECK:STDERR: fail_variety.carbon:[[@LINE+2]]:38: Parentheses are required to disambiguate operator precedence.
// CHECK:STDERR: fail_variety.carbon:[[@LINE+1]]:40: Parentheses are required to disambiguate operator precedence.
n = a * b + c * d = d * d << e & f - not g;
}
@@ -23,8 +23,8 @@
// CHECK:STDOUT: ]
fn F() {
// CHECK:STDERR: toolchain/parser/testdata/operators/missing_precedence_not.carbon:[[@LINE+3]]:3: Whitespace is required before this unary operator.
// CHECK:STDERR: toolchain/parser/testdata/operators/missing_precedence_not.carbon:[[@LINE+2]]:13: Whitespace is required before this unary operator.
// CHECK:STDERR: toolchain/parser/testdata/operators/missing_precedence_not.carbon:[[@LINE+1]]:23: Whitespace is required before this unary operator.
// CHECK:STDERR: missing_precedence_not.carbon:[[@LINE+3]]:3: Whitespace is required before this unary operator.
// CHECK:STDERR: missing_precedence_not.carbon:[[@LINE+2]]:13: Whitespace is required before this unary operator.
// CHECK:STDERR: missing_precedence_not.carbon:[[@LINE+1]]:23: Whitespace is required before this unary operator.
not a and not b and not c;
}
@@ -16,5 +16,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/operators/recover_infix_uneven_space_before.carbon:[[@LINE+1]]:15: Whitespace missing after binary operator.
// CHECK:STDERR: recover_infix_uneven_space_before.carbon:[[@LINE+1]]:15: Whitespace missing after binary operator.
var n: i8 = n *n;
@@ -15,5 +15,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/operators/recover_postfix_space.carbon:[[@LINE+1]]:18: Whitespace is not allowed before this unary operator.
// CHECK:STDERR: recover_postfix_space.carbon:[[@LINE+1]]:18: Whitespace is not allowed before this unary operator.
var v: type = i8 *;
@@ -20,5 +20,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/operators/recover_postfix_space_before_comma.carbon:[[@LINE+1]]:18: Whitespace is not allowed before this unary operator.
// CHECK:STDERR: recover_postfix_space_before_comma.carbon:[[@LINE+1]]:18: Whitespace is not allowed before this unary operator.
var n: i8 = F(i8 *, 0);
@@ -18,5 +18,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/operators/recover_postfix_space_in_call.carbon:[[@LINE+1]]:18: Whitespace is not allowed before this unary operator.
// CHECK:STDERR: recover_postfix_space_in_call.carbon:[[@LINE+1]]:18: Whitespace is not allowed before this unary operator.
var n: i8 = F(i8 *);
@@ -15,6 +15,6 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/operators/recover_postfix_space_surrounding.carbon:[[@LINE+2]]:18: Whitespace is not allowed before this unary operator.
// CHECK:STDERR: toolchain/parser/testdata/operators/recover_postfix_space_surrounding.carbon:[[@LINE+1]]:18: Whitespace is required after this unary operator.
// CHECK:STDERR: recover_postfix_space_surrounding.carbon:[[@LINE+2]]:18: Whitespace is not allowed before this unary operator.
// CHECK:STDERR: recover_postfix_space_surrounding.carbon:[[@LINE+1]]:18: Whitespace is required after this unary operator.
var v: type = i8 * ;
@@ -15,6 +15,6 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/operators/recover_prefix_space.carbon:[[@LINE+2]]:13: Whitespace is not allowed after this unary operator.
// CHECK:STDERR: toolchain/parser/testdata/operators/recover_prefix_space.carbon:[[@LINE+1]]:13: Whitespace is required before this unary operator.
// CHECK:STDERR: recover_prefix_space.carbon:[[@LINE+2]]:13: Whitespace is not allowed after this unary operator.
// CHECK:STDERR: recover_prefix_space.carbon:[[@LINE+1]]:13: Whitespace is required before this unary operator.
var n: i8 = - n;
@@ -15,5 +15,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/operators/recover_prefix_uneven_space_with_assign.carbon:[[@LINE+1]]:12: Whitespace is not allowed after this unary operator.
// CHECK:STDERR: recover_prefix_uneven_space_with_assign.carbon:[[@LINE+1]]:12: Whitespace is not allowed after this unary operator.
var n: i8 =- n;
+1 -1
View File
@@ -12,5 +12,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/package/fail_extra_string.carbon:[[@LINE+1]]:27: Expected a `api` or `impl`.
// CHECK:STDERR: fail_extra_string.carbon:[[@LINE+1]]:27: Expected a `api` or `impl`.
package Foo library "bar" "baz";
@@ -10,5 +10,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/package/fail_library_is_identifier.carbon:[[@LINE+1]]:26: Expected a string literal to specify the library name.
// CHECK:STDERR: fail_library_is_identifier.carbon:[[@LINE+1]]:26: Expected a string literal to specify the library name.
package Geometry library Shapes api;
@@ -9,5 +9,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/package/fail_library_skips_name.carbon:[[@LINE+1]]:9: Expected identifier after `package`.
// CHECK:STDERR: fail_library_skips_name.carbon:[[@LINE+1]]:9: Expected identifier after `package`.
package library "Shapes" api;
@@ -9,5 +9,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/package/fail_name_is_keyword.carbon:[[@LINE+1]]:9: Expected identifier after `package`.
// CHECK:STDERR: fail_name_is_keyword.carbon:[[@LINE+1]]:9: Expected identifier after `package`.
package fn;
+1 -1
View File
@@ -9,5 +9,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/package/fail_no_name.carbon:[[@LINE+1]]:8: Expected identifier after `package`.
// CHECK:STDERR: fail_no_name.carbon:[[@LINE+1]]:8: Expected identifier after `package`.
package;
+1 -1
View File
@@ -11,5 +11,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/package/fail_no_semi.carbon:[[@LINE+1]]:21: Expected `;` to end package directive.
// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+1]]:21: Expected `;` to end package directive.
package Geometry api
+1 -1
View File
@@ -10,5 +10,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/package/fail_no_type.carbon:[[@LINE+1]]:17: Expected a `api` or `impl`.
// CHECK:STDERR: fail_no_type.carbon:[[@LINE+1]]:17: Expected a `api` or `impl`.
package Geometry;
@@ -10,5 +10,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/package/fail_omit_library_keyword.carbon:[[@LINE+1]]:18: Missing `library` keyword.
// CHECK:STDERR: fail_omit_library_keyword.carbon:[[@LINE+1]]:18: Missing `library` keyword.
package Geometry "Shapes" api;
+1 -1
View File
@@ -18,5 +18,5 @@
fn F() {
return x
// CHECK:STDERR: toolchain/parser/testdata/return/fail_expr_no_semi.carbon:[[@LINE+1]]:1: Expected `;` after `return`.
// CHECK:STDERR: fail_expr_no_semi.carbon:[[@LINE+1]]:1: Expected `;` after `return`.
}
+2 -2
View File
@@ -18,6 +18,6 @@
fn F() {
return
// CHECK:STDERR: toolchain/parser/testdata/return/fail_no_semi.carbon:[[@LINE+2]]:1: Expected expression.
// CHECK:STDERR: toolchain/parser/testdata/return/fail_no_semi.carbon:[[@LINE+1]]:1: Expected `;` after `return`.
// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+2]]:1: Expected expression.
// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+1]]:1: Expected `;` after `return`.
}
+1 -1
View File
@@ -18,5 +18,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/struct/fail_comma_only.carbon:[[@LINE+1]]:9: Expected `.field: field_type` or `.field = value`.
// CHECK:STDERR: fail_comma_only.carbon:[[@LINE+1]]:9: Expected `.field: field_type` or `.field = value`.
var x: {,} = {};
@@ -23,5 +23,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/struct/fail_comma_repeat_in_type.carbon:[[@LINE+1]]:17: Expected `.field: field_type`.
// CHECK:STDERR: fail_comma_repeat_in_type.carbon:[[@LINE+1]]:17: Expected `.field: field_type`.
var x: {.a: i32,,} = {};
@@ -23,5 +23,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/struct/fail_comma_repeat_in_value.carbon:[[@LINE+1]]:16: Expected `.field = value`.
// CHECK:STDERR: fail_comma_repeat_in_value.carbon:[[@LINE+1]]:16: Expected `.field = value`.
var x: {.a = 0,,} = {};
+1 -1
View File
@@ -19,5 +19,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/struct/fail_dot_only.carbon:[[@LINE+1]]:10: Expected identifier after `.`.
// CHECK:STDERR: fail_dot_only.carbon:[[@LINE+1]]:10: Expected identifier after `.`.
var x: {.} = {};
@@ -25,5 +25,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/struct/fail_dot_string_colon.carbon:[[@LINE+1]]:10: Expected identifier after `.`.
// CHECK:STDERR: fail_dot_string_colon.carbon:[[@LINE+1]]:10: Expected identifier after `.`.
var x: {."hello": i32, .y: i32} = {};
@@ -25,5 +25,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/struct/fail_dot_string_equals.carbon:[[@LINE+1]]:10: Expected identifier after `.`.
// CHECK:STDERR: fail_dot_string_equals.carbon:[[@LINE+1]]:10: Expected identifier after `.`.
var x: {."hello" = 0, .y = 4} = {};
@@ -24,5 +24,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/struct/fail_extra_token_in_type.carbon:[[@LINE+1]]:17: Expected `,` or `}`.
// CHECK:STDERR: fail_extra_token_in_type.carbon:[[@LINE+1]]:17: Expected `,` or `}`.
var x: {.a: i32 banana} = {.a = 0};
@@ -24,5 +24,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/struct/fail_extra_token_in_value.carbon:[[@LINE+1]]:28: Expected `,` or `}`.
// CHECK:STDERR: fail_extra_token_in_value.carbon:[[@LINE+1]]:28: Expected `,` or `}`.
var x: {.a: i32} = {.a = 0 banana};
@@ -17,5 +17,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/struct/fail_identifier_colon.carbon:[[@LINE+1]]:9: Expected `.field: field_type` or `.field = value`.
// CHECK:STDERR: fail_identifier_colon.carbon:[[@LINE+1]]:9: Expected `.field: field_type` or `.field = value`.
var x: {a:} = {};
@@ -17,5 +17,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/struct/fail_identifier_equals.carbon:[[@LINE+1]]:9: Expected `.field: field_type` or `.field = value`.
// CHECK:STDERR: fail_identifier_equals.carbon:[[@LINE+1]]:9: Expected `.field: field_type` or `.field = value`.
var x: {a=} = {};
@@ -17,5 +17,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/struct/fail_identifier_only.carbon:[[@LINE+1]]:9: Expected `.field: field_type` or `.field = value`.
// CHECK:STDERR: fail_identifier_only.carbon:[[@LINE+1]]:9: Expected `.field: field_type` or `.field = value`.
var x: {a} = {};
+1 -1
View File
@@ -20,5 +20,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/struct/fail_missing_type.carbon:[[@LINE+1]]:12: Expected expression.
// CHECK:STDERR: fail_missing_type.carbon:[[@LINE+1]]:12: Expected expression.
var x: {.a:} = {};
+1 -1
View File
@@ -20,5 +20,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/struct/fail_missing_value.carbon:[[@LINE+1]]:12: Expected expression.
// CHECK:STDERR: fail_missing_value.carbon:[[@LINE+1]]:12: Expected expression.
var x: {.a=} = {};
@@ -24,5 +24,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/struct/fail_mix_type_and_value.carbon:[[@LINE+1]]:21: Expected `.field: field_type`.
// CHECK:STDERR: fail_mix_type_and_value.carbon:[[@LINE+1]]:21: Expected `.field: field_type`.
var x: {.a: i32, .b = 0} = {};
@@ -22,5 +22,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/struct/fail_mix_value_and_type.carbon:[[@LINE+1]]:17: Expected `.field = value`.
// CHECK:STDERR: fail_mix_value_and_type.carbon:[[@LINE+1]]:17: Expected `.field = value`.
var x: {.a = 0, b: i32} = {};
@@ -47,10 +47,10 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/struct/fail_mix_with_unknown.carbon:[[@LINE+2]]:25: Expected `.field = value`.
// CHECK:STDERR: toolchain/parser/testdata/struct/fail_mix_with_unknown.carbon:[[@LINE+1]]:29: Expected `.field = value`.
// CHECK:STDERR: fail_mix_with_unknown.carbon:[[@LINE+2]]:25: Expected `.field = value`.
// CHECK:STDERR: fail_mix_with_unknown.carbon:[[@LINE+1]]:29: Expected `.field = value`.
var x: i32 = {.a = 1, .b, .c: i32};
// CHECK:STDERR: toolchain/parser/testdata/struct/fail_mix_with_unknown.carbon:[[@LINE+2]]:26: Expected `.field: field_type`.
// CHECK:STDERR: toolchain/parser/testdata/struct/fail_mix_with_unknown.carbon:[[@LINE+1]]:31: Expected `.field: field_type`.
// CHECK:STDERR: fail_mix_with_unknown.carbon:[[@LINE+2]]:26: Expected `.field: field_type`.
// CHECK:STDERR: fail_mix_with_unknown.carbon:[[@LINE+1]]:31: Expected `.field: field_type`.
var x: i32 = {.a: i32, .b, .c = 1};
@@ -19,5 +19,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/struct/fail_no_colon_or_equals.carbon:[[@LINE+1]]:11: Expected `.field: field_type` or `.field = value`.
// CHECK:STDERR: fail_no_colon_or_equals.carbon:[[@LINE+1]]:11: Expected `.field: field_type` or `.field = value`.
var x: {.a} = {};
@@ -17,5 +17,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/struct/fail_type_no_designator.carbon:[[@LINE+1]]:9: Expected `.field: field_type` or `.field = value`.
// CHECK:STDERR: fail_type_no_designator.carbon:[[@LINE+1]]:9: Expected `.field: field_type` or `.field = value`.
var x: {i32} = {};
+1 -1
View File
@@ -12,5 +12,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/var/fail_bad_name.carbon:[[@LINE+1]]:5: Expected pattern in `var` declaration.
// CHECK:STDERR: fail_bad_name.carbon:[[@LINE+1]]:5: Expected pattern in `var` declaration.
var *;
+1 -1
View File
@@ -12,5 +12,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/var/fail_empty.carbon:[[@LINE+1]]:4: Expected pattern in `var` declaration.
// CHECK:STDERR: fail_empty.carbon:[[@LINE+1]]:4: Expected pattern in `var` declaration.
var;
+2 -2
View File
@@ -39,11 +39,11 @@ fn F() {
while (a) {
if (b) {
break
// CHECK:STDERR: toolchain/parser/testdata/while/fail_no_semi.carbon:[[@LINE+1]]:5: Expected `;` after `break`.
// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+1]]:5: Expected `;` after `break`.
}
if (c) {
continue
// CHECK:STDERR: toolchain/parser/testdata/while/fail_no_semi.carbon:[[@LINE+1]]:5: Expected `;` after `continue`.
// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+1]]:5: Expected `;` after `continue`.
}
}
}
+1 -1
View File
@@ -24,6 +24,6 @@
fn F() {
while (a)
// CHECK:STDERR: toolchain/parser/testdata/while/fail_unbraced.carbon:[[@LINE+1]]:5: Expected braced code block.
// CHECK:STDERR: fail_unbraced.carbon:[[@LINE+1]]:5: Expected braced code block.
break;
}