mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 22:02:52 +01:00
Implement rename me -> self (#2444)
Implements change proposed in #1382 Replaces #1624
This commit is contained in:
@@ -12,13 +12,13 @@ package ExplorerTest api;
|
||||
class Cell(T:! Type) {
|
||||
fn Create(x: T) -> Cell(T) { return { .data = x }; }
|
||||
|
||||
fn Get[me: Self]() -> T {
|
||||
return me.data;
|
||||
fn Get[self: Self]() -> T {
|
||||
return self.data;
|
||||
}
|
||||
fn Put[addr me: Self*](x: T) {
|
||||
(*me).data = x;
|
||||
fn Put[addr self: Self*](x: T) {
|
||||
(*self).data = x;
|
||||
}
|
||||
fn CreateOther[me: Self, U:! Type](x: U) -> Cell(U) {
|
||||
fn CreateOther[self: Self, U:! Type](x: U) -> Cell(U) {
|
||||
return {.data = x};
|
||||
}
|
||||
var data: T;
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
package ExplorerTest api;
|
||||
|
||||
interface IntLike {
|
||||
fn Convert[me: Self]() -> i32;
|
||||
fn Convert[self: Self]() -> i32;
|
||||
}
|
||||
impl i32 as IntLike {
|
||||
fn Convert[me: i32]() -> i32 { return me; }
|
||||
fn Convert[self: i32]() -> i32 { return self; }
|
||||
}
|
||||
|
||||
fn add[T:! IntLike](x: {.a: T, .b: ({.m: i32, .n: T}, i32)}) -> i32 {
|
||||
|
||||
Reference in New Issue
Block a user