Files
carbon-lang/explorer/testdata/addr/fail_missing_addr.carbon
T
Jacob Schneider a4c0febc0f handle missing addr in self pointer pattern (#3369)
Add validation to `CheckAddrSelfAccess` to additionally check for
situations where `addr` is potentially missing. I also updated the name
of the function since `me` was renamed to `self`.

Closes #3367
2023-11-06 17:51:08 +00:00

22 lines
565 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 ExplorerTest api;
class Foo {
fn Bar[self: Foo*]() {
self->x += 1;
}
var x: i32;
}
fn Main() -> i32 {
var foo: Foo = {.x = 0};
// CHECK:STDERR: COMPILATION ERROR: fail_missing_addr.carbon:[[@LINE+1]]: method foo.Bar does not match the target function's self pattern (did you forget an `addr`?)
foo.Bar();
return 0;
}