From 7659463c4516f1b584897c41df0051f9c5e464fe Mon Sep 17 00:00:00 2001 From: chiranSachintha Date: Fri, 10 Feb 2023 17:20:41 +0530 Subject: [PATCH 1/5] Allow access field annotations in tuple type descriptors --- .../compiler/desugar/ClosureGenerator.java | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/desugar/ClosureGenerator.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/desugar/ClosureGenerator.java index 672038a1a7a9..3ff21a53e246 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/desugar/ClosureGenerator.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/desugar/ClosureGenerator.java @@ -176,6 +176,7 @@ import org.wso2.ballerinalang.compiler.util.ClosureVarSymbol; import org.wso2.ballerinalang.compiler.util.CompilerContext; import org.wso2.ballerinalang.compiler.util.Name; +import org.wso2.ballerinalang.compiler.util.Names; import org.wso2.ballerinalang.util.Flags; import java.util.ArrayList; @@ -197,7 +198,7 @@ public class ClosureGenerator extends BLangNodeVisitor { private static final CompilerContext.Key CLOSURE_GENERATOR_KEY = new CompilerContext.Key<>(); private Queue queue; - private List annotationClosureReferences; + private Queue annotationClosureReferences; private SymbolTable symTable; private SymbolEnv env; private BLangNode result; @@ -217,7 +218,7 @@ private ClosureGenerator(CompilerContext context) { context.put(CLOSURE_GENERATOR_KEY, this); this.symTable = SymbolTable.getInstance(context); this.queue = new LinkedList<>(); - this.annotationClosureReferences = new ArrayList<>(); + this.annotationClosureReferences = new LinkedList<>(); this.symResolver = SymbolResolver.getInstance(context); this.annotationDesugar = AnnotationDesugar.getInstance(context); } @@ -240,7 +241,7 @@ public void visit(BLangPackage pkgNode) { pkgNode.annotations.forEach(annotation -> rewrite(annotation, pkgEnv)); pkgNode.initFunction = rewrite(pkgNode.initFunction, pkgEnv); pkgNode.classDefinitions = rewrite(pkgNode.classDefinitions, pkgEnv); - pkgNode.globalVars.forEach(globalVar -> rewrite(globalVar, pkgEnv)); + rewrite(pkgNode.globalVars, pkgEnv); addClosuresToGlobalVariableList(pkgEnv); for (int i = 0; i < pkgNode.functions.size(); i++) { BLangFunction bLangFunction = pkgNode.functions.get(i); @@ -410,7 +411,7 @@ public void visit(BLangTupleTypeNode tupleTypeNode) { private void desugarFieldAnnotations(BSymbol owner, BTypeSymbol typeSymbol, List fields, Location pos) { - if (owner.getKind() != SymbolKind.PACKAGE) { + if (owner.getKind() != SymbolKind.PACKAGE || typeSymbol.name == Names.EMPTY) { owner = getOwner(env); BLangLambdaFunction lambdaFunction = annotationDesugar.defineFieldAnnotations(fields, pos, env.enclPkg, env, typeSymbol.pkgID, owner); @@ -1598,9 +1599,18 @@ private E rewrite(E node, SymbolEnv env) { } private List rewrite(List nodeList, SymbolEnv env) { - for (int i = 0; i < nodeList.size(); i++) { - nodeList.set(i, rewrite(nodeList.get(i), env)); + Queue previousQueue = this.annotationClosureReferences; + this.annotationClosureReferences = new LinkedList<>(); + int size = nodeList.size(); + for (int i = 0; i < size; i++) { + E node = rewrite(nodeList.remove(0), env); + Iterator iterator = annotationClosureReferences.iterator(); + while (iterator.hasNext()) { + nodeList.add(rewrite((E) annotationClosureReferences.poll().var, env)); + } + nodeList.add(node); } + this.annotationClosureReferences = previousQueue; return nodeList; } From 4485653a5ac8302d5c013fab61880448a0e2d211 Mon Sep 17 00:00:00 2001 From: chiranSachintha Date: Fri, 10 Feb 2023 17:21:17 +0530 Subject: [PATCH 2/5] Add unit tests --- .../local_tuple_annotation_test.bal | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/tests/jballerina-unit-test/src/test/resources/test-src/annotations/local_tuple_annotation_test.bal b/tests/jballerina-unit-test/src/test/resources/test-src/annotations/local_tuple_annotation_test.bal index 4dbd757c67e5..92928d88f86d 100644 --- a/tests/jballerina-unit-test/src/test/resources/test-src/annotations/local_tuple_annotation_test.bal +++ b/tests/jballerina-unit-test/src/test/resources/test-src/annotations/local_tuple_annotation_test.bal @@ -24,47 +24,72 @@ type Details record {| string name; int age; |}; + +type TupleType [@annotOne {value: "10"} int, @annotOne {value: "k"} int, string...]|int; annotation AnnotTupleOne annotOne on type, field; annotation AnnotTupleOne annotTwo on type, field; annotation Details details on field; +[@annotOne {value: "10"} int, @annotOne {value: "k"} int, string...] g1 = [1, 2, "hello", "world"]; + function testAnnotationOnTupleFields() { string k = "chiranS"; [@annotOne {value: "10"} int, @annotOne {value: k} int, string...] x1 = [1, 2, "hello", "world"]; map m1 = getLocalTupleAnnotations(typeof x1, "$field$.0"); map m2 = getLocalTupleAnnotations(typeof x1, "$field$.1"); + map m3 = getLocalTupleAnnotations(typeof g1, "$field$.0"); + map m4 = getLocalTupleAnnotations(typeof g1, "$field$.1"); assertEquality({value: "10"}, >m1["annotOne"]); assertEquality({value: "chiranS"}, >m2["annotOne"]); + assertEquality({value: "10"}, >m3["annotOne"]); + assertEquality({value: "k"}, >m4["annotOne"]); } +string gVar0 = "foo"; +[@details {name: gVar0, age: gVar4} int, @details {name: "name", age: 0} int, string...] g4 = [1, 2, "hello", "world"]; + function testAnnotationOnTupleFields2() { string name = "chiranS"; int age = 26; [@details {name: name, age: age} int, @details {name: "name", age: 0} int, string...] x1 = [1, 2, "hello", "world"]; map m1 = getLocalTupleAnnotations(typeof x1, "$field$.0"); map m2 = getLocalTupleAnnotations(typeof x1, "$field$.1"); + map m3 = getLocalTupleAnnotations(typeof g4, "$field$.0"); + map m4 = getLocalTupleAnnotations(typeof g4, "$field$.1"); assertEquality({name: "chiranS", age: 26}, >m1["details"]); assertEquality({name: "name", age: 0}, >m2["details"]); + assertEquality({name: "foo", age: 15}, >m3["details"]); + assertEquality({name: "name", age: 0}, >m4["details"]); } string gVar = "foo"; string gVar1 = "bar"; +[@annotOne {value: gVar} int, int, string...] g2 = [1, 2, "hello", "world"]; function testAnnotationOnTupleWithGlobalVariable() { [@annotOne {value: gVar} int, int, string...] x1 = [1, 2, "hello", "world"]; - map m = getLocalTupleAnnotations(typeof x1, "$field$.0"); - assertEquality({value: "foo"}, >m["annotOne"]); + map m1 = getLocalTupleAnnotations(typeof x1, "$field$.0"); + map m2 = getLocalTupleAnnotations(typeof g2, "$field$.0"); + assertEquality({value: "foo"}, >m1["annotOne"]); + assertEquality({value: "foo"}, >m2["annotOne"]); } +[@annotOne {value: "foo"} @annotTwo {value: "bar"} int, @details {name: gVar2, age: 0} int, string...] g3 = [1, 2, "hello", "world"]; + function testMultipleAnnotationsOnLocalTuple() { string k = "chiranS"; [@annotOne {value: "foo"} @annotTwo {value: "bar"} int, @details {name: k, age: 0} int, string...] x1 = [1, 2, "hello", "world"]; map m1 = getLocalTupleAnnotations(typeof x1, "$field$.0"); map m2 = getLocalTupleAnnotations(typeof x1, "$field$.1"); + map m3 = getLocalTupleAnnotations(typeof g3, "$field$.0"); + map m4 = getLocalTupleAnnotations(typeof g3, "$field$.1"); assertEquality({value: "foo"}, >m1["annotOne"]); assertEquality({value: "bar"}, >m1["annotTwo"]); assertEquality({name: "chiranS", age: 0}, >m2["details"]); + assertEquality({value: "foo"}, >m3["annotOne"]); + assertEquality({value: "bar"}, >m3["annotTwo"]); + assertEquality({name: "baz", age: 0}, >m4["details"]); } function() returns [int] x = function() returns [@annotOne {value: "foo"} int] {return [1];}; From 9df990d77eac99e0913a9806d0c27d0989bacad0 Mon Sep 17 00:00:00 2001 From: chiranSachintha Date: Mon, 13 Feb 2023 07:52:47 +0530 Subject: [PATCH 3/5] Add bala tests --- .../bala/test_bala/annotations/annotation.bal | 14 +++++++++----- .../test_projects/test_project/annotations.bal | 4 ++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/jballerina-unit-test/src/test/resources/test-src/bala/test_bala/annotations/annotation.bal b/tests/jballerina-unit-test/src/test/resources/test-src/bala/test_bala/annotations/annotation.bal index e2d2a0aa0e9c..189631cf1645 100644 --- a/tests/jballerina-unit-test/src/test/resources/test-src/bala/test_bala/annotations/annotation.bal +++ b/tests/jballerina-unit-test/src/test/resources/test-src/bala/test_bala/annotations/annotation.bal @@ -37,10 +37,14 @@ function testAnnotOnRecordFields() { } function testAnnotOnTupleFields() { - map m = getLocalTupleAnnotations(typeof foo:testAnnotationsOnLocalTupleFields(), "$field$.0"); + map m = getAnonymousTupleAnnotations(typeof foo:testAnnotationsOnLocalTupleFields(), "$field$.0"); assertEquality({value : "10"} , >m["testorg/foo:1:annotOne"]); - m = getLocalTupleAnnotations(typeof foo:testTupleFieldAnnotationsOnReturnType(), "$field$.0"); + m = getAnonymousTupleAnnotations(typeof foo:testTupleFieldAnnotationsOnReturnType(), "$field$.0"); assertEquality({value : "100"} , >m["testorg/foo:1:annotOne"]); + m = getAnonymousTupleAnnotations(typeof foo:g1, "$field$.0"); + assertEquality({value : "chiranS"} , >m["testorg/foo:1:annotOne"]); + m = getAnonymousTupleAnnotations(typeof foo:g1, "$field$.1"); + assertEquality({value : "k"} , >m["testorg/foo:1:annotOne"]); } function getLocalRecordAnnotations(typedesc obj, string annotName) returns map = @@ -49,10 +53,10 @@ function getLocalRecordAnnotations(typedesc obj, string annotName) returns name: "getLocalRecordAnnotations" } external; -function getLocalTupleAnnotations(typedesc obj, string annotName) returns map = +function getAnonymousTupleAnnotations(typedesc obj, string annotName) returns map = @java:Method { - 'class: "org/ballerinalang/test/annotations/LocalTupleAnnotationTest", - name: "getLocalTupleAnnotations" + 'class: "org/ballerinalang/test/annotations/AnonymousTupleAnnotationTest", + name: "getAnonymousTupleAnnotations" } external; function assertEquality(anydata expected, anydata actual) { diff --git a/tests/jballerina-unit-test/src/test/resources/test-src/bala/test_projects/test_project/annotations.bal b/tests/jballerina-unit-test/src/test/resources/test-src/bala/test_projects/test_project/annotations.bal index ad2b48f29501..10e6bdb318c8 100644 --- a/tests/jballerina-unit-test/src/test/resources/test-src/bala/test_projects/test_project/annotations.bal +++ b/tests/jballerina-unit-test/src/test/resources/test-src/bala/test_projects/test_project/annotations.bal @@ -45,3 +45,7 @@ public function testAnnotationsOnLocalTupleFields() returns [@annotOne {value: " [@annotOne {value: "10"} string] r = [""]; return r; } + +public string gVar = "chiranS"; + +public [@annotOne {value: gVar} int, @annotOne {value: "k"} int, string...] g1 = [1, 2, "hello", "world"]; From 44fc815cc85f1fc45a84cc90b27be1a18400f490 Mon Sep 17 00:00:00 2001 From: chiranSachintha Date: Mon, 13 Feb 2023 07:54:33 +0530 Subject: [PATCH 4/5] Rename `LocalTupleAnnotationTest` to `AnonymousTupleAnnotationTest` --- ...java => AnonymousTupleAnnotationTest.java} | 8 +-- ...al => anonymous_tuple_annotation_test.bal} | 58 +++++++++---------- 2 files changed, 32 insertions(+), 34 deletions(-) rename tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/annotations/{LocalTupleAnnotationTest.java => AnonymousTupleAnnotationTest.java} (91%) rename tests/jballerina-unit-test/src/test/resources/test-src/annotations/{local_tuple_annotation_test.bal => anonymous_tuple_annotation_test.bal} (74%) diff --git a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/annotations/LocalTupleAnnotationTest.java b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/annotations/AnonymousTupleAnnotationTest.java similarity index 91% rename from tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/annotations/LocalTupleAnnotationTest.java rename to tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/annotations/AnonymousTupleAnnotationTest.java index 137e50f59e03..a41e395e5a6d 100644 --- a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/annotations/LocalTupleAnnotationTest.java +++ b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/annotations/AnonymousTupleAnnotationTest.java @@ -32,16 +32,16 @@ import org.testng.annotations.Test; /** - * Class to test annotation evaluation within local tuple types. + * Class to test annotation evaluation within anonymous tuple types. * * @since 2201.4.0 */ -public class LocalTupleAnnotationTest { +public class AnonymousTupleAnnotationTest { private CompileResult result; @BeforeClass public void setup() { - result = BCompileUtil.compile("test-src/annotations/local_tuple_annotation_test.bal"); + result = BCompileUtil.compile("test-src/annotations/anonymous_tuple_annotation_test.bal"); Assert.assertEquals(result.getErrorCount(), 0); } @@ -85,7 +85,7 @@ public Object[] dataToTestAnnotationsOfLocalTuple() { }; } - public static BMap getLocalTupleAnnotations(TypedescValue typedescValue, BString annotName) { + public static BMap getAnonymousTupleAnnotations(TypedescValue typedescValue, BString annotName) { return (BMap) TypeChecker.getAnnotValue(typedescValue, annotName); } } diff --git a/tests/jballerina-unit-test/src/test/resources/test-src/annotations/local_tuple_annotation_test.bal b/tests/jballerina-unit-test/src/test/resources/test-src/annotations/anonymous_tuple_annotation_test.bal similarity index 74% rename from tests/jballerina-unit-test/src/test/resources/test-src/annotations/local_tuple_annotation_test.bal rename to tests/jballerina-unit-test/src/test/resources/test-src/annotations/anonymous_tuple_annotation_test.bal index 92928d88f86d..8491a52f0ce6 100644 --- a/tests/jballerina-unit-test/src/test/resources/test-src/annotations/local_tuple_annotation_test.bal +++ b/tests/jballerina-unit-test/src/test/resources/test-src/annotations/anonymous_tuple_annotation_test.bal @@ -24,8 +24,6 @@ type Details record {| string name; int age; |}; - -type TupleType [@annotOne {value: "10"} int, @annotOne {value: "k"} int, string...]|int; annotation AnnotTupleOne annotOne on type, field; annotation AnnotTupleOne annotTwo on type, field; @@ -36,10 +34,10 @@ annotation Details details on field; function testAnnotationOnTupleFields() { string k = "chiranS"; [@annotOne {value: "10"} int, @annotOne {value: k} int, string...] x1 = [1, 2, "hello", "world"]; - map m1 = getLocalTupleAnnotations(typeof x1, "$field$.0"); - map m2 = getLocalTupleAnnotations(typeof x1, "$field$.1"); - map m3 = getLocalTupleAnnotations(typeof g1, "$field$.0"); - map m4 = getLocalTupleAnnotations(typeof g1, "$field$.1"); + map m1 = getAnonymousTupleAnnotations(typeof x1, "$field$.0"); + map m2 = getAnonymousTupleAnnotations(typeof x1, "$field$.1"); + map m3 = getAnonymousTupleAnnotations(typeof g1, "$field$.0"); + map m4 = getAnonymousTupleAnnotations(typeof g1, "$field$.1"); assertEquality({value: "10"}, >m1["annotOne"]); assertEquality({value: "chiranS"}, >m2["annotOne"]); assertEquality({value: "10"}, >m3["annotOne"]); @@ -53,10 +51,10 @@ function testAnnotationOnTupleFields2() { string name = "chiranS"; int age = 26; [@details {name: name, age: age} int, @details {name: "name", age: 0} int, string...] x1 = [1, 2, "hello", "world"]; - map m1 = getLocalTupleAnnotations(typeof x1, "$field$.0"); - map m2 = getLocalTupleAnnotations(typeof x1, "$field$.1"); - map m3 = getLocalTupleAnnotations(typeof g4, "$field$.0"); - map m4 = getLocalTupleAnnotations(typeof g4, "$field$.1"); + map m1 = getAnonymousTupleAnnotations(typeof x1, "$field$.0"); + map m2 = getAnonymousTupleAnnotations(typeof x1, "$field$.1"); + map m3 = getAnonymousTupleAnnotations(typeof g4, "$field$.0"); + map m4 = getAnonymousTupleAnnotations(typeof g4, "$field$.1"); assertEquality({name: "chiranS", age: 26}, >m1["details"]); assertEquality({name: "name", age: 0}, >m2["details"]); assertEquality({name: "foo", age: 15}, >m3["details"]); @@ -69,8 +67,8 @@ string gVar1 = "bar"; function testAnnotationOnTupleWithGlobalVariable() { [@annotOne {value: gVar} int, int, string...] x1 = [1, 2, "hello", "world"]; - map m1 = getLocalTupleAnnotations(typeof x1, "$field$.0"); - map m2 = getLocalTupleAnnotations(typeof g2, "$field$.0"); + map m1 = getAnonymousTupleAnnotations(typeof x1, "$field$.0"); + map m2 = getAnonymousTupleAnnotations(typeof g2, "$field$.0"); assertEquality({value: "foo"}, >m1["annotOne"]); assertEquality({value: "foo"}, >m2["annotOne"]); } @@ -80,10 +78,10 @@ function testAnnotationOnTupleWithGlobalVariable() { function testMultipleAnnotationsOnLocalTuple() { string k = "chiranS"; [@annotOne {value: "foo"} @annotTwo {value: "bar"} int, @details {name: k, age: 0} int, string...] x1 = [1, 2, "hello", "world"]; - map m1 = getLocalTupleAnnotations(typeof x1, "$field$.0"); - map m2 = getLocalTupleAnnotations(typeof x1, "$field$.1"); - map m3 = getLocalTupleAnnotations(typeof g3, "$field$.0"); - map m4 = getLocalTupleAnnotations(typeof g3, "$field$.1"); + map m1 = getAnonymousTupleAnnotations(typeof x1, "$field$.0"); + map m2 = getAnonymousTupleAnnotations(typeof x1, "$field$.1"); + map m3 = getAnonymousTupleAnnotations(typeof g3, "$field$.0"); + map m4 = getAnonymousTupleAnnotations(typeof g3, "$field$.1"); assertEquality({value: "foo"}, >m1["annotOne"]); assertEquality({value: "bar"}, >m1["annotTwo"]); assertEquality({name: "chiranS", age: 0}, >m2["details"]); @@ -97,10 +95,10 @@ function() returns [int] x2 = function() returns [@annotOne {value: gVar1} @anno function() returns [int, int] x3 = function() returns [@annotOne {value: gVar1} int, @details {name: "name", age: gVar3} int] {return [1, 1];}; function testGlobalAnnotationsOnFunctionPointerReturnType() { - map m1 = getLocalTupleAnnotations(typeof x(), "$field$.0"); - map m2 = getLocalTupleAnnotations(typeof x2(), "$field$.0"); - map m3 = getLocalTupleAnnotations(typeof x3(), "$field$.0"); - map m4 = getLocalTupleAnnotations(typeof x3(), "$field$.1"); + map m1 = getAnonymousTupleAnnotations(typeof x(), "$field$.0"); + map m2 = getAnonymousTupleAnnotations(typeof x2(), "$field$.0"); + map m3 = getAnonymousTupleAnnotations(typeof x3(), "$field$.0"); + map m4 = getAnonymousTupleAnnotations(typeof x3(), "$field$.1"); assertEquality({value: "foo"}, >m1["annotOne"]); assertEquality({value: "bar"}, >m2["annotOne"]); assertEquality({value: "baz"}, >m2["annotTwo"]); @@ -132,10 +130,10 @@ function func2() returns [@details {name: "name", age: gVar4} int, @annotTwo {va } function testGlobalAnnotationsOnFunctionReturnType() { - map m1 = getLocalTupleAnnotations(typeof func(), "$field$.0"); - map m2 = getLocalTupleAnnotations(typeof func1(), "$field$.0"); - map m3 = getLocalTupleAnnotations(typeof func2(), "$field$.0"); - map m4 = getLocalTupleAnnotations(typeof func2(), "$field$.1"); + map m1 = getAnonymousTupleAnnotations(typeof func(), "$field$.0"); + map m2 = getAnonymousTupleAnnotations(typeof func1(), "$field$.0"); + map m3 = getAnonymousTupleAnnotations(typeof func2(), "$field$.0"); + map m4 = getAnonymousTupleAnnotations(typeof func2(), "$field$.1"); assertEquality({value: "foo"}, >m1["annotOne"]); assertEquality({value: "foo"}, >m2["annotOne"]); assertEquality({value: "baz"}, >m2["annotTwo"]); @@ -148,13 +146,13 @@ function testGlobalAnnotationsOnFunctionReturnType() { int gVar4 = 15; function func3([@annotOne {value: "foo"} int] a) { - map m1 = getLocalTupleAnnotations(typeof a, "$field$.0"); + map m1 = getAnonymousTupleAnnotations(typeof a, "$field$.0"); assertEquality({value: "foo"}, >m1["annotOne"]); } function func4([@annotOne {value: "foo"} int, @annotTwo {value: "foo"} @details {name: "name", age: gVar4} int] a) { - map m1 = getLocalTupleAnnotations(typeof a, "$field$.0"); - map m2 = getLocalTupleAnnotations(typeof a, "$field$.1"); + map m1 = getAnonymousTupleAnnotations(typeof a, "$field$.0"); + map m2 = getAnonymousTupleAnnotations(typeof a, "$field$.1"); assertEquality({value: "foo"}, >m1["annotOne"]); assertEquality({value: "foo"}, >m2["annotTwo"]); @@ -166,10 +164,10 @@ function testGlobalAnnotationsOnFunctionParameterType() { func4([10, 10]); } -function getLocalTupleAnnotations(typedesc obj, string annotName) returns map = +function getAnonymousTupleAnnotations(typedesc obj, string annotName) returns map = @java:Method { - 'class: "org/ballerinalang/test/annotations/LocalTupleAnnotationTest", - name: "getLocalTupleAnnotations" + 'class: "org/ballerinalang/test/annotations/AnonymousTupleAnnotationTest", + name: "getAnonymousTupleAnnotations" } external; function assertEquality(anydata expected, anydata actual) { From b35bc0a9db889217fced38811d0b03117ce217a7 Mon Sep 17 00:00:00 2001 From: chiranSachintha Date: Mon, 13 Feb 2023 07:59:20 +0530 Subject: [PATCH 5/5] Add a comment --- .../test-src/annotations/anonymous_tuple_annotation_test.bal | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/jballerina-unit-test/src/test/resources/test-src/annotations/anonymous_tuple_annotation_test.bal b/tests/jballerina-unit-test/src/test/resources/test-src/annotations/anonymous_tuple_annotation_test.bal index 8491a52f0ce6..0e3d2c2e4ece 100644 --- a/tests/jballerina-unit-test/src/test/resources/test-src/annotations/anonymous_tuple_annotation_test.bal +++ b/tests/jballerina-unit-test/src/test/resources/test-src/annotations/anonymous_tuple_annotation_test.bal @@ -45,6 +45,8 @@ function testAnnotationOnTupleFields() { } string gVar0 = "foo"; + +// This test evaluates the reordering of global variables [@details {name: gVar0, age: gVar4} int, @details {name: "name", age: 0} int, string...] g4 = [1, 2, "hello", "world"]; function testAnnotationOnTupleFields2() {