mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-22 07:32:38 +00:00
This includes being able to define a class that was previously forward-declared, and being able to define a member function out-of-line that was previously declared inside a class. No support for fields or methods yet, and a class definition doesn't yet cause the class to be treated as a complete type. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
34 lines
988 B
Plaintext
34 lines
988 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
|
|
|
|
namespace Foo;
|
|
|
|
fn Foo.Baz() {
|
|
}
|
|
|
|
// CHECK:STDERR: fail_duplicate.carbon:[[@LINE+6]]:14: ERROR: Redefinition of function Baz.
|
|
// CHECK:STDERR: fn Foo.Baz() {
|
|
// CHECK:STDERR: ^
|
|
// CHECK:STDERR: fail_duplicate.carbon:[[@LINE-6]]:1: Previous definition was here.
|
|
// CHECK:STDERR: fn Foo.Baz() {
|
|
// CHECK:STDERR: ^
|
|
fn Foo.Baz() {
|
|
}
|
|
|
|
// CHECK:STDOUT: file "fail_duplicate.carbon" {
|
|
// CHECK:STDOUT: %.loc7: <namespace> = namespace {.Baz = %Baz.loc9}
|
|
// CHECK:STDOUT: %Baz.loc9: <function> = fn_decl @Baz
|
|
// CHECK:STDOUT: %Baz.loc18: <function> = fn_decl @Baz
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @Baz() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !.loc19:
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|