Files
carbon-lang/explorer/testdata/member_access/fail_qualified_non_member.carbon
T
josh11bandRichard Smith 318eb793eb Explorer: Include self pattern in method type (#2935)
This fixes a bug where Explorer would not detect when:

- an implementation used a method to implement a class function in an interface
- an implementation used a class function to implement a method in an interface
- an implementation method used `addr self` when the interface method did not
- an interface method used `addr self` when the implementation method did not

at type checking time. This would then cause a crash at runtime.

Closes #2857

---------

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2023-06-28 09:07:01 -07:00

16 lines
621 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
package Foo api;
fn F[self: i32]() {}
fn Main() -> i32 {
// TODO: It's unclear whether this is valid per the current rules. See
// https://github.com/carbon-language/carbon-lang/pull/1122
// CHECK:STDERR: COMPILATION ERROR: fail_qualified_non_member.carbon:[[@LINE+1]]: expected name of instance member or interface member in compound member access, found fn [self: i32]() -> ()
42.(F)();
return 0;
}