Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Debugger fails to list and evaluate binding-pattern variables #42411

Open
lochana-chathura opened this issue Mar 26, 2024 · 3 comments
Open
Assignees
Labels
Area/Debugger Issues related to the ballerina debugging tools Team/DevTools Ballerina Developer Tooling ( CLI, Test FW, Package Management, OpenAPI, APIDocs ) Type/Bug

Comments

@lochana-chathura
Copy link
Member

lochana-chathura commented Mar 26, 2024

Description

$subject.

  • As you can observe in the following screenshot, binding pattern variables name, index1, postType, negType are not listed under the local variables on the left window.

  • Also notice, variables that are listed already; pos, neg, and d, only the name is showing. Cannot expand those values and see what's inside.

Screenshot 2024-03-26 at 11 24 11
  • typing variables in the evaluator also fails.
Screenshot 2024-03-26 at 11 25 01

Steps to Reproduce

  1. checkout to this commit (ballerina-platform/nballerina@9c70a7c) in nballerina repo. Currently, it is the latest commit.
  2. Apply the following small patch to run only the record-t.bal test file.
diff --git a/compiler/tests/testSuite.bal b/compiler/tests/testSuite.bal
index 73a088aa..7468a12b 100644
--- a/compiler/tests/testSuite.bal
+++ b/compiler/tests/testSuite.bal
@@ -154,6 +154,9 @@ function listSources(string initialChars) returns TestSuiteCases|io:Error|file:E
             if ext != ".bal" {
                 continue;
             }
+            if base != "record-t" {
+                continue;
+            }
             int? dash = base.lastIndexOf("-");
             test:assertTrue(dash is int, "test file name must be in <name>-<kind>.bal format");
             string testKind = base.substring(1 + <int>dash);
  1. Add a debugging point at the following line. https://github.com/ballerina-platform/nballerina/blob/9c70a7cf23d11d2fc568a56ef04a709eefc51456/compiler/modules/types/mapping.bal#L166
  2. Run the following test in debugger mode. https://github.com/ballerina-platform/nballerina/blob/9c70a7cf23d11d2fc568a56ef04a709eefc51456/compiler/tests/testSuite.bal#L38

Affected Version(s)

2201.8.5 at least

OS, DB, other environment details and versions

MacOS

@ballerina-bot ballerina-bot added Team/DevTools Ballerina Developer Tooling ( CLI, Test FW, Package Management, OpenAPI, APIDocs ) Area/Debugger Issues related to the ballerina debugging tools labels Mar 26, 2024
@NipunaRanasinghe NipunaRanasinghe moved this to Planned for Sprint in Ballerina Team Main Board Mar 26, 2024
@lochana-chathura
Copy link
Member Author

  • Also notice, variables that are listed already; pos, neg, and d, only the name is showing. Cannot expand those values and see what's inside.

Apparently, this is not specific to this scenario. Hence, extracted to a separate issue #42848

@NipunaRanasinghe NipunaRanasinghe moved this from BackLog to In Progress in Ballerina Team Main Board Nov 20, 2024
@NipunaRanasinghe
Copy link
Contributor

Did some testing and this seems to be an issue in the Ballerina runtime, where the variable and line number tables not getting updated properly for binding pattern variables.

@NipunaRanasinghe
Copy link
Contributor

Created #43623 to track the progress of the fixes from the compiler runtime side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/Debugger Issues related to the ballerina debugging tools Team/DevTools Ballerina Developer Tooling ( CLI, Test FW, Package Management, OpenAPI, APIDocs ) Type/Bug
Projects
Status: In Progress
Development

No branches or pull requests

3 participants