-
Notifications
You must be signed in to change notification settings - Fork 758
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41999 from lochana-chathura/worker_new3
Improve error message for mismatch in worker send-receive pairing
- Loading branch information
Showing
6 changed files
with
153 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 93 additions & 20 deletions
113
.../jballerina-unit-test/src/test/resources/test-src/workers/invalid-worker-send-receive.bal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,95 @@ | ||
function case1() { | ||
worker w1 { | ||
20 -> w2; | ||
} | ||
|
||
worker w2 { | ||
"xxx" -> w1; | ||
} | ||
} | ||
|
||
function case2() { | ||
worker w1 { | ||
int _ = <- w2; | ||
} | ||
|
||
worker w2 { | ||
string _ = <- w1; | ||
} | ||
} | ||
|
||
function case3() { | ||
boolean foo = true; | ||
worker w1 { | ||
if foo { | ||
2 -> w2; | ||
} else { | ||
3 -> w2; | ||
} | ||
4 -> w2; | ||
} | ||
|
||
worker w2 returns error? { | ||
_ = check <- w1; | ||
_ = check <- w1; | ||
} | ||
} | ||
|
||
function case4() { | ||
worker w1 { | ||
"xxx" -> w2; | ||
} | ||
|
||
worker w2 { | ||
_ = <- w1 | w1; | ||
} | ||
} | ||
|
||
function case5() { | ||
worker w1 { | ||
"xxx" -> w2; | ||
} | ||
|
||
worker w2 { | ||
_ = <- {a: w1, b: w3, c: w3}; | ||
} | ||
|
||
worker w3 { | ||
"yyy" -> w2; | ||
} | ||
} | ||
|
||
function invalidWorkerSendReceive() { | ||
function case6() { | ||
worker w1 { | ||
} | ||
|
||
worker w2 { | ||
_ = <- {a: w1, b: w3, c: w3}; | ||
} | ||
|
||
worker w3 { | ||
"yyy" -> w2; | ||
} | ||
} | ||
|
||
function case7() { | ||
fork { | ||
worker w1 { | ||
int a = 5; | ||
int b = 0; | ||
a -> w2; | ||
b = <- w3; | ||
} | ||
worker w2 { | ||
int a = 0; | ||
int b = 15; | ||
a = <- w1; | ||
a -> w3; | ||
} | ||
worker w3 { | ||
int a = 0; | ||
int b = 15; | ||
a = <- w2; | ||
} | ||
} | ||
} | ||
worker w1 { | ||
int a = 5; | ||
int b = 0; | ||
a -> w2; | ||
b = <- w3; | ||
} | ||
worker w2 { | ||
int a = 0; | ||
int b = 15; | ||
a = <- w1; | ||
a -> w3; | ||
} | ||
worker w3 { | ||
int a = 0; | ||
int b = 15; | ||
a = <- w2; | ||
} | ||
} | ||
} |