mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 06:44:46 +01:00
Implement rename me -> self (#2444)
Implements change proposed in #1382 Replaces #1624
This commit is contained in:
+3
-3
@@ -13,16 +13,16 @@
|
||||
package ExplorerTest api;
|
||||
|
||||
interface Addable {
|
||||
fn Add[me: Self](k: i32) -> Self;
|
||||
fn Add[self: Self](k: i32) -> Self;
|
||||
}
|
||||
impl i32 as Addable {
|
||||
fn Add[me: Self](k: i32) -> Self { return me + k; }
|
||||
fn Add[self: Self](k: i32) -> Self { return self + k; }
|
||||
}
|
||||
|
||||
class Class { var n: i32; }
|
||||
class GenericClass(T:! Addable) {
|
||||
var m: T;
|
||||
fn Get[me: Self](n: i32) -> T { return me.m.Add(n); }
|
||||
fn Get[self: Self](n: i32) -> T { return self.m.Add(n); }
|
||||
}
|
||||
|
||||
alias ClassAlias = Class;
|
||||
|
||||
+4
-4
@@ -11,19 +11,19 @@ package ExplorerTest api;
|
||||
|
||||
interface I {
|
||||
fn F() -> i32;
|
||||
fn M[me: Self]() -> i32;
|
||||
fn M[self: Self]() -> i32;
|
||||
}
|
||||
class A {
|
||||
var n: i32;
|
||||
impl as I {
|
||||
fn F() -> i32 { return 1; }
|
||||
fn M[me: Self]() -> i32 { return 2; }
|
||||
fn M[self: Self]() -> i32 { return 2; }
|
||||
}
|
||||
fn G[me: Self]() -> i32 { return 3; }
|
||||
fn G[self: Self]() -> i32 { return 3; }
|
||||
}
|
||||
impl i32 as I {
|
||||
fn F() -> i32 { return 4; }
|
||||
fn M[me: Self]() -> i32 { return 5; }
|
||||
fn M[self: Self]() -> i32 { return 5; }
|
||||
}
|
||||
|
||||
alias IF = I.F;
|
||||
|
||||
Reference in New Issue
Block a user