mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 20:51:16 +01:00
Implement rename me -> self (#2444)
Implements change proposed in #1382 Replaces #1624
This commit is contained in:
+4
-4
@@ -11,7 +11,7 @@ package ExplorerTest api;
|
||||
|
||||
interface Number {
|
||||
fn Zero() -> Self;
|
||||
fn Add[me: Self](other: Self) -> Self;
|
||||
fn Add[self: Self](other: Self) -> Self;
|
||||
}
|
||||
|
||||
class Point(T:! Number) {
|
||||
@@ -21,13 +21,13 @@ class Point(T:! Number) {
|
||||
|
||||
external impl i32 as Number {
|
||||
fn Zero() -> i32 { return 0; }
|
||||
fn Add[me: i32](other: i32) -> i32 { return me + other; }
|
||||
fn Add[self: i32](other: i32) -> i32 { return self + other; }
|
||||
}
|
||||
|
||||
external impl forall [U:! Number] Point(U) as Number {
|
||||
fn Zero() -> Point(U) { return {.x = U.Zero(), .y = U.Zero() }; }
|
||||
fn Add[me: Point(U)](other: Point(U)) -> Point(U) {
|
||||
return {.x = me.x.Add(other.x), .y = me.y.Add(other.y)};
|
||||
fn Add[self: Point(U)](other: Point(U)) -> Point(U) {
|
||||
return {.x = self.x.Add(other.x), .y = self.y.Add(other.y)};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user