mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 19:30:12 +01:00
This adds most support for default and final methods. Missing components include rejecting definitions for non-default/final methods, and permitting out-of-line definitions. --------- Co-authored-by: Richard Smith <richard@metafoo.co.uk>
33 lines
952 B
Plaintext
33 lines
952 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
|
|
//
|
|
// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon
|
|
//
|
|
// AUTOUPDATE
|
|
// TIP: To test this file alone, run:
|
|
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/impl_inside_interface.carbon
|
|
// TIP: To dump output, run:
|
|
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/impl_inside_interface.carbon
|
|
|
|
// --- impl_in_interface_definition.carbon
|
|
library "[[@TEST_NAME]]";
|
|
|
|
interface I {
|
|
default fn F() {
|
|
class C {}
|
|
impl C as I {}
|
|
}
|
|
}
|
|
|
|
// --- impl_in_interface_definition_with_associated.carbon
|
|
library "[[@TEST_NAME]]";
|
|
|
|
interface I {
|
|
let U: type;
|
|
default fn F() {
|
|
class C {}
|
|
impl C as I where .U = C {}
|
|
}
|
|
}
|