mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-16 23:18:12 +00:00
Collect the contents of an `impl` into a scope, and start doing very basic checking for `impl` declarations and definitions. This change adds two new `Id` types to the set of type that `NodeStack` supports -- `ImplId` and `NameScopeId`. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
32 lines
828 B
Plaintext
32 lines
828 B
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
|
|
|
|
interface Simple {
|
|
fn F();
|
|
}
|
|
|
|
// CHECK:STDERR: fail_impl_as_scope.carbon:[[@LINE+3]]:6: ERROR: Semantics TODO: `recover from `impl as` in non-class scope`.
|
|
// CHECK:STDERR: impl as Simple {
|
|
// CHECK:STDERR: ^~
|
|
impl as Simple {
|
|
fn F() {}
|
|
}
|
|
|
|
// CHECK:STDOUT: --- fail_impl_as_scope.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: interface @Simple {
|
|
// CHECK:STDOUT: %F: <function> = fn_decl @F [template]
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .F = %F
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @F();
|
|
// CHECK:STDOUT:
|