mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 08:54:47 +01:00
Add line output to diagnostics to help identify error locations. (#3010)
This also makes the filename a reference to the buffer since the line seems better to have as a reference (versus copying a string per error). Most tests now have different line deltas due to the extra output, but the actual errors should overall stay the same. Some of the error locations look like they could be improved, but this change is only making it clear where they were before.
This commit is contained in:
@@ -27,10 +27,16 @@
|
||||
|
||||
// NOTE: Move to its own directory when more tests are added.
|
||||
fn F() {
|
||||
// CHECK:STDERR: fail_invalid_designators.carbon:[[@LINE+1]]:5: Expected identifier after `.`.
|
||||
// CHECK:STDERR: fail_invalid_designators.carbon:[[@LINE+3]]:5: Expected identifier after `.`.
|
||||
// CHECK:STDERR: a.;
|
||||
// CHECK:STDERR: ^
|
||||
a.;
|
||||
// CHECK:STDERR: fail_invalid_designators.carbon:[[@LINE+1]]:5: Expected identifier after `.`.
|
||||
// CHECK:STDERR: fail_invalid_designators.carbon:[[@LINE+3]]:5: Expected identifier after `.`.
|
||||
// CHECK:STDERR: a.fn;
|
||||
// CHECK:STDERR: ^
|
||||
a.fn;
|
||||
// CHECK:STDERR: fail_invalid_designators.carbon:[[@LINE+1]]:5: Expected identifier after `.`.
|
||||
// CHECK:STDERR: fail_invalid_designators.carbon:[[@LINE+3]]:5: Expected identifier after `.`.
|
||||
// CHECK:STDERR: a.42;
|
||||
// CHECK:STDERR: ^
|
||||
a.42;
|
||||
}
|
||||
|
||||
@@ -8,5 +8,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_no_intro_with_semi.carbon:[[@LINE+1]]:1: Unrecognized declaration introducer.
|
||||
// CHECK:STDERR: fail_no_intro_with_semi.carbon:[[@LINE+3]]:1: Unrecognized declaration introducer.
|
||||
// CHECK:STDERR: foo;
|
||||
// CHECK:STDERR: ^
|
||||
foo;
|
||||
|
||||
@@ -8,5 +8,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_no_intro_without_semi.carbon:[[@LINE+1]]:1: Unrecognized declaration introducer.
|
||||
// CHECK:STDERR: fail_no_intro_without_semi.carbon:[[@LINE+3]]:1: Unrecognized declaration introducer.
|
||||
// CHECK:STDERR: foo bar baz
|
||||
// CHECK:STDERR: ^
|
||||
foo bar baz
|
||||
|
||||
@@ -16,7 +16,13 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// 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: `var` declarations must end with a `;`.
|
||||
// CHECK:STDERR: fail_paren_match_regression.carbon:[[@LINE+9]]:5: Expected pattern in `var` declaration.
|
||||
// CHECK:STDERR: var = (foo {})
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_paren_match_regression.carbon:[[@LINE+6]]:12: Expected `,` or `)`.
|
||||
// CHECK:STDERR: var = (foo {})
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_paren_match_regression.carbon:[[@LINE+3]]:15: `var` declarations must end with a `;`.
|
||||
// CHECK:STDERR: var = (foo {})
|
||||
// CHECK:STDERR: ^
|
||||
var = (foo {})
|
||||
|
||||
@@ -30,7 +30,9 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
fn foo() {
|
||||
// CHECK:STDERR: fail_colon_instead_of_in.carbon:[[@LINE+1]]:19: `:` should be replaced by `in`.
|
||||
// CHECK:STDERR: fail_colon_instead_of_in.carbon:[[@LINE+3]]:19: `:` should be replaced by `in`.
|
||||
// CHECK:STDERR: for (var x: i32 : y) {
|
||||
// CHECK:STDERR: ^
|
||||
for (var x: i32 : y) {
|
||||
Print(x);
|
||||
}
|
||||
|
||||
+3
-1
@@ -30,7 +30,9 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
fn foo() {
|
||||
// CHECK:STDERR: fail_missing_in.carbon:[[@LINE+1]]:19: Expected `in` after loop `var` declaration.
|
||||
// CHECK:STDERR: fail_missing_in.carbon:[[@LINE+3]]:19: Expected `in` after loop `var` declaration.
|
||||
// CHECK:STDERR: for (var x: i32 y) {
|
||||
// CHECK:STDERR: ^
|
||||
for (var x: i32 y) {
|
||||
Print(x);
|
||||
}
|
||||
|
||||
+3
-1
@@ -25,7 +25,9 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
fn foo() {
|
||||
// CHECK:STDERR: fail_missing_var.carbon:[[@LINE+1]]:8: Expected `var` declaration.
|
||||
// CHECK:STDERR: fail_missing_var.carbon:[[@LINE+3]]:8: Expected `var` declaration.
|
||||
// CHECK:STDERR: for (x: i32 in y) {
|
||||
// CHECK:STDERR: ^
|
||||
for (x: i32 in y) {
|
||||
Print(x);
|
||||
}
|
||||
|
||||
+3
-1
@@ -10,5 +10,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_identifier_instead_of_sig.carbon:[[@LINE+1]]:8: `fn` requires a `(` for parameters.
|
||||
// CHECK:STDERR: fail_identifier_instead_of_sig.carbon:[[@LINE+3]]:8: `fn` requires a `(` for parameters.
|
||||
// CHECK:STDERR: fn foo bar;
|
||||
// CHECK:STDERR: ^
|
||||
fn foo bar;
|
||||
|
||||
+9
-3
@@ -16,7 +16,13 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// Fix and uncomment this to test error handling.
|
||||
// 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.
|
||||
// CHECK:STDERR: fail_missing_deduced_close.carbon:[[@LINE+9]]:7: Closing symbol does not match most recent opening symbol.
|
||||
// CHECK:STDERR: fn Div[();
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_missing_deduced_close.carbon:[[@LINE+6]]:8: Expected parameter declaration.
|
||||
// CHECK:STDERR: fn Div[();
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_missing_deduced_close.carbon:[[@LINE+3]]:11: A `(` for parameters is required after deduced parameters.
|
||||
// CHECK:STDERR: fn Div[();
|
||||
// CHECK:STDERR: ^
|
||||
fn Div[();
|
||||
// CHECK:STDERR: fail_missing_deduced_close.carbon:[[@LINE+0]]:127: A `(` for parameters is required after deduced parameters.
|
||||
|
||||
@@ -10,5 +10,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_missing_name.carbon:[[@LINE+1]]:4: `fn` introducer should be followed by a name.
|
||||
// CHECK:STDERR: fail_missing_name.carbon:[[@LINE+3]]:4: `fn` introducer should be followed by a name.
|
||||
// CHECK:STDERR: fn ();
|
||||
// CHECK:STDERR: ^
|
||||
fn ();
|
||||
|
||||
@@ -10,5 +10,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_no_sig_or_semi.carbon:[[@LINE+1]]:7: `fn` requires a `(` for parameters.
|
||||
// CHECK:STDERR: fail_no_sig_or_semi.carbon:[[@LINE+3]]:7: `fn` requires a `(` for parameters.
|
||||
// CHECK:STDERR: fn foo
|
||||
// CHECK:STDERR: ^
|
||||
fn foo
|
||||
|
||||
+3
-1
@@ -10,5 +10,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: 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+3]]:3: `fn` introducer should be followed by a name.
|
||||
// CHECK:STDERR: fn;
|
||||
// CHECK:STDERR: ^
|
||||
fn;
|
||||
|
||||
+3
-1
@@ -10,5 +10,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: 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+3]]:4: `fn` introducer should be followed by a name.
|
||||
// CHECK:STDERR: fn fn;
|
||||
// CHECK:STDERR: ^
|
||||
fn fn;
|
||||
|
||||
Vendored
+3
-1
@@ -15,7 +15,9 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: 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+3]]:6: `fn` introducer should be followed by a name.
|
||||
// CHECK:STDERR: fn (x,
|
||||
// CHECK:STDERR: ^
|
||||
fn (x,
|
||||
y,
|
||||
z)
|
||||
|
||||
+3
-1
@@ -15,7 +15,9 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: 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+3]]:4: `fn` introducer should be followed by a name.
|
||||
// CHECK:STDERR: fn (x,
|
||||
// CHECK:STDERR: ^
|
||||
fn (x,
|
||||
y,
|
||||
z);
|
||||
|
||||
Vendored
+3
-1
@@ -15,7 +15,9 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: 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+3]]:4: `fn` introducer should be followed by a name.
|
||||
// CHECK:STDERR: fn (x,
|
||||
// CHECK:STDERR: ^
|
||||
fn (x,
|
||||
y,
|
||||
z)
|
||||
|
||||
+3
-1
@@ -15,6 +15,8 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: 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+3]]:4: `fn` introducer should be followed by a name.
|
||||
// CHECK:STDERR: fn ()
|
||||
// CHECK:STDERR: ^
|
||||
fn ()
|
||||
fn F();
|
||||
|
||||
+3
-1
@@ -13,6 +13,8 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_skip_without_semi_to_curly.carbon:[[@LINE+1]]:1: Unrecognized declaration introducer.
|
||||
// CHECK:STDERR: fail_skip_without_semi_to_curly.carbon:[[@LINE+3]]:1: Unrecognized declaration introducer.
|
||||
// CHECK:STDERR: struct X { fn () }
|
||||
// CHECK:STDERR: ^
|
||||
struct X { fn () }
|
||||
fn F();
|
||||
|
||||
+3
-1
@@ -15,5 +15,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_with_identifier_as_param.carbon:[[@LINE+1]]:11: Expected parameter declaration.
|
||||
// CHECK:STDERR: fail_with_identifier_as_param.carbon:[[@LINE+3]]:11: Expected parameter declaration.
|
||||
// CHECK:STDERR: fn foo(bar);
|
||||
// CHECK:STDERR: ^
|
||||
fn foo(bar);
|
||||
|
||||
Vendored
+3
-1
@@ -10,5 +10,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: 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+3]]:4: `fn` introducer should be followed by a name.
|
||||
// CHECK:STDERR: 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);
|
||||
// CHECK:STDERR: ^
|
||||
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);
|
||||
|
||||
+3
-1
@@ -18,5 +18,7 @@ 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: fail_identifier_in_statements.carbon:[[@LINE+1]]:1: Expected `;` after expression statement.
|
||||
// CHECK:STDERR: fail_identifier_in_statements.carbon:[[@LINE+3]]:1: Expected `;` after expression statement.
|
||||
// CHECK:STDERR: }
|
||||
// CHECK:STDERR: ^
|
||||
}
|
||||
|
||||
@@ -33,14 +33,22 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_no_parens.carbon:[[@LINE+1]]:12: A `(` for parameters is required after deduced parameters.
|
||||
// CHECK:STDERR: fail_no_parens.carbon:[[@LINE+3]]:12: A `(` for parameters is required after deduced parameters.
|
||||
// CHECK:STDERR: class Foo[];
|
||||
// CHECK:STDERR: ^
|
||||
class Foo[];
|
||||
|
||||
// CHECK:STDERR: fail_no_parens.carbon:[[@LINE+1]]:18: A `(` for parameters is required after deduced parameters.
|
||||
// CHECK:STDERR: fail_no_parens.carbon:[[@LINE+3]]:18: A `(` for parameters is required after deduced parameters.
|
||||
// CHECK:STDERR: class Foo[a: i32];
|
||||
// CHECK:STDERR: ^
|
||||
class Foo[a: i32];
|
||||
|
||||
// CHECK:STDERR: fail_no_parens.carbon:[[@LINE+1]]:17: A `(` for parameters is required after deduced parameters.
|
||||
// CHECK:STDERR: fail_no_parens.carbon:[[@LINE+3]]:17: A `(` for parameters is required after deduced parameters.
|
||||
// CHECK:STDERR: interface Bar[] {}
|
||||
// CHECK:STDERR: ^
|
||||
interface Bar[] {}
|
||||
|
||||
// CHECK:STDERR: fail_no_parens.carbon:[[@LINE+1]]:23: A `(` for parameters is required after deduced parameters.
|
||||
// CHECK:STDERR: fail_no_parens.carbon:[[@LINE+3]]:23: A `(` for parameters is required after deduced parameters.
|
||||
// CHECK:STDERR: interface Bar[a: i32] {}
|
||||
// CHECK:STDERR: ^
|
||||
interface Bar[a: i32] {}
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_missing_name.carbon:[[@LINE+1]]:11: `interface` introducer should be followed by a name.
|
||||
// CHECK:STDERR: fail_missing_name.carbon:[[@LINE+3]]:11: `interface` introducer should be followed by a name.
|
||||
// CHECK:STDERR: interface {
|
||||
// CHECK:STDERR: ^
|
||||
interface {
|
||||
}
|
||||
|
||||
+6
-2
@@ -13,8 +13,12 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_missing_open_curly.carbon:[[@LINE+1]]:15: `interface` declarations must either end with a `;` or have a `{ ... }` block for a definition.
|
||||
// CHECK:STDERR: fail_missing_open_curly.carbon:[[@LINE+3]]:15: `interface` declarations must either end with a `;` or have a `{ ... }` block for a definition.
|
||||
// CHECK:STDERR: interface Bar Baz {}
|
||||
// CHECK:STDERR: ^
|
||||
interface Bar Baz {}
|
||||
|
||||
// CHECK:STDERR: fail_missing_open_curly.carbon:[[@LINE+1]]:14: `interface` declarations must either end with a `;` or have a `{ ... }` block for a definition.
|
||||
// CHECK:STDERR: fail_missing_open_curly.carbon:[[@LINE+3]]:14: `interface` declarations must either end with a `;` or have a `{ ... }` block for a definition.
|
||||
// CHECK:STDERR: interface Foo
|
||||
// CHECK:STDERR: ^
|
||||
interface Foo
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
interface Foo {
|
||||
// CHECK:STDERR: fail_no_impl_allowed.carbon:[[@LINE+1]]:39: Method implementations are not allowed in interfaces.
|
||||
// CHECK:STDERR: fail_no_impl_allowed.carbon:[[@LINE+3]]:39: Method implementations are not allowed in interfaces.
|
||||
// CHECK:STDERR: fn Add[self: Self](b: Self) -> Self {
|
||||
// CHECK:STDERR: ^
|
||||
fn Add[self: Self](b: Self) -> Self {
|
||||
print("You can't do that.");
|
||||
}
|
||||
|
||||
@@ -42,9 +42,13 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
interface Foo {
|
||||
// CHECK:STDERR: fail_self_param_syntax.carbon:[[@LINE+1]]:13: Expected parameter declaration.
|
||||
// CHECK:STDERR: fail_self_param_syntax.carbon:[[@LINE+3]]:13: Expected parameter declaration.
|
||||
// CHECK:STDERR: fn Sub[me Self](b: Self) -> Self;
|
||||
// CHECK:STDERR: ^
|
||||
fn Sub[me Self](b: Self) -> Self;
|
||||
|
||||
// CHECK:STDERR: fail_self_param_syntax.carbon:[[@LINE+1]]:10: Expected parameter declaration.
|
||||
// CHECK:STDERR: fail_self_param_syntax.carbon:[[@LINE+3]]:10: Expected parameter declaration.
|
||||
// CHECK:STDERR: fn Mul[Self](b: Self) -> Self;
|
||||
// CHECK:STDERR: ^
|
||||
fn Mul[Self](b: Self) -> Self;
|
||||
}
|
||||
|
||||
+3
-1
@@ -27,6 +27,8 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
constraint Foo {
|
||||
// CHECK:STDERR: fail_no_impl_allowed.carbon:[[@LINE+1]]:39: Method implementations are not allowed in interfaces.
|
||||
// CHECK:STDERR: fail_no_impl_allowed.carbon:[[@LINE+3]]:39: Method implementations are not allowed in interfaces.
|
||||
// CHECK:STDERR: fn Add[self: Self](b: Self) -> Self {}
|
||||
// CHECK:STDERR: ^
|
||||
fn Add[self: Self](b: Self) -> Self {}
|
||||
}
|
||||
|
||||
+12
-4
@@ -61,15 +61,23 @@
|
||||
|
||||
fn F() {
|
||||
if (a)
|
||||
// CHECK:STDERR: fail_else_unbraced.carbon:[[@LINE+1]]:5: Expected braced code block.
|
||||
// CHECK:STDERR: fail_else_unbraced.carbon:[[@LINE+3]]:5: Expected braced code block.
|
||||
// CHECK:STDERR: if (b)
|
||||
// CHECK:STDERR: ^
|
||||
if (b)
|
||||
// CHECK:STDERR: fail_else_unbraced.carbon:[[@LINE+1]]:7: Expected braced code block.
|
||||
// CHECK:STDERR: fail_else_unbraced.carbon:[[@LINE+3]]:7: Expected braced code block.
|
||||
// CHECK:STDERR: c;
|
||||
// CHECK:STDERR: ^
|
||||
c;
|
||||
else
|
||||
// CHECK:STDERR: fail_else_unbraced.carbon:[[@LINE+1]]:7: Expected braced code block.
|
||||
// CHECK:STDERR: fail_else_unbraced.carbon:[[@LINE+3]]:7: Expected braced code block.
|
||||
// CHECK:STDERR: d;
|
||||
// CHECK:STDERR: ^
|
||||
d;
|
||||
else
|
||||
// CHECK:STDERR: fail_else_unbraced.carbon:[[@LINE+1]]:5: Expected braced code block.
|
||||
// CHECK:STDERR: fail_else_unbraced.carbon:[[@LINE+3]]:5: Expected braced code block.
|
||||
// CHECK:STDERR: e;
|
||||
// CHECK:STDERR: ^
|
||||
e;
|
||||
if (x) { f; }
|
||||
else if (x) { g; }
|
||||
|
||||
+15
-5
@@ -39,13 +39,23 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDERR: fail_errors.carbon:[[@LINE+1]]:6: Expected `(` after `if`.
|
||||
// CHECK:STDERR: fail_errors.carbon:[[@LINE+3]]:6: Expected `(` after `if`.
|
||||
// CHECK:STDERR: if a {}
|
||||
// CHECK:STDERR: ^
|
||||
if a {}
|
||||
// CHECK:STDERR: fail_errors.carbon:[[@LINE+1]]:7: Expected expression.
|
||||
// CHECK:STDERR: fail_errors.carbon:[[@LINE+3]]:7: Expected expression.
|
||||
// CHECK:STDERR: if () {}
|
||||
// CHECK:STDERR: ^
|
||||
if () {}
|
||||
// CHECK:STDERR: fail_errors.carbon:[[@LINE+1]]:9: Unexpected tokens before `)`.
|
||||
// CHECK:STDERR: fail_errors.carbon:[[@LINE+3]]:9: Unexpected tokens before `)`.
|
||||
// CHECK:STDERR: if (b c) {}
|
||||
// CHECK:STDERR: ^
|
||||
if (b c) {}
|
||||
if (d)
|
||||
// CHECK:STDERR: fail_errors.carbon:[[@LINE+2]]:1: Expected braced code block.
|
||||
// CHECK:STDERR: fail_errors.carbon:[[@LINE+1]]:1: Expected expression.
|
||||
// CHECK:STDERR: fail_errors.carbon:[[@LINE+6]]:1: Expected braced code block.
|
||||
// CHECK:STDERR: }
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_errors.carbon:[[@LINE+3]]:1: Expected expression.
|
||||
// CHECK:STDERR: }
|
||||
// CHECK:STDERR: ^
|
||||
}
|
||||
|
||||
+9
-3
@@ -36,10 +36,16 @@
|
||||
|
||||
fn F() {
|
||||
if (a)
|
||||
// CHECK:STDERR: fail_unbraced.carbon:[[@LINE+1]]:5: Expected braced code block.
|
||||
// CHECK:STDERR: fail_unbraced.carbon:[[@LINE+3]]:5: Expected braced code block.
|
||||
// CHECK:STDERR: if (b)
|
||||
// CHECK:STDERR: ^
|
||||
if (b)
|
||||
// CHECK:STDERR: fail_unbraced.carbon:[[@LINE+1]]:7: Expected braced code block.
|
||||
// CHECK:STDERR: fail_unbraced.carbon:[[@LINE+3]]:7: Expected braced code block.
|
||||
// CHECK:STDERR: if (c)
|
||||
// CHECK:STDERR: ^
|
||||
if (c)
|
||||
// CHECK:STDERR: fail_unbraced.carbon:[[@LINE+1]]:9: Expected braced code block.
|
||||
// CHECK:STDERR: fail_unbraced.carbon:[[@LINE+3]]:9: Expected braced code block.
|
||||
// CHECK:STDERR: d;
|
||||
// CHECK:STDERR: ^
|
||||
d;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDERR: fail_condition_missing.carbon:[[@LINE+1]]:18: Expected expression.
|
||||
// CHECK:STDERR: fail_condition_missing.carbon:[[@LINE+3]]:18: Expected expression.
|
||||
// CHECK:STDERR: var n: i32 = if;
|
||||
// CHECK:STDERR: ^
|
||||
var n: i32 = if;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDERR: fail_else_expr_missing.carbon:[[@LINE+1]]:35: Expected expression.
|
||||
// CHECK:STDERR: fail_else_expr_missing.carbon:[[@LINE+3]]:35: Expected expression.
|
||||
// CHECK:STDERR: var n: i32 = if true then 1 else;
|
||||
// CHECK:STDERR: ^
|
||||
var n: i32 = if true then 1 else;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDERR: fail_else_missing.carbon:[[@LINE+1]]:30: Expected `else` after `if ... then ...`.
|
||||
// CHECK:STDERR: fail_else_missing.carbon:[[@LINE+3]]:30: Expected `else` after `if ... then ...`.
|
||||
// CHECK:STDERR: var n: i32 = if true then 1;
|
||||
// CHECK:STDERR: ^
|
||||
var n: i32 = if true then 1;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDERR: fail_then_expr_missing.carbon:[[@LINE+1]]:28: Expected expression.
|
||||
// CHECK:STDERR: fail_then_expr_missing.carbon:[[@LINE+3]]:28: Expected expression.
|
||||
// CHECK:STDERR: var n: i32 = if true then;
|
||||
// CHECK:STDERR: ^
|
||||
var n: i32 = if true then;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDERR: fail_then_missing.carbon:[[@LINE+1]]:23: Expected `then` after `if` condition.
|
||||
// CHECK:STDERR: fail_then_missing.carbon:[[@LINE+3]]:23: Expected `then` after `if` condition.
|
||||
// CHECK:STDERR: var n: i32 = if true;
|
||||
// CHECK:STDERR: ^
|
||||
var n: i32 = if true;
|
||||
}
|
||||
|
||||
@@ -22,8 +22,14 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDERR: fail_top_level_if.carbon:[[@LINE+3]]:6: Expected `(` after `if`.
|
||||
// CHECK:STDERR: fail_top_level_if.carbon:[[@LINE+2]]:11: Expected braced code block.
|
||||
// CHECK:STDERR: fail_top_level_if.carbon:[[@LINE+1]]:11: Expected expression.
|
||||
// CHECK:STDERR: fail_top_level_if.carbon:[[@LINE+9]]:6: Expected `(` after `if`.
|
||||
// CHECK:STDERR: if true then 1 else 2;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_top_level_if.carbon:[[@LINE+6]]:11: Expected braced code block.
|
||||
// CHECK:STDERR: if true then 1 else 2;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_top_level_if.carbon:[[@LINE+3]]:11: Expected expression.
|
||||
// CHECK:STDERR: if true then 1 else 2;
|
||||
// CHECK:STDERR: ^
|
||||
if true then 1 else 2;
|
||||
}
|
||||
|
||||
+3
-1
@@ -10,5 +10,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_args.carbon:[[@LINE+1]]:14: `namespace` declarations must end with a `;`.
|
||||
// CHECK:STDERR: fail_args.carbon:[[@LINE+3]]:14: `namespace` declarations must end with a `;`.
|
||||
// CHECK:STDERR: namespace Foo();
|
||||
// CHECK:STDERR: ^
|
||||
namespace Foo();
|
||||
|
||||
@@ -12,5 +12,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_incomplete_name.carbon:[[@LINE+1]]:15: Expected identifier after `.`.
|
||||
// CHECK:STDERR: fail_incomplete_name.carbon:[[@LINE+3]]:15: Expected identifier after `.`.
|
||||
// CHECK:STDERR: namespace Foo.;
|
||||
// CHECK:STDERR: ^
|
||||
namespace Foo.;
|
||||
|
||||
+3
-1
@@ -10,5 +10,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_no_name.carbon:[[@LINE+1]]:10: `namespace` introducer should be followed by a name.
|
||||
// CHECK:STDERR: fail_no_name.carbon:[[@LINE+3]]:10: `namespace` introducer should be followed by a name.
|
||||
// CHECK:STDERR: namespace;
|
||||
// CHECK:STDERR: ^
|
||||
namespace;
|
||||
|
||||
@@ -17,5 +17,7 @@
|
||||
|
||||
// TODO: We could figure out that this first Failed example is infix
|
||||
// with one-token lookahead.
|
||||
// CHECK:STDERR: fail_infix_uneven_space_after.carbon:[[@LINE+1]]:16: `var` declarations must end with a `;`.
|
||||
// CHECK:STDERR: fail_infix_uneven_space_after.carbon:[[@LINE+3]]:16: `var` declarations must end with a `;`.
|
||||
// CHECK:STDERR: var n: i8 = n* n;
|
||||
// CHECK:STDERR: ^
|
||||
var n: i8 = n* n;
|
||||
|
||||
@@ -34,10 +34,18 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_invalid_infix.carbon:[[@LINE+1]]:19: Expected expression.
|
||||
// CHECK:STDERR: fail_invalid_infix.carbon:[[@LINE+3]]:19: Expected expression.
|
||||
// CHECK:STDERR: var a: i32 = n == ;
|
||||
// CHECK:STDERR: ^
|
||||
var a: i32 = n == ;
|
||||
// CHECK:STDERR: fail_invalid_infix.carbon:[[@LINE+1]]:14: Expected expression.
|
||||
// CHECK:STDERR: fail_invalid_infix.carbon:[[@LINE+3]]:14: Expected expression.
|
||||
// CHECK:STDERR: var b: i32 = == n;
|
||||
// CHECK:STDERR: ^
|
||||
var b: i32 = == n;
|
||||
// CHECK:STDERR: fail_invalid_infix.carbon:[[@LINE+2]]:14: Expected expression.
|
||||
// CHECK:STDERR: fail_invalid_infix.carbon:[[@LINE+1]]:17: Expected expression.
|
||||
// CHECK:STDERR: fail_invalid_infix.carbon:[[@LINE+6]]:14: Expected expression.
|
||||
// CHECK:STDERR: var c: i32 = == ;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_invalid_infix.carbon:[[@LINE+3]]:17: Expected expression.
|
||||
// CHECK:STDERR: var c: i32 = == ;
|
||||
// CHECK:STDERR: ^
|
||||
var c: i32 = == ;
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDERR: fail_precedence_and_or.carbon:[[@LINE+1]]:11: Parentheses are required to disambiguate operator precedence.
|
||||
// CHECK:STDERR: fail_precedence_and_or.carbon:[[@LINE+3]]:11: Parentheses are required to disambiguate operator precedence.
|
||||
// CHECK:STDERR: a and b or c;
|
||||
// CHECK:STDERR: ^
|
||||
a and b or c;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDERR: fail_precedence_or_and.carbon:[[@LINE+1]]:10: Parentheses are required to disambiguate operator precedence.
|
||||
// CHECK:STDERR: fail_precedence_or_and.carbon:[[@LINE+3]]:10: Parentheses are required to disambiguate operator precedence.
|
||||
// CHECK:STDERR: a or b and c;
|
||||
// CHECK:STDERR: ^
|
||||
a or b and c;
|
||||
}
|
||||
|
||||
@@ -17,5 +17,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_precedence_star_minus.carbon:[[@LINE+1]]:16: Parentheses are required to disambiguate operator precedence.
|
||||
// CHECK:STDERR: fail_precedence_star_minus.carbon:[[@LINE+3]]:16: Parentheses are required to disambiguate operator precedence.
|
||||
// CHECK:STDERR: var n: i8 = n* -n;
|
||||
// CHECK:STDERR: ^
|
||||
var n: i8 = n* -n;
|
||||
|
||||
@@ -17,5 +17,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_precedence_star_star.carbon:[[@LINE+1]]:16: Parentheses are required to disambiguate operator precedence.
|
||||
// CHECK:STDERR: fail_precedence_star_star.carbon:[[@LINE+3]]:16: Parentheses are required to disambiguate operator precedence.
|
||||
// CHECK:STDERR: var n: i8 = n* *p;
|
||||
// CHECK:STDERR: ^
|
||||
var n: i8 = n* *p;
|
||||
|
||||
@@ -20,5 +20,7 @@
|
||||
// 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: fail_star_star_no_space.carbon:[[@LINE+1]]:16: `var` declarations must end with a `;`.
|
||||
// CHECK:STDERR: fail_star_star_no_space.carbon:[[@LINE+3]]:16: `var` declarations must end with a `;`.
|
||||
// CHECK:STDERR: var n: i8 = n**p;
|
||||
// CHECK:STDERR: ^
|
||||
var n: i8 = n**p;
|
||||
|
||||
+12
-4
@@ -35,9 +35,17 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
fn F() {
|
||||
// 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.
|
||||
// CHECK:STDERR: fail_variety.carbon:[[@LINE+12]]:29: Parentheses are required to disambiguate operator precedence.
|
||||
// CHECK:STDERR: n = a * b + c * d = d * d << e & f - not g;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_variety.carbon:[[@LINE+9]]:34: Parentheses are required to disambiguate operator precedence.
|
||||
// CHECK:STDERR: n = a * b + c * d = d * d << e & f - not g;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_variety.carbon:[[@LINE+6]]:38: Parentheses are required to disambiguate operator precedence.
|
||||
// CHECK:STDERR: n = a * b + c * d = d * d << e & f - not g;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_variety.carbon:[[@LINE+3]]:40: Parentheses are required to disambiguate operator precedence.
|
||||
// CHECK:STDERR: n = a * b + c * d = d * d << e & f - not g;
|
||||
// CHECK:STDERR: ^
|
||||
n = a * b + c * d = d * d << e & f - not g;
|
||||
}
|
||||
|
||||
+3
-1
@@ -16,5 +16,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: recover_infix_uneven_space_before.carbon:[[@LINE+1]]:15: Whitespace missing after binary operator.
|
||||
// CHECK:STDERR: recover_infix_uneven_space_before.carbon:[[@LINE+3]]:15: Whitespace missing after binary operator.
|
||||
// CHECK:STDERR: var n: i8 = n *n;
|
||||
// CHECK:STDERR: ^
|
||||
var n: i8 = n *n;
|
||||
|
||||
@@ -15,5 +15,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: recover_postfix_space.carbon:[[@LINE+1]]:18: Whitespace is not allowed before this unary operator.
|
||||
// CHECK:STDERR: recover_postfix_space.carbon:[[@LINE+3]]:18: Whitespace is not allowed before this unary operator.
|
||||
// CHECK:STDERR: var v: type = i8 *;
|
||||
// CHECK:STDERR: ^
|
||||
var v: type = i8 *;
|
||||
|
||||
+3
-1
@@ -20,5 +20,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: 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+3]]:18: Whitespace is not allowed before this unary operator.
|
||||
// CHECK:STDERR: var n: i8 = F(i8 *, 0);
|
||||
// CHECK:STDERR: ^
|
||||
var n: i8 = F(i8 *, 0);
|
||||
|
||||
@@ -18,5 +18,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: 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+3]]:18: Whitespace is not allowed before this unary operator.
|
||||
// CHECK:STDERR: var n: i8 = F(i8 *);
|
||||
// CHECK:STDERR: ^
|
||||
var n: i8 = F(i8 *);
|
||||
|
||||
+3
-1
@@ -15,5 +15,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: recover_postfix_space_surrounding.carbon:[[@LINE+1]]:18: Whitespace is not allowed before this unary operator.
|
||||
// CHECK:STDERR: recover_postfix_space_surrounding.carbon:[[@LINE+3]]:18: Whitespace is not allowed before this unary operator.
|
||||
// CHECK:STDERR: var v: type = i8 * ;
|
||||
// CHECK:STDERR: ^
|
||||
var v: type = i8 * ;
|
||||
|
||||
@@ -15,5 +15,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: recover_prefix_space.carbon:[[@LINE+1]]:13: Whitespace is not allowed after this unary operator.
|
||||
// CHECK:STDERR: recover_prefix_space.carbon:[[@LINE+3]]:13: Whitespace is not allowed after this unary operator.
|
||||
// CHECK:STDERR: var n: i8 = - n;
|
||||
// CHECK:STDERR: ^
|
||||
var n: i8 = - n;
|
||||
|
||||
+3
-1
@@ -15,5 +15,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: 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+3]]:12: Whitespace is not allowed after this unary operator.
|
||||
// CHECK:STDERR: var n: i8 =- n;
|
||||
// CHECK:STDERR: ^
|
||||
var n: i8 =- n;
|
||||
|
||||
@@ -12,5 +12,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_extra_string.carbon:[[@LINE+1]]:27: Expected a `api` or `impl`.
|
||||
// CHECK:STDERR: fail_extra_string.carbon:[[@LINE+3]]:27: Expected a `api` or `impl`.
|
||||
// CHECK:STDERR: package Foo library "bar" "baz";
|
||||
// CHECK:STDERR: ^
|
||||
package Foo library "bar" "baz";
|
||||
|
||||
@@ -10,5 +10,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: 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+3]]:26: Expected a string literal to specify the library name.
|
||||
// CHECK:STDERR: package Geometry library Shapes api;
|
||||
// CHECK:STDERR: ^
|
||||
package Geometry library Shapes api;
|
||||
|
||||
@@ -9,5 +9,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_library_skips_name.carbon:[[@LINE+1]]:9: Expected identifier after `package`.
|
||||
// CHECK:STDERR: fail_library_skips_name.carbon:[[@LINE+3]]:9: Expected identifier after `package`.
|
||||
// CHECK:STDERR: package library "Shapes" api;
|
||||
// CHECK:STDERR: ^
|
||||
package library "Shapes" api;
|
||||
|
||||
@@ -9,5 +9,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_name_is_keyword.carbon:[[@LINE+1]]:9: Expected identifier after `package`.
|
||||
// CHECK:STDERR: fail_name_is_keyword.carbon:[[@LINE+3]]:9: Expected identifier after `package`.
|
||||
// CHECK:STDERR: package fn;
|
||||
// CHECK:STDERR: ^
|
||||
package fn;
|
||||
|
||||
+3
-1
@@ -9,5 +9,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_no_name.carbon:[[@LINE+1]]:8: Expected identifier after `package`.
|
||||
// CHECK:STDERR: fail_no_name.carbon:[[@LINE+3]]:8: Expected identifier after `package`.
|
||||
// CHECK:STDERR: package;
|
||||
// CHECK:STDERR: ^
|
||||
package;
|
||||
|
||||
+3
-1
@@ -11,5 +11,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+1]]:21: `package` declarations must end with a `;`.
|
||||
// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+3]]:21: `package` declarations must end with a `;`.
|
||||
// CHECK:STDERR: package Geometry api
|
||||
// CHECK:STDERR: ^
|
||||
package Geometry api
|
||||
|
||||
+3
-1
@@ -10,5 +10,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_no_type.carbon:[[@LINE+1]]:17: Expected a `api` or `impl`.
|
||||
// CHECK:STDERR: fail_no_type.carbon:[[@LINE+3]]:17: Expected a `api` or `impl`.
|
||||
// CHECK:STDERR: package Geometry;
|
||||
// CHECK:STDERR: ^
|
||||
package Geometry;
|
||||
|
||||
@@ -10,5 +10,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_omit_library_keyword.carbon:[[@LINE+1]]:18: Missing `library` keyword.
|
||||
// CHECK:STDERR: fail_omit_library_keyword.carbon:[[@LINE+3]]:18: Missing `library` keyword.
|
||||
// CHECK:STDERR: package Geometry "Shapes" api;
|
||||
// CHECK:STDERR: ^
|
||||
package Geometry "Shapes" api;
|
||||
|
||||
@@ -18,5 +18,7 @@
|
||||
|
||||
fn F() {
|
||||
return x
|
||||
// CHECK:STDERR: fail_expr_no_semi.carbon:[[@LINE+1]]:1: `return` statements must end with a `;`.
|
||||
// CHECK:STDERR: fail_expr_no_semi.carbon:[[@LINE+3]]:1: `return` statements must end with a `;`.
|
||||
// CHECK:STDERR: }
|
||||
// CHECK:STDERR: ^
|
||||
}
|
||||
|
||||
+6
-2
@@ -18,6 +18,10 @@
|
||||
|
||||
fn F() {
|
||||
return
|
||||
// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+2]]:1: Expected expression.
|
||||
// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+1]]:1: `return` statements must end with a `;`.
|
||||
// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+6]]:1: Expected expression.
|
||||
// CHECK:STDERR: }
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+3]]:1: `return` statements must end with a `;`.
|
||||
// CHECK:STDERR: }
|
||||
// CHECK:STDERR: ^
|
||||
}
|
||||
|
||||
+3
-1
@@ -18,5 +18,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_comma_only.carbon:[[@LINE+1]]:9: Expected `.field: field_type` or `.field = value`.
|
||||
// CHECK:STDERR: fail_comma_only.carbon:[[@LINE+3]]:9: Expected `.field: field_type` or `.field = value`.
|
||||
// CHECK:STDERR: var x: {,} = {};
|
||||
// CHECK:STDERR: ^
|
||||
var x: {,} = {};
|
||||
|
||||
@@ -23,5 +23,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_comma_repeat_in_type.carbon:[[@LINE+1]]:17: Expected `.field: field_type`.
|
||||
// CHECK:STDERR: fail_comma_repeat_in_type.carbon:[[@LINE+3]]:17: Expected `.field: field_type`.
|
||||
// CHECK:STDERR: var x: {.a: i32,,} = {};
|
||||
// CHECK:STDERR: ^
|
||||
var x: {.a: i32,,} = {};
|
||||
|
||||
@@ -23,5 +23,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_comma_repeat_in_value.carbon:[[@LINE+1]]:16: Expected `.field = value`.
|
||||
// CHECK:STDERR: fail_comma_repeat_in_value.carbon:[[@LINE+3]]:16: Expected `.field = value`.
|
||||
// CHECK:STDERR: var x: {.a = 0,,} = {};
|
||||
// CHECK:STDERR: ^
|
||||
var x: {.a = 0,,} = {};
|
||||
|
||||
+3
-1
@@ -19,5 +19,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_dot_only.carbon:[[@LINE+1]]:10: Expected identifier after `.`.
|
||||
// CHECK:STDERR: fail_dot_only.carbon:[[@LINE+3]]:10: Expected identifier after `.`.
|
||||
// CHECK:STDERR: var x: {.} = {};
|
||||
// CHECK:STDERR: ^
|
||||
var x: {.} = {};
|
||||
|
||||
@@ -25,5 +25,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_dot_string_colon.carbon:[[@LINE+1]]:10: Expected identifier after `.`.
|
||||
// CHECK:STDERR: fail_dot_string_colon.carbon:[[@LINE+3]]:10: Expected identifier after `.`.
|
||||
// CHECK:STDERR: var x: {."hello": i32, .y: i32} = {};
|
||||
// CHECK:STDERR: ^
|
||||
var x: {."hello": i32, .y: i32} = {};
|
||||
|
||||
@@ -25,5 +25,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_dot_string_equals.carbon:[[@LINE+1]]:10: Expected identifier after `.`.
|
||||
// CHECK:STDERR: fail_dot_string_equals.carbon:[[@LINE+3]]:10: Expected identifier after `.`.
|
||||
// CHECK:STDERR: var x: {."hello" = 0, .y = 4} = {};
|
||||
// CHECK:STDERR: ^
|
||||
var x: {."hello" = 0, .y = 4} = {};
|
||||
|
||||
@@ -24,5 +24,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_extra_token_in_type.carbon:[[@LINE+1]]:17: Expected `,` or `}`.
|
||||
// CHECK:STDERR: fail_extra_token_in_type.carbon:[[@LINE+3]]:17: Expected `,` or `}`.
|
||||
// CHECK:STDERR: var x: {.a: i32 banana} = {.a = 0};
|
||||
// CHECK:STDERR: ^
|
||||
var x: {.a: i32 banana} = {.a = 0};
|
||||
|
||||
@@ -24,5 +24,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_extra_token_in_value.carbon:[[@LINE+1]]:28: Expected `,` or `}`.
|
||||
// CHECK:STDERR: fail_extra_token_in_value.carbon:[[@LINE+3]]:28: Expected `,` or `}`.
|
||||
// CHECK:STDERR: var x: {.a: i32} = {.a = 0 banana};
|
||||
// CHECK:STDERR: ^
|
||||
var x: {.a: i32} = {.a = 0 banana};
|
||||
|
||||
@@ -17,5 +17,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_identifier_colon.carbon:[[@LINE+1]]:9: Expected `.field: field_type` or `.field = value`.
|
||||
// CHECK:STDERR: fail_identifier_colon.carbon:[[@LINE+3]]:9: Expected `.field: field_type` or `.field = value`.
|
||||
// CHECK:STDERR: var x: {a:} = {};
|
||||
// CHECK:STDERR: ^
|
||||
var x: {a:} = {};
|
||||
|
||||
@@ -17,5 +17,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_identifier_equals.carbon:[[@LINE+1]]:9: Expected `.field: field_type` or `.field = value`.
|
||||
// CHECK:STDERR: fail_identifier_equals.carbon:[[@LINE+3]]:9: Expected `.field: field_type` or `.field = value`.
|
||||
// CHECK:STDERR: var x: {a=} = {};
|
||||
// CHECK:STDERR: ^
|
||||
var x: {a=} = {};
|
||||
|
||||
@@ -17,5 +17,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_identifier_only.carbon:[[@LINE+1]]:9: Expected `.field: field_type` or `.field = value`.
|
||||
// CHECK:STDERR: fail_identifier_only.carbon:[[@LINE+3]]:9: Expected `.field: field_type` or `.field = value`.
|
||||
// CHECK:STDERR: var x: {a} = {};
|
||||
// CHECK:STDERR: ^
|
||||
var x: {a} = {};
|
||||
|
||||
@@ -20,5 +20,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_missing_type.carbon:[[@LINE+1]]:12: Expected expression.
|
||||
// CHECK:STDERR: fail_missing_type.carbon:[[@LINE+3]]:12: Expected expression.
|
||||
// CHECK:STDERR: var x: {.a:} = {};
|
||||
// CHECK:STDERR: ^
|
||||
var x: {.a:} = {};
|
||||
|
||||
@@ -20,5 +20,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_missing_value.carbon:[[@LINE+1]]:12: Expected expression.
|
||||
// CHECK:STDERR: fail_missing_value.carbon:[[@LINE+3]]:12: Expected expression.
|
||||
// CHECK:STDERR: var x: {.a=} = {};
|
||||
// CHECK:STDERR: ^
|
||||
var x: {.a=} = {};
|
||||
|
||||
@@ -24,5 +24,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_mix_type_and_value.carbon:[[@LINE+1]]:21: Expected `.field: field_type`.
|
||||
// CHECK:STDERR: fail_mix_type_and_value.carbon:[[@LINE+3]]:21: Expected `.field: field_type`.
|
||||
// CHECK:STDERR: var x: {.a: i32, .b = 0} = {};
|
||||
// CHECK:STDERR: ^
|
||||
var x: {.a: i32, .b = 0} = {};
|
||||
|
||||
@@ -22,5 +22,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_mix_value_and_type.carbon:[[@LINE+1]]:17: Expected `.field = value`.
|
||||
// CHECK:STDERR: fail_mix_value_and_type.carbon:[[@LINE+3]]:17: Expected `.field = value`.
|
||||
// CHECK:STDERR: var x: {.a = 0, b: i32} = {};
|
||||
// CHECK:STDERR: ^
|
||||
var x: {.a = 0, b: i32} = {};
|
||||
|
||||
@@ -47,10 +47,18 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// 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`.
|
||||
// CHECK:STDERR: fail_mix_with_unknown.carbon:[[@LINE+6]]:25: Expected `.field = value`.
|
||||
// CHECK:STDERR: var x: i32 = {.a = 1, .b, .c: i32};
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_mix_with_unknown.carbon:[[@LINE+3]]:29: Expected `.field = value`.
|
||||
// CHECK:STDERR: var x: i32 = {.a = 1, .b, .c: i32};
|
||||
// CHECK:STDERR: ^
|
||||
var x: i32 = {.a = 1, .b, .c: i32};
|
||||
|
||||
// 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`.
|
||||
// CHECK:STDERR: fail_mix_with_unknown.carbon:[[@LINE+6]]:26: Expected `.field: field_type`.
|
||||
// CHECK:STDERR: var x: i32 = {.a: i32, .b, .c = 1};
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_mix_with_unknown.carbon:[[@LINE+3]]:31: Expected `.field: field_type`.
|
||||
// CHECK:STDERR: var x: i32 = {.a: i32, .b, .c = 1};
|
||||
// CHECK:STDERR: ^
|
||||
var x: i32 = {.a: i32, .b, .c = 1};
|
||||
|
||||
@@ -19,5 +19,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: 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+3]]:11: Expected `.field: field_type` or `.field = value`.
|
||||
// CHECK:STDERR: var x: {.a} = {};
|
||||
// CHECK:STDERR: ^
|
||||
var x: {.a} = {};
|
||||
|
||||
@@ -17,5 +17,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_type_no_designator.carbon:[[@LINE+1]]:9: Expected `.field: field_type` or `.field = value`.
|
||||
// CHECK:STDERR: fail_type_no_designator.carbon:[[@LINE+3]]:9: Expected `.field: field_type` or `.field = value`.
|
||||
// CHECK:STDERR: var x: {i32} = {};
|
||||
// CHECK:STDERR: ^
|
||||
var x: {i32} = {};
|
||||
|
||||
+3
-1
@@ -12,5 +12,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_bad_name.carbon:[[@LINE+1]]:5: Expected pattern in `var` declaration.
|
||||
// CHECK:STDERR: fail_bad_name.carbon:[[@LINE+3]]:5: Expected pattern in `var` declaration.
|
||||
// CHECK:STDERR: var *;
|
||||
// CHECK:STDERR: ^
|
||||
var *;
|
||||
|
||||
+3
-1
@@ -12,5 +12,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_empty.carbon:[[@LINE+1]]:4: Expected pattern in `var` declaration.
|
||||
// CHECK:STDERR: fail_empty.carbon:[[@LINE+3]]:4: Expected pattern in `var` declaration.
|
||||
// CHECK:STDERR: var;
|
||||
// CHECK:STDERR: ^
|
||||
var;
|
||||
|
||||
+6
-2
@@ -39,11 +39,15 @@ fn F() {
|
||||
while (a) {
|
||||
if (b) {
|
||||
break
|
||||
// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+1]]:5: `break` statements must end with a `;`.
|
||||
// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+3]]:5: `break` statements must end with a `;`.
|
||||
// CHECK:STDERR: }
|
||||
// CHECK:STDERR: ^
|
||||
}
|
||||
if (c) {
|
||||
continue
|
||||
// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+1]]:5: `continue` statements must end with a `;`.
|
||||
// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+3]]:5: `continue` statements must end with a `;`.
|
||||
// CHECK:STDERR: }
|
||||
// CHECK:STDERR: ^
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -24,6 +24,8 @@
|
||||
|
||||
fn F() {
|
||||
while (a)
|
||||
// CHECK:STDERR: fail_unbraced.carbon:[[@LINE+1]]:5: Expected braced code block.
|
||||
// CHECK:STDERR: fail_unbraced.carbon:[[@LINE+3]]:5: Expected braced code block.
|
||||
// CHECK:STDERR: break;
|
||||
// CHECK:STDERR: ^
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user