-
Notifications
You must be signed in to change notification settings - Fork 755
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
Fix invalid isolated inference of resource functions which has start actions #41772
Fix invalid isolated inference of resource functions which has start actions #41772
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #41772 +/- ##
============================================
+ Coverage 76.68% 76.70% +0.02%
- Complexity 53066 53122 +56
============================================
Files 2882 2884 +2
Lines 200002 200247 +245
Branches 26040 26080 +40
============================================
+ Hits 153362 153599 +237
- Misses 38206 38214 +8
Partials 8434 8434 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like the warning is now logged for
class Foo {
private int i = 1;
function init() {
}
}
service on new Listener() {
resource function default test() {
_ = start fn(new Foo());
}
}
function fn(Foo foo) {
}
public isolated class Listener {
public function 'start() returns error? {
}
public function gracefulStop() returns error? {
}
public function immediateStop() returns error? {
}
public function detach(service object {} s) returns error? {
}
public function attach(service object {} s, string[]|string|() name = ()) returns error? {
}
}
...lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/IsolationAnalyzer.java
Show resolved
Hide resolved
aaea477
to
23f4077
Compare
23f4077
to
893dfe4
Compare
The warning is still logged for this, right? |
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the |
Closed PR due to inactivity for more than 18 days. |
Still seeing the warning for this. |
I will check this. |
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the |
893dfe4
to
22d68f3
Compare
This behavior was visible when we do a |
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the |
Closed PR due to inactivity for more than 18 days. |
...lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/IsolationAnalyzer.java
Outdated
Show resolved
Hide resolved
22d68f3
to
945a7aa
Compare
945a7aa
to
780c45f
Compare
...lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/IsolationAnalyzer.java
Outdated
Show resolved
Hide resolved
arg = varRefRecordField; | ||
break; | ||
} | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There still seem to be codecov warnings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still seeing codecov warnings.
...lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/IsolationAnalyzer.java
Outdated
Show resolved
Hide resolved
public void visit(BLangRecordLiteral.BLangRecordSpreadOperatorField spreadOperatorField) { | ||
analyzeNode(spreadOperatorField.expr, env); | ||
NodeKind kind = spreadOperatorField.expr.getKind(); | ||
if (!(kind == NodeKind.RECORD_LITERAL_EXPR || kind == NodeKind.TYPE_CONVERSION_EXPR)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this special case we're trying to handle here? Why do we need to special case the type cast expression?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In here we only need to add whats inside the mapping constructor (key values and simple var refs).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inside the spread operator field, the expression can be type cast expression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spread (with a mapping constructor) can be other expressions too, not just these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only these will be allowed to pass as a function argument. Others will be not allowed by the type checking phase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that statement correct?
type Record record {|
string[] arr1;
string[] arr2;
string[] arr3;
|};
function qux() {
f(...<Record> {arr1: [], arr2: [], ...({arr3: []})}); // grouped expression in spread
}
isolated function f(string[] arr1, string[] arr2, string[] arr3) {
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't figure out this is possible previously. Handle it in commit.
...lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/IsolationAnalyzer.java
Outdated
Show resolved
Hide resolved
...lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/IsolationAnalyzer.java
Outdated
Show resolved
Hide resolved
public void visit(BLangRecordLiteral.BLangRecordSpreadOperatorField spreadOperatorField) { | ||
analyzeNode(spreadOperatorField.expr, env); | ||
NodeKind kind = spreadOperatorField.expr.getKind(); | ||
if (!(kind == NodeKind.RECORD_LITERAL_EXPR || kind == NodeKind.TYPE_CONVERSION_EXPR)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that statement correct?
type Record record {|
string[] arr1;
string[] arr2;
string[] arr3;
|};
function qux() {
f(...<Record> {arr1: [], arr2: [], ...({arr3: []})}); // grouped expression in spread
}
isolated function f(string[] arr1, string[] arr2, string[] arr3) {
}
arg = varRefRecordField; | ||
break; | ||
} | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still seeing codecov warnings.
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the |
Closed PR due to inactivity for more than 18 days. |
Purpose
Fixes #41691
Fixes #41766
Fixes #41818
Approach
Samples
Remarks
Check List