Skip to content

Commit

Permalink
Add negative tests for rest param being final
Browse files Browse the repository at this point in the history
  • Loading branch information
LakshanWeerasinghe committed Jan 17, 2024
1 parent e62b265 commit bf890dc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public void testFinalFailCase() {
BAssertUtil.validateError(compileResultNegative, i++, "cannot assign a value to function argument 'p2'", 49, 5);
BAssertUtil.validateError(compileResultNegative, i++, "cannot assign a value to function argument 'b'", 53, 9);
BAssertUtil.validateError(compileResultNegative, i++, "cannot assign a value to function argument 'b'", 59, 9);
BAssertUtil.validateError(compileResultNegative, i++, "cannot assign a value to function argument 'b'", 66, 9);
Assert.assertEquals(compileResultNegative.getErrorCount(), i);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,10 @@ public function testLocalLevelRestParamFinal() {
b = arr;
};
}

public function testLocalLevelRestParamFinalWithVar() {
int[] arr = [];
var func = function (int i, int... b) {
b = arr;
};
}

0 comments on commit bf890dc

Please sign in to comment.