ballerina-lang
ballerina-lang copied to clipboard
Fix issue in change return type CA
Purpose
Fixes #42292
IMO what we are currently doing is not correct.
Consider a case like this,
public type Error1 distinct error;
public type Error2 distinct error;
function bar1() returns int|Error1 {
int i = check foo1();
return foo2();
}
function foo1() returns int|Error1 => 1;
function foo2() returns int|Error2 => 1;
When we apply the above code action the return type will be change to int|Error2|error
.
In this case it should be int|Error1|error
or int|Error1|Error2
. For better DX with handing the exact error type we should give int|Error1|Error2
.
I think in this code what we should do following things,
- Update existing return type by adding public distinct error types coming from other modules. If the error types are in the same module we need to add those error types as well.
- Where there are non-public error types we should add generic
error
type.
We had a similar discussion on this #42127.
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.
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.
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.
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.
Closed PR due to inactivity for more than 18 days.
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.
@LakshanWeerasinghe @KavinduZoysa Shall we resolve the conflicts and get this reviewed?
Closing this PR since we have to revisit the approach again.