-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
226 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
class Tests { | ||
class Test { | ||
static let value = 123; | ||
} | ||
|
||
println(Tests.value); // out: 123 | ||
println(Test.value); // out: 123 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class A { | ||
static let value = 100; | ||
} | ||
|
||
class B extends A { | ||
|
||
} | ||
|
||
println(B.value); // out: 100 |
13 changes: 13 additions & 0 deletions
13
res/examples/static_field/override_static_field_from_super.locks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class A { | ||
static let value = 100; | ||
} | ||
|
||
class B extends A { | ||
|
||
} | ||
|
||
class C extends B { | ||
static let value = 123; | ||
} | ||
|
||
println(C.value); // out: 123 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
class Tests { | ||
class Test { | ||
static let value = 123; | ||
} | ||
|
||
Tests.value = 1000; | ||
Test.value = 1000; | ||
|
||
println(Tests.value); // out: 1000 | ||
println(Test.value); // out: 1000 |
11 changes: 11 additions & 0 deletions
11
res/examples/static_field/set_static_field_from_super.locks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class A { | ||
static let value = 100; | ||
} | ||
|
||
class B extends A { | ||
|
||
} | ||
|
||
B.value = 123; | ||
|
||
println(B.value); // out: 123 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class Test { | ||
static fn value () => 123; | ||
} | ||
|
||
println(Test.value()); // out: 123 |
10 changes: 10 additions & 0 deletions
10
res/examples/static_method/get_static_method_from_super.locks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class A { | ||
static fn value () => 100; | ||
} | ||
|
||
class B extends A { | ||
|
||
} | ||
|
||
println(B.value()); // out: 100 | ||
println(A.value == B.value); // out: true |
16 changes: 16 additions & 0 deletions
16
res/examples/static_method/override_static_method_from_super.locks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class A { | ||
static fn value () => 100; | ||
} | ||
|
||
class B extends A { | ||
|
||
} | ||
|
||
class C extends B { | ||
static fn value () => 123; | ||
} | ||
|
||
println(C.value()); // out: 123 | ||
println(A.value == B.value); // out: true | ||
println(B.value == C.value); // out: false | ||
println(A.value == C.value); // out: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class Test { | ||
static fn value () => 123; | ||
} | ||
|
||
fn newFunction () => 1000; | ||
|
||
Test.value = newFunction; // out: TypeError: static methods on classes can not be reassigned (e.g. class<Test>.value = "...") | ||
|
||
println(Test.value()); |
13 changes: 13 additions & 0 deletions
13
res/examples/static_method/set_static_method_from_super.locks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class A { | ||
static fn value () => 100; | ||
} | ||
|
||
class B extends A { | ||
|
||
} | ||
|
||
fn test () { | ||
|
||
} | ||
|
||
B.value = test; // out: TypeError: static methods on classes can not be reassigned (e.g. class<B>.value = "...") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class Class { | ||
static let value = "test value"; | ||
} | ||
|
||
println(typeof(Class.value)); // out: string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class Class { | ||
static fn test () { | ||
|
||
} | ||
} | ||
|
||
println(typeof(Class.test)); // out: function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
class Object { | ||
|
||
} | ||
class Object {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters