plum
git clone https://git.pyrossh.dev/plum
A statically typed, imperative programming language inspired by rust, python
7056de2
— Peter John
2026-08-09T21:15:39+05:30
test(plum-checker): fix remaining <Receiver>-syntax test fixtures missed in the sweep
plum-checker/tests/checker_tests.rs
CHANGED
|
@@ -109,7 +109,7 @@ fn method_self_field_access_passes() {
|
|
|
109
109
|
|
|
110
110
|
#[test]
|
|
111
111
|
fn method_self_unknown_field_is_error() {
|
|
112
|
-
let src = "type Cat =\n name: Str\n\
|
|
112
|
+
let src = "type Cat =\n name: Str\n\n fun getAge() -> Int =\n self.age\n";
|
|
113
113
|
let source = parse(src);
|
|
114
114
|
let result = check_source(&source);
|
|
115
115
|
assert!(result.is_err());
|
|
@@ -162,7 +162,7 @@ fn class_call_unknown_field_is_error() {
|
|
|
162
162
|
|
|
163
163
|
#[test]
|
|
164
164
|
fn method_call_via_attribute_type_checks_args() {
|
|
165
|
-
let src = "type Cat =\n name: Str\n\
|
|
165
|
+
let src = "type Cat =\n name: Str\n\n fun rename(n: Str) -> Str =\n n\n\nfun use(c: Cat) -> Str =\n c.rename(\"x\")\n";
|
|
166
166
|
let source = parse(src);
|
|
167
167
|
let result = check_source(&source);
|
|
168
168
|
assert!(result.is_ok(), "expected Ok, got {:?}", result.err());
|
|
@@ -572,8 +572,8 @@ fn generic_method_on_generic_class_type_checks() {
|
|
|
572
572
|
type Box[T] =
|
|
573
573
|
value: T
|
|
574
574
|
|
|
575
|
-
fun getValue
|
|
575
|
+
fun getValue() -> T =
|
|
576
|
-
|
|
576
|
+
self.value
|
|
577
577
|
|
|
578
578
|
fun use() -> Int =
|
|
579
579
|
b = Box(value: 5)
|
|
@@ -655,8 +655,8 @@ fn ordinary_function_with_bare_generic_class_param_type_checks() {
|
|
|
655
655
|
type Box[T] =
|
|
656
656
|
value: T
|
|
657
657
|
|
|
658
|
-
fun getBoxValue
|
|
658
|
+
fun getBoxValue() -> T =
|
|
659
|
-
|
|
659
|
+
self.value
|
|
660
660
|
|
|
661
661
|
fun sumBox(b: Box) -> Int =
|
|
662
662
|
b.getBoxValue()
|
|
@@ -714,8 +714,8 @@ type Cat =
|
|
|
714
714
|
name: Str
|
|
715
715
|
age: Int
|
|
716
716
|
|
|
717
|
-
fun breakCat
|
|
717
|
+
fun breakCat() =
|
|
718
|
-
|
|
718
|
+
self.age = \"oops\"
|
|
719
719
|
";
|
|
720
720
|
let source = parse(src);
|
|
721
721
|
let result = check_source(&source);
|
|
@@ -729,8 +729,8 @@ type Cat =
|
|
|
729
729
|
name: Str
|
|
730
730
|
age: Int
|
|
731
731
|
|
|
732
|
-
fun breakCat
|
|
732
|
+
fun breakCat() =
|
|
733
|
-
|
|
733
|
+
self.nope = 1
|
|
734
734
|
";
|
|
735
735
|
let source = parse(src);
|
|
736
736
|
let result = check_source(&source);
|