diff --git a/tests/jballerina-unit-test/src/test/resources/test-src/functions/functions_with_default_parameters.bal b/tests/jballerina-unit-test/src/test/resources/test-src/functions/functions_with_default_parameters.bal index 4fd536a43ee3..9a32f6e5d3f2 100644 --- a/tests/jballerina-unit-test/src/test/resources/test-src/functions/functions_with_default_parameters.bal +++ b/tests/jballerina-unit-test/src/test/resources/test-src/functions/functions_with_default_parameters.bal @@ -308,14 +308,37 @@ function baz(int a, F1 b = function() returns int { return a + 1; }) returns int return a + b(); } -function baz1(int a, F2 b = function() returns function() returns int { return function () returns int { return a; }; }) returns int { +function baz1(int a, F2 b = function() returns function() returns int { return function () returns int { return a; }; }) + returns int { F1 f = b(); return a + f(); } +function baz2(int a, function() returns int b = function() returns int { function (int x = a) returns int f = + function (int p) returns int { return p + 1;}; + return f(); + }) returns int { + return a + b(); +} + +function baz3(int a, function() returns int b = function() returns int { function (int x = a) returns int f = + function (int p) returns int { + function (int c = p) returns int g = + function (int c) returns int { + return c + 1; + }; + return p + g() + 1; + }; + return f(); + }) returns int { + return a + b(); +} + function testParamUseAsValueInAnonFuncWithDefaultForNextParam() { assertEquality(baz(10), 21); assertEquality(baz1(100), 200); + assertEquality(baz2(10), 21); + assertEquality(baz3(10), 32); } const ASSERTION_ERROR_REASON = "AssertionError";