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

Update isolated analysis in the init method #40757

Merged
merged 9 commits into from
Aug 16, 2023
Merged

Conversation

MaryamZi
Copy link
Member

Purpose

$title.

Fixes #40736

Check List

  • Read the Contributing Guide
  • Updated Change Log
  • Checked Tooling Support (#)
  • Added necessary tests
    • Unit Tests
    • Spec Conformance Tests
    • Integration Tests
    • Ballerina By Example Tests
  • Increased Test Coverage
  • Added necessary documentation
    • API documentation
    • Module documentation in Module.md files
    • Ballerina By Examples

@codecov
Copy link

codecov bot commented Jun 19, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +76.43% 🎉

Comparison is base (a9e9d76) 0.00% compared to head (18ec04a) 76.43%.

Additional details and impacted files
@@              Coverage Diff              @@
##             master   #40757       +/-   ##
=============================================
+ Coverage      0.00%   76.43%   +76.43%     
- Complexity        0    52435    +52435     
=============================================
  Files             9     2863     +2854     
  Lines            35   197402   +197367     
  Branches          0    25596    +25596     
=============================================
+ Hits              0   150886   +150886     
- Misses           35    38171    +38136     
- Partials          0     8345     +8345     
Files Changed Coverage Δ
...compiler/semantics/analyzer/IsolationAnalyzer.java 85.62% <100.00%> (ø)

... and 2861 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions
Copy link

This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the stale label is removed or commented.

@MaryamZi MaryamZi marked this pull request as ready for review July 25, 2023 10:25
@chiranSachintha
Copy link
Member

Consider the following example. Is it correct to access arr without a lock inside the lambda function? The following program compile without any errors.

isolated class IsolatedClass {
    private int[][] arr;

    function init(int[] node) {
        self.arr = [];
        function v = function () {
            self.arr.push(node);
        };
    }
}

@MaryamZi
Copy link
Member Author

Consider the following example. Is it correct to access arr without a lock inside the lambda function? The following program compile without any errors.

isolated class IsolatedClass {
    private int[][] arr;

    function init(int[] node) {
        self.arr = [];
        function v = function () {
            self.arr.push(node);
        };
    }
}

Seems like there is an issue here, but is also the case in non-init methods. Can you please create an issue for this?

Comment on lines +2633 to +2635
BLangAssignment assignment = (BLangAssignment) parent;

BLangExpression lhsExpr = assignment.varRef;
Copy link
Contributor

@dulajdilshan dulajdilshan Aug 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove the new line in L2634?. (Ignorable)

Copy link
Contributor

@dulajdilshan dulajdilshan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!. Only minor ignorable comment.

@sonarcloud
Copy link

sonarcloud bot commented Aug 16, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

0.0% 0.0% Coverage
0.0% 0.0% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@MaryamZi MaryamZi merged commit a24af05 into master Aug 16, 2023
17 of 18 checks passed
@MaryamZi MaryamZi deleted the fix-isolated-in-init branch August 16, 2023 13:35
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Require using locks when accessing restricted fields with self in the init method of an isolated object
3 participants