Skip to content

Comments

Fix var type resolution in diagram generator#677

Merged
pasindufernando1 merged 3 commits intoballerina-platform:1.6.xfrom
pasindufernando1:1674Fix
Feb 9, 2026
Merged

Fix var type resolution in diagram generator#677
pasindufernando1 merged 3 commits intoballerina-platform:1.6.xfrom
pasindufernando1:1674Fix

Conversation

@pasindufernando1
Copy link
Contributor

Purpose

This PR addresses fixing the diagram generator resolving var type declarations to their inferred types (e.g., string) instead of preserving the var keyword. The FormBuilder.dataVariable() method now checks for VAR_TYPE_DESC syntax kind before falling back to semantic type resolution.

Fixes : wso2/product-ballerina-integrator#1674

Copilot AI review requested due to automatic review settings February 6, 2026 06:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug in the diagram generator where variable declarations using the var keyword were being resolved to their inferred types (e.g., string, int, json) instead of preserving the var keyword as written in the source code. The fix adds a check for the VAR_TYPE_DESC syntax kind in the FormBuilder.dataVariable() method before falling back to semantic type resolution.

Changes:

  • Modified FormBuilder.dataVariable() to check for VAR_TYPE_DESC syntax kind and preserve "var" keyword
  • Added new test case (variable9.json) with corresponding source file (variable.bal)
  • Updated 20 existing test configuration files to expect "var" instead of resolved types

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated no comments.

Show a summary per file
File Description
FormBuilder.java Added VAR_TYPE_DESC check in dataVariable() method to preserve "var" keyword instead of resolving to inferred type
variable.bal New test source file with simple function containing var declaration
variable9.json New test configuration for the variable.bal test case
variable1.json Updated expected type values from resolved types ("int") to "var" for var declarations
xml_payload.json Updated expected type value from "xml:Element" to "var"
binary_data.json Updated expected type value from "byte[3]" to "var"
flags1.json Updated expected type values from "boolean" to "var"
comment9.json, comment10.json Updated expected type values from "()" and "int" to "var"
foreach1.json, foreach2.json Updated expected type values from "int" to "var"
match8.json Updated expected type value from "int" to "var"
resource_action_call-http-get1.json Updated expected type value from "json" to "var"
resource_action_call-http-post1.json Updated expected type value from "json" to "var"
remote_action_call-http-get2.json Updated expected type value from "json" to "var"
remote_action_call-http-post2.json Updated expected type value from "json" to "var"
transaction1.json through transaction6.json Updated expected type values from "()" to "var"

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pasindufernando1 pasindufernando1 merged commit 46bbace into ballerina-platform:1.6.x Feb 9, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants