mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-02 17:35:52 +01:00
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>
26 lines
533 B
Plaintext
26 lines
533 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
|
|
// CHECK:STDOUT: result: 0
|
|
|
|
package ExplorerTest api;
|
|
|
|
class Point {
|
|
fn Origin() -> Point {
|
|
return {.x = 0, .y = 0};
|
|
}
|
|
fn GetX[self: Point]() -> i32 {
|
|
return self.x;
|
|
}
|
|
var x: i32;
|
|
var y: i32;
|
|
}
|
|
|
|
fn Main() -> i32 {
|
|
var p: Point = Point.Origin();
|
|
var f: __Fn() -> i32 = p.(Point.GetX);
|
|
return f();
|
|
}
|