mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-02 17:52:58 +01:00
This is to help identify which diagnostics we're actually using. Note that driver/testdata still has tests which don't pass this flag, and so continue to test the kind-less (default) behavior.
132 lines
6.2 KiB
Plaintext
132 lines
6.2 KiB
Plaintext
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
// AUTOUPDATE
|
|
// TIP: To test this file alone, run:
|
|
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/alias/fail_syntax.carbon
|
|
// TIP: To dump output, run:
|
|
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/alias/fail_syntax.carbon
|
|
|
|
// CHECK:STDERR: fail_syntax.carbon:[[@LINE+4]]:7: error(ExpectedDeclName): `alias` introducer should be followed by a name
|
|
// CHECK:STDERR: alias = b;
|
|
// CHECK:STDERR: ^
|
|
// CHECK:STDERR:
|
|
alias = b;
|
|
|
|
// CHECK:STDERR: fail_syntax.carbon:[[@LINE+4]]:9: error(ExpectedAliasInitializer): `alias` requires a `=` for the source
|
|
// CHECK:STDERR: alias a b;
|
|
// CHECK:STDERR: ^
|
|
// CHECK:STDERR:
|
|
alias a b;
|
|
|
|
// CHECK:STDERR: fail_syntax.carbon:[[@LINE+4]]:10: error(ExpectedExpr): expected expression
|
|
// CHECK:STDERR: alias a =;
|
|
// CHECK:STDERR: ^
|
|
// CHECK:STDERR:
|
|
alias a =;
|
|
|
|
// CHECK:STDERR: fail_syntax.carbon:[[@LINE+4]]:8: error(ExpectedAliasInitializer): `alias` requires a `=` for the source
|
|
// CHECK:STDERR: alias a;
|
|
// CHECK:STDERR: ^
|
|
// CHECK:STDERR:
|
|
alias a;
|
|
|
|
// CHECK:STDERR: fail_syntax.carbon:[[@LINE+4]]:7: error(ExpectedDeclName): `alias` introducer should be followed by a name
|
|
// CHECK:STDERR: alias =;
|
|
// CHECK:STDERR: ^
|
|
// CHECK:STDERR:
|
|
alias =;
|
|
|
|
// CHECK:STDERR: fail_syntax.carbon:[[@LINE+4]]:9: error(ExpectedAliasInitializer): `alias` requires a `=` for the source
|
|
// CHECK:STDERR: alias a b c = d;
|
|
// CHECK:STDERR: ^
|
|
// CHECK:STDERR:
|
|
alias a b c = d;
|
|
|
|
// CHECK:STDERR: fail_syntax.carbon:[[@LINE+4]]:13: error(ExpectedDeclSemi): `alias` declarations must end with a `;`
|
|
// CHECK:STDERR: alias a = b c d;
|
|
// CHECK:STDERR: ^
|
|
// CHECK:STDERR:
|
|
alias a = b c d;
|
|
|
|
fn F() {
|
|
// CHECK:STDERR: fail_syntax.carbon:[[@LINE+4]]:8: error(ExpectedDeclName): `alias` introducer should be followed by a name
|
|
// CHECK:STDERR: alias;
|
|
// CHECK:STDERR: ^
|
|
// CHECK:STDERR:
|
|
alias;
|
|
|
|
// CHECK:STDERR: fail_syntax.carbon:[[@LINE+4]]:12: error(ExpectedExpr): expected expression
|
|
// CHECK:STDERR: alias a =;
|
|
// CHECK:STDERR: ^
|
|
// CHECK:STDERR:
|
|
alias a =;
|
|
|
|
alias a =
|
|
// CHECK:STDERR: fail_syntax.carbon:[[@LINE+4]]:1: error(ExpectedExpr): expected expression
|
|
// CHECK:STDERR: }
|
|
// CHECK:STDERR: ^
|
|
// CHECK:STDERR:
|
|
}
|
|
|
|
alias a = b
|
|
|
|
// CHECK:STDERR: fail_syntax.carbon:[[@LINE+56]]:21: error(ExpectedDeclSemi): `alias` declarations must end with a `;`
|
|
// CHECK:STDERR: // CHECK:STDOUT: ]
|
|
// CHECK:STDERR: ^
|
|
// CHECK:STDOUT: - filename: fail_syntax.carbon
|
|
// CHECK:STDOUT: parse_tree: [
|
|
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
|
// CHECK:STDOUT: {kind: 'AliasIntroducer', text: 'alias'},
|
|
// CHECK:STDOUT: {kind: 'InvalidParse', text: '=', has_error: yes},
|
|
// CHECK:STDOUT: {kind: 'Alias', text: ';', has_error: yes, subtree_size: 3},
|
|
// CHECK:STDOUT: {kind: 'AliasIntroducer', text: 'alias'},
|
|
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'a'},
|
|
// CHECK:STDOUT: {kind: 'Alias', text: ';', has_error: yes, subtree_size: 3},
|
|
// CHECK:STDOUT: {kind: 'AliasIntroducer', text: 'alias'},
|
|
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'a'},
|
|
// CHECK:STDOUT: {kind: 'AliasInitializer', text: '='},
|
|
// CHECK:STDOUT: {kind: 'InvalidParse', text: ';', has_error: yes},
|
|
// CHECK:STDOUT: {kind: 'Alias', text: ';', has_error: yes, subtree_size: 5},
|
|
// CHECK:STDOUT: {kind: 'AliasIntroducer', text: 'alias'},
|
|
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'a'},
|
|
// CHECK:STDOUT: {kind: 'Alias', text: ';', has_error: yes, subtree_size: 3},
|
|
// CHECK:STDOUT: {kind: 'AliasIntroducer', text: 'alias'},
|
|
// CHECK:STDOUT: {kind: 'InvalidParse', text: '=', has_error: yes},
|
|
// CHECK:STDOUT: {kind: 'Alias', text: ';', has_error: yes, subtree_size: 3},
|
|
// CHECK:STDOUT: {kind: 'AliasIntroducer', text: 'alias'},
|
|
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'a'},
|
|
// CHECK:STDOUT: {kind: 'Alias', text: ';', has_error: yes, subtree_size: 3},
|
|
// CHECK:STDOUT: {kind: 'AliasIntroducer', text: 'alias'},
|
|
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'a'},
|
|
// CHECK:STDOUT: {kind: 'AliasInitializer', text: '='},
|
|
// CHECK:STDOUT: {kind: 'IdentifierNameExpr', text: 'b'},
|
|
// CHECK:STDOUT: {kind: 'Alias', text: ';', has_error: yes, subtree_size: 5},
|
|
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
|
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'F'},
|
|
// CHECK:STDOUT: {kind: 'TuplePatternStart', text: '('},
|
|
// CHECK:STDOUT: {kind: 'TuplePattern', text: ')', subtree_size: 2},
|
|
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
|
|
// CHECK:STDOUT: {kind: 'AliasIntroducer', text: 'alias'},
|
|
// CHECK:STDOUT: {kind: 'InvalidParse', text: ';', has_error: yes},
|
|
// CHECK:STDOUT: {kind: 'Alias', text: ';', has_error: yes, subtree_size: 3},
|
|
// CHECK:STDOUT: {kind: 'AliasIntroducer', text: 'alias'},
|
|
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'a'},
|
|
// CHECK:STDOUT: {kind: 'AliasInitializer', text: '='},
|
|
// CHECK:STDOUT: {kind: 'InvalidParse', text: ';', has_error: yes},
|
|
// CHECK:STDOUT: {kind: 'Alias', text: ';', has_error: yes, subtree_size: 5},
|
|
// CHECK:STDOUT: {kind: 'AliasIntroducer', text: 'alias'},
|
|
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'a'},
|
|
// CHECK:STDOUT: {kind: 'AliasInitializer', text: '='},
|
|
// CHECK:STDOUT: {kind: 'InvalidParse', text: '}', has_error: yes},
|
|
// CHECK:STDOUT: {kind: 'Alias', text: '=', has_error: yes, subtree_size: 5},
|
|
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 19},
|
|
// CHECK:STDOUT: {kind: 'AliasIntroducer', text: 'alias'},
|
|
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'a'},
|
|
// CHECK:STDOUT: {kind: 'AliasInitializer', text: '='},
|
|
// CHECK:STDOUT: {kind: 'IdentifierNameExpr', text: 'b'},
|
|
// CHECK:STDOUT: {kind: 'Alias', text: 'b', has_error: yes, subtree_size: 5},
|
|
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
|
// CHECK:STDOUT: ]
|