/
githubmirror
/
carbon-lang
Обзор
Документация
Войти
/
githubmirror
/
carbon-lang
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
toolchain/check/testdata/class/method/fail_method.carbon
43 строки
2 KB
Chandler Carruth
Move `self` to the explicit `()` parameter list (proposal #7016) (#7272)
10 июн 2026, 18:30
Не верифицирован
10 июн 2026, 18:30
7871237
Код
Авторство
О чём код?
// 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 // // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/convert.carbon // // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/method/fail_method.carbon // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/method/fail_method.carbon class Class { fn NoSelf(); fn WithSelf(self: Class); } alias A = Class.WithSelf; fn F(c: Class) { c.NoSelf(); c.WithSelf(); Class.NoSelf(); // CHECK:STDERR: fail_method.carbon:[[@LINE+7]]:3: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] // CHECK:STDERR: Class.WithSelf(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_method.carbon:[[@LINE-13]]:3: note: calling function declared here [InCallToEntity] // CHECK:STDERR: fn WithSelf(self: Class); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: Class.WithSelf(); Class.WithSelf(c); // CHECK:STDERR: fail_method.carbon:[[@LINE+7]]:3: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] // CHECK:STDERR: A(); // CHECK:STDERR: ^~~ // CHECK:STDERR: fail_method.carbon:[[@LINE-23]]:3: note: calling function declared here [InCallToEntity] // CHECK:STDERR: fn WithSelf(self: Class); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: A(); }