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

Allow constructing values with their read-only bit on with a type-cast-expr <readonly> #22954

Closed
MaryamZi opened this issue Apr 29, 2020 · 2 comments · Fixed by #24484
Closed
Assignees
Labels
Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/NewFeature

Comments

@MaryamZi
Copy link
Member

Description:
$title.

The spec says

Note that a type-cast-expr of can be used both to cause constructors withing the expression to construct values with the read-only bit on and to verify that the value resulting from the evaluation of expression has its read-only bit on.

Sub-task of #22515

@MaryamZi MaryamZi added Type/NewFeature Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. labels Apr 29, 2020
@MaryamZi MaryamZi added this to the Ballerina 1.3.0 milestone Apr 29, 2020
@MaryamZi MaryamZi self-assigned this Apr 29, 2020
@MaryamZi
Copy link
Member Author

Moreover, the static type of <readonly> T should be T & readonly.

e.g.,

function foo(map<int> m) {
    map<int> & readonly n = <readonly> m; // valid
}

@MaryamZi
Copy link
Member Author

MaryamZi commented Jul 3, 2020

The original issue will be fixed with #24484.

Moreover, the static type of <readonly> T should be T & readonly.

e.g.,

function foo(map<int> m) {
    map<int> & readonly n = <readonly> m; // valid
}

This will be tracked with #24559.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/NewFeature
Projects
None yet
2 participants