mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 21:30:12 +01:00
Rename DotOrArrow to PeriodOrArrow (#4263)
We generally say Period (this is the only "Dot" in code), so this seems more consistent. Also renames a few struct tests that had "dot" in the name.
This commit is contained in:
@@ -64,7 +64,7 @@ CARBON_DIAGNOSTIC_KIND(ExpectedArraySemi)
|
||||
CARBON_DIAGNOSTIC_KIND(ExpectedCloseSymbol)
|
||||
CARBON_DIAGNOSTIC_KIND(ExpectedCodeBlock)
|
||||
CARBON_DIAGNOSTIC_KIND(ExpectedExpr)
|
||||
CARBON_DIAGNOSTIC_KIND(ExpectedIdentifierAfterDotOrArrow)
|
||||
CARBON_DIAGNOSTIC_KIND(ExpectedIdentifierAfterPeriodOrArrow)
|
||||
CARBON_DIAGNOSTIC_KIND(ExpectedBindingPattern)
|
||||
CARBON_DIAGNOSTIC_KIND(ExpectedParenAfter)
|
||||
CARBON_DIAGNOSTIC_KIND(ExpectedExprSemi)
|
||||
|
||||
@@ -35,10 +35,10 @@ static auto HandlePeriodOrArrow(Context& context, NodeKind node_kind,
|
||||
context.PushState(State::OnlyParenExpr);
|
||||
return;
|
||||
} else {
|
||||
CARBON_DIAGNOSTIC(ExpectedIdentifierAfterDotOrArrow, Error,
|
||||
CARBON_DIAGNOSTIC(ExpectedIdentifierAfterPeriodOrArrow, Error,
|
||||
"Expected identifier after `{0}`.", llvm::StringLiteral);
|
||||
context.emitter().Emit(
|
||||
*context.position(), ExpectedIdentifierAfterDotOrArrow,
|
||||
*context.position(), ExpectedIdentifierAfterPeriodOrArrow,
|
||||
is_arrow ? llvm::StringLiteral("->") : llvm::StringLiteral("."));
|
||||
// If we see a keyword, assume it was intended to be a name.
|
||||
// TODO: Should keywords be valid here?
|
||||
|
||||
+4
-4
@@ -4,16 +4,16 @@
|
||||
//
|
||||
// AUTOUPDATE
|
||||
// TIP: To test this file alone, run:
|
||||
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/fail_dot_only.carbon
|
||||
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/fail_period_only.carbon
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_dot_only.carbon
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_period_only.carbon
|
||||
|
||||
// CHECK:STDERR: fail_dot_only.carbon:[[@LINE+3]]:10: ERROR: Expected identifier after `.`.
|
||||
// CHECK:STDERR: fail_period_only.carbon:[[@LINE+3]]:10: ERROR: Expected identifier after `.`.
|
||||
// CHECK:STDERR: var x: {.} = {};
|
||||
// CHECK:STDERR: ^
|
||||
var x: {.} = {};
|
||||
|
||||
// CHECK:STDOUT: - filename: fail_dot_only.carbon
|
||||
// CHECK:STDOUT: - filename: fail_period_only.carbon
|
||||
// CHECK:STDOUT: parse_tree: [
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
+4
-4
@@ -4,16 +4,16 @@
|
||||
//
|
||||
// AUTOUPDATE
|
||||
// TIP: To test this file alone, run:
|
||||
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/fail_dot_paren.carbon
|
||||
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/fail_period_paren.carbon
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_dot_paren.carbon
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_period_paren.carbon
|
||||
|
||||
// CHECK:STDERR: fail_dot_paren.carbon:[[@LINE+3]]:10: ERROR: Expected identifier after `.`.
|
||||
// CHECK:STDERR: fail_period_paren.carbon:[[@LINE+3]]:10: ERROR: Expected identifier after `.`.
|
||||
// CHECK:STDERR: var x: {.(a) = 1};
|
||||
// CHECK:STDERR: ^
|
||||
var x: {.(a) = 1};
|
||||
|
||||
// CHECK:STDOUT: - filename: fail_dot_paren.carbon
|
||||
// CHECK:STDOUT: - filename: fail_period_paren.carbon
|
||||
// CHECK:STDOUT: parse_tree: [
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
+4
-4
@@ -4,16 +4,16 @@
|
||||
//
|
||||
// AUTOUPDATE
|
||||
// TIP: To test this file alone, run:
|
||||
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/fail_dot_string_colon.carbon
|
||||
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/fail_period_string_colon.carbon
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_dot_string_colon.carbon
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_period_string_colon.carbon
|
||||
|
||||
// CHECK:STDERR: fail_dot_string_colon.carbon:[[@LINE+3]]:10: ERROR: Expected identifier after `.`.
|
||||
// CHECK:STDERR: fail_period_string_colon.carbon:[[@LINE+3]]:10: ERROR: Expected identifier after `.`.
|
||||
// CHECK:STDERR: var x: {."hello": i32, .y: i32} = {};
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
var x: {."hello": i32, .y: i32} = {};
|
||||
|
||||
// CHECK:STDOUT: - filename: fail_dot_string_colon.carbon
|
||||
// CHECK:STDOUT: - filename: fail_period_string_colon.carbon
|
||||
// CHECK:STDOUT: parse_tree: [
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
+4
-4
@@ -4,16 +4,16 @@
|
||||
//
|
||||
// AUTOUPDATE
|
||||
// TIP: To test this file alone, run:
|
||||
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/fail_dot_string_equals.carbon
|
||||
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/fail_period_string_equals.carbon
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_dot_string_equals.carbon
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_period_string_equals.carbon
|
||||
|
||||
// CHECK:STDERR: fail_dot_string_equals.carbon:[[@LINE+3]]:10: ERROR: Expected identifier after `.`.
|
||||
// CHECK:STDERR: fail_period_string_equals.carbon:[[@LINE+3]]:10: ERROR: Expected identifier after `.`.
|
||||
// CHECK:STDERR: var x: {."hello" = 0, .y = 4} = {};
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
var x: {."hello" = 0, .y = 4} = {};
|
||||
|
||||
// CHECK:STDOUT: - filename: fail_dot_string_equals.carbon
|
||||
// CHECK:STDOUT: - filename: fail_period_string_equals.carbon
|
||||
// CHECK:STDOUT: parse_tree: [
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
Reference in New Issue
Block a user