ballerina-platform / ballerina-lang

The Ballerina Programming Language
https://ballerina.io/
Apache License 2.0
3.54k stars 733 forks source link

[Master] Add the union of the types in the `Create variable with type` code action #42647

Closed nipunayf closed 2 weeks ago

nipunayf commented 2 weeks ago

Purpose

In scenarios like the one described in the sample, there may arise situations where dependent types require a union of types rather than individual ones. To address this, the PR introduces an additional code action with a union type alongside the existing ones to cover this specific use case.

Fixes #42591

Approach

Return the union of all the possible types along with the ones that are already provided in the respective code action.

Samples

https://github.com/ballerina-platform/ballerina-lang/assets/59343084/a8f874a2-b670-49bb-994f-b3b93fd37348

Check List