mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-02 22:02:51 +01:00
Functions in an interface definition are wrapped in an AssociatedEntity instruction, which the logic for finding a previous declaration must unwrap to find the FunctionDecl. This is controlled by the NameScope::is_interface_definition() flag, which is true for interfaces, and causes this extra wrapping to occur when adding the function to the scope.
19 lines
783 B
Plaintext
19 lines
783 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/convert.carbon
|
|
//
|
|
// AUTOUPDATE
|
|
// TIP: To test this file alone, run:
|
|
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/generic_default_fn.carbon
|
|
// TIP: To dump output, run:
|
|
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/generic_default_fn.carbon
|
|
|
|
interface I(T:! type) {
|
|
// TODO: Use `default` here.
|
|
fn F[ref self: Self]() -> Self*;
|
|
}
|
|
|
|
fn I(T:! type).F[ref self: Self]() -> Self* { return &self; }
|