Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Annotations] Restrict constraints of maps/fields of records to be anydata and freeze the values #15533

Closed
MaryamZi opened this issue Jun 6, 2019 · 1 comment · Fixed by #23473
Assignees
Labels
Area/Compiler Points/2 Equivalent to two days effort Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/SpecDeviation Type/Task

Comments

@MaryamZi
Copy link
Member

MaryamZi commented Jun 6, 2019

Description:
According to the v2019R1 spec,

annotation-decl :=
   metadata
   [public] [const] annotation [type-descriptor] annot-tag 
   [on annot-attach-points]
annot-tag := identifier

The type-descriptor specifies the type of the annotation tag. The type must be 
a subtype of one of the following three types: true, map<anydata>, map<anydata>[].

If the annotation-decl for a tag specifies const, then a mapping-constructor-expr 
in annotations with that tag must be a const-expr and is evaluated at compile-time 
with the semantics of a const-expr. Otherwise, the mapping-constructor-expr is 
evaluated when the annotation is evaluated and the resulting value is automatically 
frozen.

In the initial iteration to introduce annotation changes the following is not done:

  • restricting the constraints of maps/fields of records to be anydata - cannot be done at the moment since annotations currently have fields of types service (websocket), function (transactions), etc.
  • freezing the annot value - cannot be done since the value may have non-anydata values

Related Issues:
ballerina-platform/ballerina-spec#70

@MaryamZi MaryamZi added Type/Task Area/Compiler Type/SpecDeviation Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. labels Jun 6, 2019
@grainier grainier added this to the Ballerina 1.1.0 milestone Oct 18, 2019
@hasithaa hasithaa removed this from the Ballerina 1.1.0 milestone Dec 20, 2019
@pubudu91 pubudu91 added the Points/2 Equivalent to two days effort label Apr 16, 2020
@pubudu91 pubudu91 added this to the Ballerina 1.3.0 milestone Apr 16, 2020
@pubudu91
Copy link
Contributor

Related to spec: ballerina-platform/ballerina-spec#70

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/Compiler Points/2 Equivalent to two days effort Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/SpecDeviation Type/Task
Projects
None yet
5 participants