mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 22:02:52 +01:00
Support declaration modifier keywords (#3412)
Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
parent
22dff46ed2
commit
fada410559
@@ -0,0 +1,24 @@
|
||||
// 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
|
||||
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+3]]:1: ERROR: Unrecognized declaration introducer.
|
||||
// CHECK:STDERR: impl foo bar;
|
||||
// CHECK:STDERR: ^~~~
|
||||
impl foo bar;
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+3]]:1: ERROR: Unrecognized declaration introducer.
|
||||
// CHECK:STDERR: impl
|
||||
// CHECK:STDERR: ^~~~
|
||||
impl
|
||||
|
||||
// CHECK:STDOUT: - filename: fail_impl.carbon
|
||||
// CHECK:STDOUT: parse_tree: [
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParseStart', text: 'impl', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParseSubtree', text: ';', has_error: yes, subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParseStart', text: 'impl', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParseSubtree', text: 'impl', has_error: yes, subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
+2
-1
@@ -13,7 +13,8 @@ fn F();
|
||||
// CHECK:STDOUT: - filename: fail_skip_without_semi_to_curly.carbon
|
||||
// CHECK:STDOUT: parse_tree: [
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'EmptyDecl', text: 'struct', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParseStart', text: 'struct', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParseSubtree', text: '}', has_error: yes, subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'F'},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
// 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
|
||||
|
||||
impl fn F();
|
||||
abstract impl fn G();
|
||||
impl abstract fn H();
|
||||
private impl default fn I();
|
||||
|
||||
// CHECK:STDOUT: - filename: impl_fn.carbon
|
||||
// CHECK:STDOUT: parse_tree: [
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'DeclModifierKeyword', text: 'impl'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'F'},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'DeclModifierKeyword', text: 'abstract'},
|
||||
// CHECK:STDOUT: {kind: 'DeclModifierKeyword', text: 'impl'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'G'},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'DeclModifierKeyword', text: 'impl'},
|
||||
// CHECK:STDOUT: {kind: 'DeclModifierKeyword', text: 'abstract'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'H'},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'AccessModifierKeyword', text: 'private'},
|
||||
// CHECK:STDOUT: {kind: 'DeclModifierKeyword', text: 'impl'},
|
||||
// CHECK:STDOUT: {kind: 'DeclModifierKeyword', text: 'default'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'I'},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
Reference in New Issue
Block a user