Add lang lib related function support#689
Add lang lib related function support#689LakshanWeerasinghe merged 5 commits intoballerina-platform:1.6.xfrom
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
This pull request adds comprehensive support for Ballerina lang lib function usage in the low-code flow model generator. The implementation addresses three key aspects: (1) type parameter replacement to convert internal lang lib type parameters (e.g., array:Type, stream:ErrorType) into human-readable supertypes (e.g., (any|error), error), (2) automatic hiding of result type fields in the UI when types are replaced by generic placeholders, and (3) enhanced source code generation that infers concrete return types by analyzing actual variable types via the semantic model during lang lib function calls.
Changes:
- Introduced
TypeParameterReplacerutility class to systematically replace lang lib internal type parameters with their corresponding supertypes across multiple lang lib modules (array, error, map, stream, xml, table, value) - Enhanced
CallBuilderwithresolveLangLibReturnTypemethod that dynamically resolves concrete return types at source generation time by inspecting variable types through the semantic model - Updated test configurations for lang lib functions to reflect the new type parameter replacements and proper type hiding behavior
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| TypeParameterReplacer.java | New utility class providing systematic type parameter replacement for lang lib modules with mappings for array, error, map, stream, xml, table, and value modules |
| CallBuilder.java | Added lang lib detection, return type resolution logic, and concrete type inference by analyzing visible symbols through the semantic model |
| FunctionCall.java | Integrated lang lib return type resolution before falling back to type inference |
| MethodCall.java | Integrated lang lib return type resolution for method call scenarios |
| SourceBuilder.java | Added newVariableWithType method to support explicit type specification |
| Property.java | Integrated type parameter replacement in ballerinaType setter |
| FormBuilder.java | Applied type parameter replacement to type and returnType properties, with automatic hiding when replacement occurs |
| ModelGeneratorTest.java | Uncommented updateConfig call (typically kept commented across test suite) |
| function_call-lang-lib_5.json | New test configuration for array:enumerate function demonstrating type resolution from CSV[] to [int, CSV][] |
| lang_lib-*.json | Updated test configurations for various lang lib functions (array, error, map, stream, table) with replaced type parameters and hidden result types |
| function_call/main.bal | New test source file for function call scenarios |
| function_call-langlib.bal | Additional test source file for lang lib function call scenarios |
| Ballerina.toml | Test project configuration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Purpose
This PR addresses three aspects related to adding support to lang lib function usage via low code
error) throughout the form/property model.
Fixes : wso2/product-ballerina-integrator#1750
Now the experience looks like below, where the return type is hidden for lang lib related functions and the actual type is inferred during the saving process
Screen.Recording.2026-02-16.at.10.00.26.mov