From 670f880c78364708a40e75515c548cece9d5c06b Mon Sep 17 00:00:00 2001 From: xgopilot Date: Mon, 27 Oct 2025 08:03:58 +0000 Subject: [PATCH] refactor(test): move issue #1370 geometry test to cl/_testgo/interface1370 - Move geometry package from _demo to cl/_testdata/geometry1370 - Create simplified test in cl/_testgo/interface1370 following interface test pattern - Generate .ll file with llgen to verify interface metadata package path fix - Remove old demo files (issue1370_geometry, issue1370_goast, issue1370_gotypes) - Remove .tmp-comment files The new test structure is simpler and follows the existing cl/_testgo/interface pattern, focusing on demonstrating the interface metadata fix for private methods across packages. Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: luoliwoshang <51194195+luoliwoshang@users.noreply.github.com> --- ...t-comments-1761548372-b1eec08bdc2eb312.log | 151 -------- ...t-comments-1761548945-e666e25cb6be24bd.log | 181 ---------- ...t-comments-1761549818-1aa4d6d7d042da0c.log | 214 ----------- _demo/go/issue1370_geometry/geometry.go | 32 -- _demo/go/issue1370_goast/goast.go | 25 -- _demo/go/issue1370_gotypes/gotypes.go | 24 -- .../_testdata/geometry1370}/geometry.go | 5 +- cl/_testgo/interface1370/in.go | 11 + cl/_testgo/interface1370/out.ll | 333 ++++++++++++++++++ 9 files changed, 346 insertions(+), 630 deletions(-) delete mode 100644 .tmp-comment/codeagent-comments-1761548372-b1eec08bdc2eb312.log delete mode 100644 .tmp-comment/codeagent-comments-1761548945-e666e25cb6be24bd.log delete mode 100644 .tmp-comment/codeagent-comments-1761549818-1aa4d6d7d042da0c.log delete mode 100644 _demo/go/issue1370_geometry/geometry.go delete mode 100644 _demo/go/issue1370_goast/goast.go delete mode 100644 _demo/go/issue1370_gotypes/gotypes.go rename {_demo/go/issue1370_geometry/geometry => cl/_testdata/geometry1370}/geometry.go (87%) create mode 100644 cl/_testgo/interface1370/in.go create mode 100644 cl/_testgo/interface1370/out.ll diff --git a/.tmp-comment/codeagent-comments-1761548372-b1eec08bdc2eb312.log b/.tmp-comment/codeagent-comments-1761548372-b1eec08bdc2eb312.log deleted file mode 100644 index 5d3ea9cd..00000000 --- a/.tmp-comment/codeagent-comments-1761548372-b1eec08bdc2eb312.log +++ /dev/null @@ -1,151 +0,0 @@ -# Historical Comments and Reviews - -## Discussion Comments - -**@codecov** (Oct 27, 03:46) -## [Codecov](https://app.codecov.io/gh/goplus/llgo/pull/1371?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goplus) Report -:white_check_mark: All modified and coverable lines are covered by tests. -:white_check_mark: Project coverage is 90.98%. Comparing base ([`d2a2225`](https://app.codecov.io/gh/goplus/llgo/commit/d2a22252c2ff6c1a1f1a044bd28e7d4a3ab33d7e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goplus)) to head ([`d864e3b`](https://app.codecov.io/gh/goplus/llgo/commit/d864e3b685fabe495dbf2e031f03d18b18814d16?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goplus)). -:warning: Report is 28 commits behind head on main. - -
Additional details and impacted files - - - -```diff -@@ Coverage Diff @@ -## main #1371 +/- ## -========================================== -+ Coverage 90.18% 90.98% +0.79% -========================================== - Files 43 43 - Lines 12752 11293 -1459 -========================================== -- Hits 11501 10275 -1226 -+ Misses 1092 859 -233 - Partials 159 159 -``` -
- -[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/goplus/llgo/pull/1371?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goplus). -:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goplus). -
:rocket: New features to boost your workflow: - -- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems. -- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges. -
- ---- - -**@luoliwoshang** (Oct 27, 06:59) -@xgopilot add the regression for https://github.com/goplus/llgo/issues/1370's three case! - ---- - -**@xgopilot** (Oct 27, 06:59) -codeagent is processing your request, please wait a moment... - ---- - -## Code Review Comments - -### Thread 1: ssa/abitype.go - -**@luoliwoshang** (Oct 23, 10:38) -@xgopilot need add testing for `go/types` `Scope.Insert` use , add to _demo folder - -↳ *Reply:* -**@xgopilot** (Oct 23, 10:38) -### Demo added successfully! ✅ - -I've added a demo program at `_demo/go/gotypesissue/main.go` that tests the fix for cross-package interface private method calls using `go/types.Scope.Insert`. - -**What the demo does:** -- Creates a `types.Package` and gets its `Scope` -- Uses `Scope.Insert()` to add a variable to the scope (this method has private methods in the `go/types` package) -- Uses `Scope.Lookup()` to verify the insertion worked correctly -- This demonstrates that the interface conversion with private methods now works correctly across package boundaries - -**Testing results:** -- ✅ Demo runs successfully with llgo: `SUCCESS: Scope.Insert and Lookup work correctly` -- ✅ All code formatted with `go fmt` -- ✅ Changes committed and pushed to the PR branch - -The demo specifically tests the bug fix in this PR by using `go/types` standard library interfaces that have private methods, ensuring the runtime correctly fills in the private method slots in the itab. - -↳ *Reply:* -**@luoliwoshang** (Oct 23, 10:49) -@xgopilot and you also need up the .ll file at test case - -↳ *Reply:* -**@xgopilot** (Oct 23, 10:49) -### Test case .ll file added successfully! ✅ - -I've added the LLVM IR test case for the go/types Scope.Insert demo as requested. - -**What was added:** -- `cl/_testdata/gotypesissue/in.go` - Test input file (Go source code) -- `cl/_testdata/gotypesissue/out.ll` - Expected LLVM IR output (2,920 lines) - -**Test verification:** -- ✅ Test passes: `go test -run TestFromTestdata/gotypesissue -v ./cl` -- ✅ The generated LLVM IR correctly includes the package path for interface metadata -- ✅ Code formatted with `go fmt` -- ✅ Changes committed and pushed to PR branch - -The test case verifies that the fix in this PR correctly handles cross-package interface conversions with private methods by checking the generated LLVM IR includes the proper package path (`go/types`) for interface metadata, allowing the runtime to correctly fill in private method slots in the itab. - -↳ *Reply:* -**@luoliwoshang** (Oct 23, 12:26) -@xgopilot update other test case's expect .ll by `llgen` and remove the `go/types` test at `cl/_testdata` - -↳ *Reply:* -**@xgopilot** (Oct 23, 12:26) -### Test cases updated and go/types test removed! ✅ - -I've successfully regenerated all test case .ll files and removed the go/types test as requested. - -**What was done:** -- ✅ Regenerated all .ll files in `cl/_testdata/` using llgen (18 test cases) -- ✅ Updated `cl/_testdata/debug/out.ll` which was previously a placeholder (`;`) - now properly generated with 2,392 lines -- ✅ Removed `cl/_testdata/gotypesissue/` directory and all its files -- ✅ Removed `_demo/go/gotypesissue/` demo directory -- ✅ All cl tests pass: `go test -run TestFromTestdata -v ./cl` -- ✅ Code formatted with `go fmt ./...` -- ✅ Changes committed and pushed to PR branch - -**Test results:** -All 18 test cases in `cl/_testdata/` pass successfully: -- apkg, cpkg, cpkgimp, debug, fncall, foo, importpkg, llgotag, method, print, printf, printval, ptrmthd, uint, untyped, utf8, vargs, varinit - -The regenerated .ll files now correctly reflect the interface metadata package path fix from this PR. - -↳ *Reply:* -**@luoliwoshang** (Oct 23, 13:08) -@xgopilot `TestFromTestgo` got fail message like `cltest.go:122: llgen.GenFrom: unexpect result`, you need reinsall `llgen` to update test case! - -↳ *Reply:* -**@xgopilot** (Oct 23, 13:08) -### Test cases updated successfully! ✅ - -I've successfully fixed the `TestFromTestgo` failure by reinstalling `llgen` and regenerating the affected test cases. - -**What was done:** -1. ✅ Reinstalled the `llgen` tool to get the updated version with the interface metadata fix -2. ✅ Regenerated all test cases in `cl/_testgo/` with `LLGO_ROOT` properly set -3. ✅ Verified tests pass (only cgofull fails due to missing Python dependencies, as expected per CLAUDE.md) -4. ✅ Ran `go fmt ./...` to format code -5. ✅ Committed and pushed changes - -**Test results:** -- ✅ All relevant tests pass including: `alias`, `interface`, `invoke`, `defer`, `chan`, `closure`, `reflect`, etc. -- ⚠️ `cgofull` test fails due to missing Python dependencies (expected per CLAUDE.md) - -**Changes committed:** -- `cl/_testgo/interface/out.ll` - Updated to reflect the correct interface metadata package path -- The generated LLVM IR now correctly uses `ptr @2, i64 39` (interface definition package) instead of `ptr @0, i64 43` (compilation package) - -The test case now properly validates the fix in this PR for cross-package interface conversions with private methods. - ---- - diff --git a/.tmp-comment/codeagent-comments-1761548945-e666e25cb6be24bd.log b/.tmp-comment/codeagent-comments-1761548945-e666e25cb6be24bd.log deleted file mode 100644 index 3c94526d..00000000 --- a/.tmp-comment/codeagent-comments-1761548945-e666e25cb6be24bd.log +++ /dev/null @@ -1,181 +0,0 @@ -# Historical Comments and Reviews - -## Discussion Comments - -**@codecov** (Oct 27, 03:46) -## [Codecov](https://app.codecov.io/gh/goplus/llgo/pull/1371?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goplus) Report -:white_check_mark: All modified and coverable lines are covered by tests. -:white_check_mark: Project coverage is 90.98%. Comparing base ([`d2a2225`](https://app.codecov.io/gh/goplus/llgo/commit/d2a22252c2ff6c1a1f1a044bd28e7d4a3ab33d7e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goplus)) to head ([`d864e3b`](https://app.codecov.io/gh/goplus/llgo/commit/d864e3b685fabe495dbf2e031f03d18b18814d16?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goplus)). -:warning: Report is 28 commits behind head on main. - -
Additional details and impacted files - - - -```diff -@@ Coverage Diff @@ -## main #1371 +/- ## -========================================== -+ Coverage 90.18% 90.98% +0.79% -========================================== - Files 43 43 - Lines 12752 11293 -1459 -========================================== -- Hits 11501 10275 -1226 -+ Misses 1092 859 -233 - Partials 159 159 -``` -
- -[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/goplus/llgo/pull/1371?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goplus). -:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goplus). -
:rocket: New features to boost your workflow: - -- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems. -- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges. -
- ---- - -**@luoliwoshang** (Oct 27, 06:59) -@xgopilot add the regression for https://github.com/goplus/llgo/issues/1370's three case! - ---- - -**@xgopilot** (Oct 27, 06:59) -### Regression tests added successfully! ✅ - -I've added three regression test cases for issue #1370 to the `_cmptest/` directory: - -#### Test Cases Added - -1. **`_cmptest/issue1370_gotypes/`** - Tests `go/types.Object` interface - - Uses `Scope.Insert()` which calls the private `setParent()` method - - Verifies the standard library interface works correctly across package boundaries - -2. **`_cmptest/issue1370_goast/`** - Tests `go/ast.Expr` interface - - Converts `ast.Ident` to `ast.Expr` interface and calls `Pos()` - - Tests another standard library interface with private `exprNode()` method - -3. **`_cmptest/issue1370_geometry/`** - Tests custom interface with private methods - - Defines `geometry.Shape` interface with private methods (`validate()`, `setID()`) - - Implements cross-package interface conversion where concrete type is returned - - Calls private method `setID()` from main package - -#### Verification - -- ✅ All code formatted with `go fmt ./...` -- ✅ Tests compile and run (only cgofull failed as expected per CLAUDE.md) -- ✅ Changes committed and pushed to PR branch - -These tests ensure the fix in `ssa/abitype.go` correctly handles interface metadata's `PkgPath` for interfaces with private methods, preventing segmentation faults that occurred before the fix. - ---- - -**@xgopilot** (Oct 27, 07:09) -codeagent is processing your request, please wait a moment... - ---- - -## Code Review Comments - -### Thread 1: ssa/abitype.go - -**@luoliwoshang** (Oct 23, 10:38) -@xgopilot need add testing for `go/types` `Scope.Insert` use , add to _demo folder - -↳ *Reply:* -**@xgopilot** (Oct 23, 10:38) -### Demo added successfully! ✅ - -I've added a demo program at `_demo/go/gotypesissue/main.go` that tests the fix for cross-package interface private method calls using `go/types.Scope.Insert`. - -**What the demo does:** -- Creates a `types.Package` and gets its `Scope` -- Uses `Scope.Insert()` to add a variable to the scope (this method has private methods in the `go/types` package) -- Uses `Scope.Lookup()` to verify the insertion worked correctly -- This demonstrates that the interface conversion with private methods now works correctly across package boundaries - -**Testing results:** -- ✅ Demo runs successfully with llgo: `SUCCESS: Scope.Insert and Lookup work correctly` -- ✅ All code formatted with `go fmt` -- ✅ Changes committed and pushed to the PR branch - -The demo specifically tests the bug fix in this PR by using `go/types` standard library interfaces that have private methods, ensuring the runtime correctly fills in the private method slots in the itab. - -↳ *Reply:* -**@luoliwoshang** (Oct 23, 10:49) -@xgopilot and you also need up the .ll file at test case - -↳ *Reply:* -**@xgopilot** (Oct 23, 10:49) -### Test case .ll file added successfully! ✅ - -I've added the LLVM IR test case for the go/types Scope.Insert demo as requested. - -**What was added:** -- `cl/_testdata/gotypesissue/in.go` - Test input file (Go source code) -- `cl/_testdata/gotypesissue/out.ll` - Expected LLVM IR output (2,920 lines) - -**Test verification:** -- ✅ Test passes: `go test -run TestFromTestdata/gotypesissue -v ./cl` -- ✅ The generated LLVM IR correctly includes the package path for interface metadata -- ✅ Code formatted with `go fmt` -- ✅ Changes committed and pushed to PR branch - -The test case verifies that the fix in this PR correctly handles cross-package interface conversions with private methods by checking the generated LLVM IR includes the proper package path (`go/types`) for interface metadata, allowing the runtime to correctly fill in private method slots in the itab. - -↳ *Reply:* -**@luoliwoshang** (Oct 23, 12:26) -@xgopilot update other test case's expect .ll by `llgen` and remove the `go/types` test at `cl/_testdata` - -↳ *Reply:* -**@xgopilot** (Oct 23, 12:26) -### Test cases updated and go/types test removed! ✅ - -I've successfully regenerated all test case .ll files and removed the go/types test as requested. - -**What was done:** -- ✅ Regenerated all .ll files in `cl/_testdata/` using llgen (18 test cases) -- ✅ Updated `cl/_testdata/debug/out.ll` which was previously a placeholder (`;`) - now properly generated with 2,392 lines -- ✅ Removed `cl/_testdata/gotypesissue/` directory and all its files -- ✅ Removed `_demo/go/gotypesissue/` demo directory -- ✅ All cl tests pass: `go test -run TestFromTestdata -v ./cl` -- ✅ Code formatted with `go fmt ./...` -- ✅ Changes committed and pushed to PR branch - -**Test results:** -All 18 test cases in `cl/_testdata/` pass successfully: -- apkg, cpkg, cpkgimp, debug, fncall, foo, importpkg, llgotag, method, print, printf, printval, ptrmthd, uint, untyped, utf8, vargs, varinit - -The regenerated .ll files now correctly reflect the interface metadata package path fix from this PR. - -↳ *Reply:* -**@luoliwoshang** (Oct 23, 13:08) -@xgopilot `TestFromTestgo` got fail message like `cltest.go:122: llgen.GenFrom: unexpect result`, you need reinsall `llgen` to update test case! - -↳ *Reply:* -**@xgopilot** (Oct 23, 13:08) -### Test cases updated successfully! ✅ - -I've successfully fixed the `TestFromTestgo` failure by reinstalling `llgen` and regenerating the affected test cases. - -**What was done:** -1. ✅ Reinstalled the `llgen` tool to get the updated version with the interface metadata fix -2. ✅ Regenerated all test cases in `cl/_testgo/` with `LLGO_ROOT` properly set -3. ✅ Verified tests pass (only cgofull fails due to missing Python dependencies, as expected per CLAUDE.md) -4. ✅ Ran `go fmt ./...` to format code -5. ✅ Committed and pushed changes - -**Test results:** -- ✅ All relevant tests pass including: `alias`, `interface`, `invoke`, `defer`, `chan`, `closure`, `reflect`, etc. -- ⚠️ `cgofull` test fails due to missing Python dependencies (expected per CLAUDE.md) - -**Changes committed:** -- `cl/_testgo/interface/out.ll` - Updated to reflect the correct interface metadata package path -- The generated LLVM IR now correctly uses `ptr @2, i64 39` (interface definition package) instead of `ptr @0, i64 43` (compilation package) - -The test case now properly validates the fix in this PR for cross-package interface conversions with private methods. - ---- - diff --git a/.tmp-comment/codeagent-comments-1761549818-1aa4d6d7d042da0c.log b/.tmp-comment/codeagent-comments-1761549818-1aa4d6d7d042da0c.log deleted file mode 100644 index 3d871e9f..00000000 --- a/.tmp-comment/codeagent-comments-1761549818-1aa4d6d7d042da0c.log +++ /dev/null @@ -1,214 +0,0 @@ -# Historical Comments and Reviews - -## Discussion Comments - -**@codecov** (Oct 27, 03:46) -## [Codecov](https://app.codecov.io/gh/goplus/llgo/pull/1371?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goplus) Report -:white_check_mark: All modified and coverable lines are covered by tests. -:white_check_mark: Project coverage is 90.98%. Comparing base ([`d2a2225`](https://app.codecov.io/gh/goplus/llgo/commit/d2a22252c2ff6c1a1f1a044bd28e7d4a3ab33d7e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goplus)) to head ([`d864e3b`](https://app.codecov.io/gh/goplus/llgo/commit/d864e3b685fabe495dbf2e031f03d18b18814d16?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goplus)). -:warning: Report is 28 commits behind head on main. - -
Additional details and impacted files - - - -```diff -@@ Coverage Diff @@ -## main #1371 +/- ## -========================================== -+ Coverage 90.18% 90.98% +0.79% -========================================== - Files 43 43 - Lines 12752 11293 -1459 -========================================== -- Hits 11501 10275 -1226 -+ Misses 1092 859 -233 - Partials 159 159 -``` -
- -[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/goplus/llgo/pull/1371?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goplus). -:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goplus). -
:rocket: New features to boost your workflow: - -- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems. -- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges. -
- ---- - -**@luoliwoshang** (Oct 27, 06:59) -@xgopilot add the regression for https://github.com/goplus/llgo/issues/1370's three case! - ---- - -**@xgopilot** (Oct 27, 06:59) -### Regression tests added successfully! ✅ - -I've added three regression test cases for issue #1370 to the `_cmptest/` directory: - -#### Test Cases Added - -1. **`_cmptest/issue1370_gotypes/`** - Tests `go/types.Object` interface - - Uses `Scope.Insert()` which calls the private `setParent()` method - - Verifies the standard library interface works correctly across package boundaries - -2. **`_cmptest/issue1370_goast/`** - Tests `go/ast.Expr` interface - - Converts `ast.Ident` to `ast.Expr` interface and calls `Pos()` - - Tests another standard library interface with private `exprNode()` method - -3. **`_cmptest/issue1370_geometry/`** - Tests custom interface with private methods - - Defines `geometry.Shape` interface with private methods (`validate()`, `setID()`) - - Implements cross-package interface conversion where concrete type is returned - - Calls private method `setID()` from main package - -#### Verification - -- ✅ All code formatted with `go fmt ./...` -- ✅ Tests compile and run (only cgofull failed as expected per CLAUDE.md) -- ✅ Changes committed and pushed to PR branch - -These tests ensure the fix in `ssa/abitype.go` correctly handles interface metadata's `PkgPath` for interfaces with private methods, preventing segmentation faults that occurred before the fix. - ---- - -**@xgopilot** (Oct 27, 07:09) -### Regression tests moved to _demo folder! ✅ - -I've successfully moved all three regression tests from `_cmptest/` to `_demo/` as requested. - -#### Changes Made - -**Moved directories:** -1. `_cmptest/issue1370_gotypes/` → `_demo/issue1370_gotypes/` -2. `_cmptest/issue1370_goast/` → `_demo/issue1370_goast/` -3. `_cmptest/issue1370_geometry/` → `_demo/issue1370_geometry/` - -**Updated import path:** -- Changed `github.com/goplus/llgo/_cmptest/issue1370_geometry/geometry` to `github.com/goplus/llgo/_demo/issue1370_geometry/geometry` in `_demo/issue1370_geometry/geometry.go` - -#### Verification - -- ✅ Used `git mv` to preserve git history -- ✅ Updated import paths to reflect new location -- ✅ Ran `go fmt ./...` -- ✅ Changes committed and pushed to PR branch - -All regression tests are now in the `_demo/` folder where they can serve as both tests and examples of the fix for issue #1370. - ---- - -**@xgopilot** (Oct 27, 07:23) -codeagent is processing your request, please wait a moment... - ---- - -## Code Review Comments - -### Thread 1: ssa/abitype.go - -**@luoliwoshang** (Oct 23, 10:38) -@xgopilot need add testing for `go/types` `Scope.Insert` use , add to _demo folder - -↳ *Reply:* -**@xgopilot** (Oct 23, 10:38) -### Demo added successfully! ✅ - -I've added a demo program at `_demo/go/gotypesissue/main.go` that tests the fix for cross-package interface private method calls using `go/types.Scope.Insert`. - -**What the demo does:** -- Creates a `types.Package` and gets its `Scope` -- Uses `Scope.Insert()` to add a variable to the scope (this method has private methods in the `go/types` package) -- Uses `Scope.Lookup()` to verify the insertion worked correctly -- This demonstrates that the interface conversion with private methods now works correctly across package boundaries - -**Testing results:** -- ✅ Demo runs successfully with llgo: `SUCCESS: Scope.Insert and Lookup work correctly` -- ✅ All code formatted with `go fmt` -- ✅ Changes committed and pushed to the PR branch - -The demo specifically tests the bug fix in this PR by using `go/types` standard library interfaces that have private methods, ensuring the runtime correctly fills in the private method slots in the itab. - -↳ *Reply:* -**@luoliwoshang** (Oct 23, 10:49) -@xgopilot and you also need up the .ll file at test case - -↳ *Reply:* -**@xgopilot** (Oct 23, 10:49) -### Test case .ll file added successfully! ✅ - -I've added the LLVM IR test case for the go/types Scope.Insert demo as requested. - -**What was added:** -- `cl/_testdata/gotypesissue/in.go` - Test input file (Go source code) -- `cl/_testdata/gotypesissue/out.ll` - Expected LLVM IR output (2,920 lines) - -**Test verification:** -- ✅ Test passes: `go test -run TestFromTestdata/gotypesissue -v ./cl` -- ✅ The generated LLVM IR correctly includes the package path for interface metadata -- ✅ Code formatted with `go fmt` -- ✅ Changes committed and pushed to PR branch - -The test case verifies that the fix in this PR correctly handles cross-package interface conversions with private methods by checking the generated LLVM IR includes the proper package path (`go/types`) for interface metadata, allowing the runtime to correctly fill in private method slots in the itab. - -↳ *Reply:* -**@luoliwoshang** (Oct 23, 12:26) -@xgopilot update other test case's expect .ll by `llgen` and remove the `go/types` test at `cl/_testdata` - -↳ *Reply:* -**@xgopilot** (Oct 23, 12:26) -### Test cases updated and go/types test removed! ✅ - -I've successfully regenerated all test case .ll files and removed the go/types test as requested. - -**What was done:** -- ✅ Regenerated all .ll files in `cl/_testdata/` using llgen (18 test cases) -- ✅ Updated `cl/_testdata/debug/out.ll` which was previously a placeholder (`;`) - now properly generated with 2,392 lines -- ✅ Removed `cl/_testdata/gotypesissue/` directory and all its files -- ✅ Removed `_demo/go/gotypesissue/` demo directory -- ✅ All cl tests pass: `go test -run TestFromTestdata -v ./cl` -- ✅ Code formatted with `go fmt ./...` -- ✅ Changes committed and pushed to PR branch - -**Test results:** -All 18 test cases in `cl/_testdata/` pass successfully: -- apkg, cpkg, cpkgimp, debug, fncall, foo, importpkg, llgotag, method, print, printf, printval, ptrmthd, uint, untyped, utf8, vargs, varinit - -The regenerated .ll files now correctly reflect the interface metadata package path fix from this PR. - -↳ *Reply:* -**@luoliwoshang** (Oct 23, 13:08) -@xgopilot `TestFromTestgo` got fail message like `cltest.go:122: llgen.GenFrom: unexpect result`, you need reinsall `llgen` to update test case! - -↳ *Reply:* -**@xgopilot** (Oct 23, 13:08) -### Test cases updated successfully! ✅ - -I've successfully fixed the `TestFromTestgo` failure by reinstalling `llgen` and regenerating the affected test cases. - -**What was done:** -1. ✅ Reinstalled the `llgen` tool to get the updated version with the interface metadata fix -2. ✅ Regenerated all test cases in `cl/_testgo/` with `LLGO_ROOT` properly set -3. ✅ Verified tests pass (only cgofull fails due to missing Python dependencies, as expected per CLAUDE.md) -4. ✅ Ran `go fmt ./...` to format code -5. ✅ Committed and pushed changes - -**Test results:** -- ✅ All relevant tests pass including: `alias`, `interface`, `invoke`, `defer`, `chan`, `closure`, `reflect`, etc. -- ⚠️ `cgofull` test fails due to missing Python dependencies (expected per CLAUDE.md) - -**Changes committed:** -- `cl/_testgo/interface/out.ll` - Updated to reflect the correct interface metadata package path -- The generated LLVM IR now correctly uses `ptr @2, i64 39` (interface definition package) instead of `ptr @0, i64 43` (compilation package) - -The test case now properly validates the fix in this PR for cross-package interface conversions with private methods. - ---- - -### Thread 2: _demo/issue1370_geometry/geometry.go - -**@luoliwoshang** (Oct 27, 07:23) -move to `_demo/go` - ---- - diff --git a/_demo/go/issue1370_geometry/geometry.go b/_demo/go/issue1370_geometry/geometry.go deleted file mode 100644 index e6b57bd0..00000000 --- a/_demo/go/issue1370_geometry/geometry.go +++ /dev/null @@ -1,32 +0,0 @@ -package main - -import ( - "fmt" - - "github.com/goplus/llgo/_demo/go/issue1370_geometry/geometry" -) - -func main() { - rect := geometry.NewRectangle(5.0, 3.0) - - err := geometry.RegisterShape(rect, 42) - if err != nil { - println("FAIL: RegisterShape returned error") - return - } - - if rect.GetID() != 42 { - println("FAIL: ID not set correctly") - return - } - - area := rect.Area() - fmt.Printf("Area: %.1f\n", area) - - if area != 15.0 { - println("FAIL: Area calculation incorrect") - return - } - - println("SUCCESS: Custom interface with private methods works correctly") -} diff --git a/_demo/go/issue1370_goast/goast.go b/_demo/go/issue1370_goast/goast.go deleted file mode 100644 index 44a92d05..00000000 --- a/_demo/go/issue1370_goast/goast.go +++ /dev/null @@ -1,25 +0,0 @@ -package main - -import ( - "fmt" - "go/ast" - "go/token" -) - -func main() { - ident := &ast.Ident{ - NamePos: token.Pos(42), - Name: "foo", - } - - var expr ast.Expr = ident - pos := expr.Pos() - - fmt.Printf("Position: %d\n", pos) - if pos != 42 { - println("FAIL: Position mismatch") - return - } - - println("SUCCESS: ast.Expr interface method calls work correctly") -} diff --git a/_demo/go/issue1370_gotypes/gotypes.go b/_demo/go/issue1370_gotypes/gotypes.go deleted file mode 100644 index 6ac15c7f..00000000 --- a/_demo/go/issue1370_gotypes/gotypes.go +++ /dev/null @@ -1,24 +0,0 @@ -package main - -import ( - "go/types" -) - -func main() { - scope := types.NewScope(nil, 0, 0, "test") - obj := types.NewVar(0, nil, "x", types.Typ[types.Int]) - - scope.Insert(obj) - - retrieved := scope.Lookup("x") - if retrieved == nil { - println("FAIL: Lookup returned nil") - return - } - if retrieved.Name() != "x" { - println("FAIL: Name mismatch") - return - } - - println("SUCCESS: Scope.Insert and Lookup work correctly") -} diff --git a/_demo/go/issue1370_geometry/geometry/geometry.go b/cl/_testdata/geometry1370/geometry.go similarity index 87% rename from _demo/go/issue1370_geometry/geometry/geometry.go rename to cl/_testdata/geometry1370/geometry.go index af4b3272..9db70b92 100644 --- a/_demo/go/issue1370_geometry/geometry/geometry.go +++ b/cl/_testdata/geometry1370/geometry.go @@ -1,4 +1,4 @@ -package geometry +package geometry1370 type Shape interface { Area() float64 @@ -20,7 +20,6 @@ func NewRectangle(width, height float64) *Rectangle { return &Rectangle{Width: width, Height: height} } -func RegisterShape(s Shape, id int) error { +func RegisterShape(s Shape, id int) { s.setID(id) - return nil } diff --git a/cl/_testgo/interface1370/in.go b/cl/_testgo/interface1370/in.go new file mode 100644 index 00000000..57d4ef95 --- /dev/null +++ b/cl/_testgo/interface1370/in.go @@ -0,0 +1,11 @@ +package main + +import ( + "github.com/goplus/llgo/cl/_testdata/geometry1370" +) + +func main() { + rect := geometry1370.NewRectangle(5.0, 3.0) + geometry1370.RegisterShape(rect, 42) + println("ID:", rect.GetID()) +} diff --git a/cl/_testgo/interface1370/out.ll b/cl/_testgo/interface1370/out.ll new file mode 100644 index 00000000..9bc42295 --- /dev/null +++ b/cl/_testgo/interface1370/out.ll @@ -0,0 +1,333 @@ +; ModuleID = 'github.com/goplus/llgo/cl/_testgo/interface1370' +source_filename = "github.com/goplus/llgo/cl/_testgo/interface1370" + +%"github.com/goplus/llgo/runtime/internal/runtime.iface" = type { ptr, ptr } +%"github.com/goplus/llgo/runtime/internal/runtime.String" = type { ptr, i64 } +%"github.com/goplus/llgo/runtime/abi.StructField" = type { %"github.com/goplus/llgo/runtime/internal/runtime.String", ptr, i64, %"github.com/goplus/llgo/runtime/internal/runtime.String", i1 } +%"github.com/goplus/llgo/runtime/internal/runtime.Slice" = type { ptr, i64, i64 } +%"github.com/goplus/llgo/runtime/abi.Method" = type { %"github.com/goplus/llgo/runtime/internal/runtime.String", ptr, ptr, ptr } +%"github.com/goplus/llgo/runtime/abi.Imethod" = type { %"github.com/goplus/llgo/runtime/internal/runtime.String", ptr } + +@"github.com/goplus/llgo/cl/_testgo/interface1370.init$guard" = global i1 false, align 1 +@"_llgo_github.com/goplus/llgo/cl/_testdata/geometry1370.Rectangle" = linkonce global ptr null, align 8 +@0 = private unnamed_addr constant [48 x i8] c"github.com/goplus/llgo/cl/_testdata/geometry1370", align 1 +@1 = private unnamed_addr constant [9 x i8] c"Rectangle", align 1 +@_llgo_float64 = linkonce global ptr null, align 8 +@_llgo_int = linkonce global ptr null, align 8 +@"github.com/goplus/llgo/cl/_testgo/interface1370.struct$EuRbjzGGO7GwkW6RxZGl-8lEjTdEMzAFD8LnY_SpVoQ" = linkonce global ptr null, align 8 +@2 = private unnamed_addr constant [5 x i8] c"Width", align 1 +@3 = private unnamed_addr constant [6 x i8] c"Height", align 1 +@4 = private unnamed_addr constant [2 x i8] c"id", align 1 +@5 = private unnamed_addr constant [47 x i8] c"github.com/goplus/llgo/cl/_testgo/interface1370", align 1 +@6 = private unnamed_addr constant [4 x i8] c"Area", align 1 +@"_llgo_func$UYiLlmcWxoOKZPPzvR4LByitNeKoVGoTrB_5ubdOWW8" = linkonce global ptr null, align 8 +@7 = private unnamed_addr constant [5 x i8] c"GetID", align 1 +@"_llgo_func$ETeB8WwW04JEq0ztcm-XPTJtuYvtpkjIsAc0-2NT9zA" = linkonce global ptr null, align 8 +@8 = private unnamed_addr constant [5 x i8] c"setID", align 1 +@9 = private unnamed_addr constant [54 x i8] c"github.com/goplus/llgo/cl/_testdata/geometry1370.setID", align 1 +@"_llgo_func$VZ-8VPNF1RaLICwxc1Ghn7BbgyFX3v762OCdx127EkA" = linkonce global ptr null, align 8 +@10 = private unnamed_addr constant [8 x i8] c"validate", align 1 +@11 = private unnamed_addr constant [57 x i8] c"github.com/goplus/llgo/cl/_testdata/geometry1370.validate", align 1 +@_llgo_bool = linkonce global ptr null, align 8 +@"_llgo_func$YHeRw3AOvQtzv982-ZO3Yn8vh3Fx89RM3VvI8E4iKVk" = linkonce global ptr null, align 8 +@"*_llgo_github.com/goplus/llgo/cl/_testdata/geometry1370.Rectangle" = linkonce global ptr null, align 8 +@"github.com/goplus/llgo/cl/_testgo/interface1370.iface$OopIVfjRcxQr1gmJyGi5G7hHt__vH05AREEM7PthH9o" = linkonce global ptr null, align 8 +@12 = private unnamed_addr constant [3 x i8] c"ID:", align 1 + +define void @"github.com/goplus/llgo/cl/_testgo/interface1370.init"() { +_llgo_0: + %0 = load i1, ptr @"github.com/goplus/llgo/cl/_testgo/interface1370.init$guard", align 1 + br i1 %0, label %_llgo_2, label %_llgo_1 + +_llgo_1: ; preds = %_llgo_0 + store i1 true, ptr @"github.com/goplus/llgo/cl/_testgo/interface1370.init$guard", align 1 + call void @"github.com/goplus/llgo/cl/_testdata/geometry1370.init"() + call void @"github.com/goplus/llgo/cl/_testgo/interface1370.init$after"() + br label %_llgo_2 + +_llgo_2: ; preds = %_llgo_1, %_llgo_0 + ret void +} + +define void @"github.com/goplus/llgo/cl/_testgo/interface1370.main"() { +_llgo_0: + %0 = call ptr @"github.com/goplus/llgo/cl/_testdata/geometry1370.NewRectangle"(double 5.000000e+00, double 3.000000e+00) + %1 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testdata/geometry1370.Rectangle", align 8 + %2 = load ptr, ptr @"*_llgo_github.com/goplus/llgo/cl/_testdata/geometry1370.Rectangle", align 8 + %3 = load ptr, ptr @"_llgo_func$UYiLlmcWxoOKZPPzvR4LByitNeKoVGoTrB_5ubdOWW8", align 8 + %4 = load ptr, ptr @"_llgo_func$VZ-8VPNF1RaLICwxc1Ghn7BbgyFX3v762OCdx127EkA", align 8 + %5 = load ptr, ptr @"_llgo_func$YHeRw3AOvQtzv982-ZO3Yn8vh3Fx89RM3VvI8E4iKVk", align 8 + %6 = load ptr, ptr @"github.com/goplus/llgo/cl/_testgo/interface1370.iface$OopIVfjRcxQr1gmJyGi5G7hHt__vH05AREEM7PthH9o", align 8 + %7 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewItab"(ptr %6, ptr %2) + %8 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" undef, ptr %7, 0 + %9 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %8, ptr %0, 1 + call void @"github.com/goplus/llgo/cl/_testdata/geometry1370.RegisterShape"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %9, i64 42) + %10 = call i64 @"github.com/goplus/llgo/cl/_testdata/geometry1370.(*Rectangle).GetID"(ptr %0) + call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @12, i64 3 }) + call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32) + call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64 %10) + call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10) + ret void +} + +declare void @"github.com/goplus/llgo/cl/_testdata/geometry1370.init"() + +declare ptr @"github.com/goplus/llgo/cl/_testdata/geometry1370.NewRectangle"(double, double) + +declare void @"github.com/goplus/llgo/cl/_testdata/geometry1370.RegisterShape"(%"github.com/goplus/llgo/runtime/internal/runtime.iface", i64) + +define void @"github.com/goplus/llgo/cl/_testgo/interface1370.init$after"() { +_llgo_0: + %0 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 48 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @1, i64 9 }, i64 25, i64 24, i64 0, i64 4) + %1 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testdata/geometry1370.Rectangle", align 8 + %2 = icmp eq ptr %1, null + br i1 %2, label %_llgo_1, label %_llgo_2 + +_llgo_1: ; preds = %_llgo_0 + store ptr %0, ptr @"_llgo_github.com/goplus/llgo/cl/_testdata/geometry1370.Rectangle", align 8 + br label %_llgo_2 + +_llgo_2: ; preds = %_llgo_1, %_llgo_0 + %3 = load ptr, ptr @_llgo_float64, align 8 + %4 = icmp eq ptr %3, null + br i1 %4, label %_llgo_3, label %_llgo_4 + +_llgo_3: ; preds = %_llgo_2 + %5 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 46) + store ptr %5, ptr @_llgo_float64, align 8 + br label %_llgo_4 + +_llgo_4: ; preds = %_llgo_3, %_llgo_2 + %6 = load ptr, ptr @_llgo_float64, align 8 + %7 = load ptr, ptr @_llgo_int, align 8 + %8 = icmp eq ptr %7, null + br i1 %8, label %_llgo_5, label %_llgo_6 + +_llgo_5: ; preds = %_llgo_4 + %9 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 34) + store ptr %9, ptr @_llgo_int, align 8 + br label %_llgo_6 + +_llgo_6: ; preds = %_llgo_5, %_llgo_4 + %10 = load ptr, ptr @_llgo_int, align 8 + %11 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 46) + %12 = call %"github.com/goplus/llgo/runtime/abi.StructField" @"github.com/goplus/llgo/runtime/internal/runtime.StructField"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @2, i64 5 }, ptr %11, i64 0, %"github.com/goplus/llgo/runtime/internal/runtime.String" zeroinitializer, i1 false) + %13 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 46) + %14 = call %"github.com/goplus/llgo/runtime/abi.StructField" @"github.com/goplus/llgo/runtime/internal/runtime.StructField"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @3, i64 6 }, ptr %13, i64 8, %"github.com/goplus/llgo/runtime/internal/runtime.String" zeroinitializer, i1 false) + %15 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 34) + %16 = call %"github.com/goplus/llgo/runtime/abi.StructField" @"github.com/goplus/llgo/runtime/internal/runtime.StructField"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 2 }, ptr %15, i64 16, %"github.com/goplus/llgo/runtime/internal/runtime.String" zeroinitializer, i1 false) + %17 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 168) + %18 = getelementptr %"github.com/goplus/llgo/runtime/abi.StructField", ptr %17, i64 0 + store %"github.com/goplus/llgo/runtime/abi.StructField" %12, ptr %18, align 8 + %19 = getelementptr %"github.com/goplus/llgo/runtime/abi.StructField", ptr %17, i64 1 + store %"github.com/goplus/llgo/runtime/abi.StructField" %14, ptr %19, align 8 + %20 = getelementptr %"github.com/goplus/llgo/runtime/abi.StructField", ptr %17, i64 2 + store %"github.com/goplus/llgo/runtime/abi.StructField" %16, ptr %20, align 8 + %21 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %17, 0 + %22 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %21, i64 3, 1 + %23 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %22, i64 3, 2 + %24 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Struct"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @5, i64 47 }, i64 24, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %23) + store ptr %24, ptr @"github.com/goplus/llgo/cl/_testgo/interface1370.struct$EuRbjzGGO7GwkW6RxZGl-8lEjTdEMzAFD8LnY_SpVoQ", align 8 + %25 = load ptr, ptr @"github.com/goplus/llgo/cl/_testgo/interface1370.struct$EuRbjzGGO7GwkW6RxZGl-8lEjTdEMzAFD8LnY_SpVoQ", align 8 + br i1 %2, label %_llgo_7, label %_llgo_8 + +_llgo_7: ; preds = %_llgo_6 + %26 = load ptr, ptr @"_llgo_func$UYiLlmcWxoOKZPPzvR4LByitNeKoVGoTrB_5ubdOWW8", align 8 + %27 = icmp eq ptr %26, null + br i1 %27, label %_llgo_9, label %_llgo_10 + +_llgo_8: ; preds = %_llgo_18, %_llgo_6 + %28 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 48 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @1, i64 9 }, i64 25, i64 24, i64 0, i64 4) + %29 = load ptr, ptr @"*_llgo_github.com/goplus/llgo/cl/_testdata/geometry1370.Rectangle", align 8 + %30 = icmp eq ptr %29, null + br i1 %30, label %_llgo_19, label %_llgo_20 + +_llgo_9: ; preds = %_llgo_7 + %31 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 0) + %32 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %31, 0 + %33 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %32, i64 0, 1 + %34 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %33, i64 0, 2 + %35 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 46) + %36 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 8) + %37 = getelementptr ptr, ptr %36, i64 0 + store ptr %35, ptr %37, align 8 + %38 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %36, 0 + %39 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %38, i64 1, 1 + %40 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %39, i64 1, 2 + %41 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Func"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %34, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %40, i1 false) + call void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr %41) + store ptr %41, ptr @"_llgo_func$UYiLlmcWxoOKZPPzvR4LByitNeKoVGoTrB_5ubdOWW8", align 8 + br label %_llgo_10 + +_llgo_10: ; preds = %_llgo_9, %_llgo_7 + %42 = load ptr, ptr @"_llgo_func$UYiLlmcWxoOKZPPzvR4LByitNeKoVGoTrB_5ubdOWW8", align 8 + %43 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @6, i64 4 }, ptr undef, ptr undef, ptr undef }, ptr %42, 1 + %44 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %43, ptr @"github.com/goplus/llgo/cl/_testdata/geometry1370.(*Rectangle).Area", 2 + %45 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %44, ptr @"github.com/goplus/llgo/cl/_testdata/geometry1370.(*Rectangle).Area", 3 + %46 = load ptr, ptr @"_llgo_func$ETeB8WwW04JEq0ztcm-XPTJtuYvtpkjIsAc0-2NT9zA", align 8 + %47 = icmp eq ptr %46, null + br i1 %47, label %_llgo_11, label %_llgo_12 + +_llgo_11: ; preds = %_llgo_10 + %48 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 0) + %49 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %48, 0 + %50 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %49, i64 0, 1 + %51 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %50, i64 0, 2 + %52 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 34) + %53 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 8) + %54 = getelementptr ptr, ptr %53, i64 0 + store ptr %52, ptr %54, align 8 + %55 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %53, 0 + %56 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %55, i64 1, 1 + %57 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %56, i64 1, 2 + %58 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Func"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %51, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %57, i1 false) + call void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr %58) + store ptr %58, ptr @"_llgo_func$ETeB8WwW04JEq0ztcm-XPTJtuYvtpkjIsAc0-2NT9zA", align 8 + br label %_llgo_12 + +_llgo_12: ; preds = %_llgo_11, %_llgo_10 + %59 = load ptr, ptr @"_llgo_func$ETeB8WwW04JEq0ztcm-XPTJtuYvtpkjIsAc0-2NT9zA", align 8 + %60 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @7, i64 5 }, ptr undef, ptr undef, ptr undef }, ptr %59, 1 + %61 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %60, ptr @"github.com/goplus/llgo/cl/_testdata/geometry1370.(*Rectangle).GetID", 2 + %62 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %61, ptr @"github.com/goplus/llgo/cl/_testdata/geometry1370.(*Rectangle).GetID", 3 + %63 = load ptr, ptr @"_llgo_func$VZ-8VPNF1RaLICwxc1Ghn7BbgyFX3v762OCdx127EkA", align 8 + %64 = icmp eq ptr %63, null + br i1 %64, label %_llgo_13, label %_llgo_14 + +_llgo_13: ; preds = %_llgo_12 + %65 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 34) + %66 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 8) + %67 = getelementptr ptr, ptr %66, i64 0 + store ptr %65, ptr %67, align 8 + %68 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %66, 0 + %69 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %68, i64 1, 1 + %70 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %69, i64 1, 2 + %71 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 0) + %72 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %71, 0 + %73 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %72, i64 0, 1 + %74 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %73, i64 0, 2 + %75 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Func"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %70, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %74, i1 false) + call void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr %75) + store ptr %75, ptr @"_llgo_func$VZ-8VPNF1RaLICwxc1Ghn7BbgyFX3v762OCdx127EkA", align 8 + br label %_llgo_14 + +_llgo_14: ; preds = %_llgo_13, %_llgo_12 + %76 = load ptr, ptr @"_llgo_func$VZ-8VPNF1RaLICwxc1Ghn7BbgyFX3v762OCdx127EkA", align 8 + %77 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @9, i64 54 }, ptr undef, ptr undef, ptr undef }, ptr %76, 1 + %78 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %77, ptr @"github.com/goplus/llgo/cl/_testdata/geometry1370.(*Rectangle).setID", 2 + %79 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %78, ptr @"github.com/goplus/llgo/cl/_testdata/geometry1370.(*Rectangle).setID", 3 + %80 = load ptr, ptr @_llgo_bool, align 8 + %81 = icmp eq ptr %80, null + br i1 %81, label %_llgo_15, label %_llgo_16 + +_llgo_15: ; preds = %_llgo_14 + %82 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 33) + store ptr %82, ptr @_llgo_bool, align 8 + br label %_llgo_16 + +_llgo_16: ; preds = %_llgo_15, %_llgo_14 + %83 = load ptr, ptr @_llgo_bool, align 8 + %84 = load ptr, ptr @"_llgo_func$YHeRw3AOvQtzv982-ZO3Yn8vh3Fx89RM3VvI8E4iKVk", align 8 + %85 = icmp eq ptr %84, null + br i1 %85, label %_llgo_17, label %_llgo_18 + +_llgo_17: ; preds = %_llgo_16 + %86 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 0) + %87 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %86, 0 + %88 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %87, i64 0, 1 + %89 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %88, i64 0, 2 + %90 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 33) + %91 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 8) + %92 = getelementptr ptr, ptr %91, i64 0 + store ptr %90, ptr %92, align 8 + %93 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %91, 0 + %94 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %93, i64 1, 1 + %95 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %94, i64 1, 2 + %96 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Func"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %89, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %95, i1 false) + call void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr %96) + store ptr %96, ptr @"_llgo_func$YHeRw3AOvQtzv982-ZO3Yn8vh3Fx89RM3VvI8E4iKVk", align 8 + br label %_llgo_18 + +_llgo_18: ; preds = %_llgo_17, %_llgo_16 + %97 = load ptr, ptr @"_llgo_func$YHeRw3AOvQtzv982-ZO3Yn8vh3Fx89RM3VvI8E4iKVk", align 8 + %98 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @11, i64 57 }, ptr undef, ptr undef, ptr undef }, ptr %97, 1 + %99 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %98, ptr @"github.com/goplus/llgo/cl/_testdata/geometry1370.(*Rectangle).validate", 2 + %100 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %99, ptr @"github.com/goplus/llgo/cl/_testdata/geometry1370.(*Rectangle).validate", 3 + %101 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 160) + %102 = getelementptr %"github.com/goplus/llgo/runtime/abi.Method", ptr %101, i64 0 + store %"github.com/goplus/llgo/runtime/abi.Method" %45, ptr %102, align 8 + %103 = getelementptr %"github.com/goplus/llgo/runtime/abi.Method", ptr %101, i64 1 + store %"github.com/goplus/llgo/runtime/abi.Method" %62, ptr %103, align 8 + %104 = getelementptr %"github.com/goplus/llgo/runtime/abi.Method", ptr %101, i64 2 + store %"github.com/goplus/llgo/runtime/abi.Method" %79, ptr %104, align 8 + %105 = getelementptr %"github.com/goplus/llgo/runtime/abi.Method", ptr %101, i64 3 + store %"github.com/goplus/llgo/runtime/abi.Method" %100, ptr %105, align 8 + %106 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %101, 0 + %107 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %106, i64 4, 1 + %108 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %107, i64 4, 2 + call void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamed"(ptr %0, ptr %25, { ptr, i64, i64 } zeroinitializer, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %108) + br label %_llgo_8 + +_llgo_19: ; preds = %_llgo_8 + %109 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.PointerTo"(ptr %28) + call void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr %109) + store ptr %109, ptr @"*_llgo_github.com/goplus/llgo/cl/_testdata/geometry1370.Rectangle", align 8 + br label %_llgo_20 + +_llgo_20: ; preds = %_llgo_19, %_llgo_8 + %110 = load ptr, ptr @"_llgo_func$UYiLlmcWxoOKZPPzvR4LByitNeKoVGoTrB_5ubdOWW8", align 8 + %111 = load ptr, ptr @"_llgo_func$VZ-8VPNF1RaLICwxc1Ghn7BbgyFX3v762OCdx127EkA", align 8 + %112 = load ptr, ptr @"_llgo_func$YHeRw3AOvQtzv982-ZO3Yn8vh3Fx89RM3VvI8E4iKVk", align 8 + %113 = insertvalue %"github.com/goplus/llgo/runtime/abi.Imethod" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @6, i64 4 }, ptr undef }, ptr %110, 1 + %114 = insertvalue %"github.com/goplus/llgo/runtime/abi.Imethod" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @9, i64 54 }, ptr undef }, ptr %111, 1 + %115 = insertvalue %"github.com/goplus/llgo/runtime/abi.Imethod" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @11, i64 57 }, ptr undef }, ptr %112, 1 + %116 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 72) + %117 = getelementptr %"github.com/goplus/llgo/runtime/abi.Imethod", ptr %116, i64 0 + store %"github.com/goplus/llgo/runtime/abi.Imethod" %113, ptr %117, align 8 + %118 = getelementptr %"github.com/goplus/llgo/runtime/abi.Imethod", ptr %116, i64 1 + store %"github.com/goplus/llgo/runtime/abi.Imethod" %114, ptr %118, align 8 + %119 = getelementptr %"github.com/goplus/llgo/runtime/abi.Imethod", ptr %116, i64 2 + store %"github.com/goplus/llgo/runtime/abi.Imethod" %115, ptr %119, align 8 + %120 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %116, 0 + %121 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %120, i64 3, 1 + %122 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %121, i64 3, 2 + %123 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Interface"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 48 }, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %122) + store ptr %123, ptr @"github.com/goplus/llgo/cl/_testgo/interface1370.iface$OopIVfjRcxQr1gmJyGi5G7hHt__vH05AREEM7PthH9o", align 8 + ret void +} + +declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String", %"github.com/goplus/llgo/runtime/internal/runtime.String", i64, i64, i64, i64) + +declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64) + +declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Struct"(%"github.com/goplus/llgo/runtime/internal/runtime.String", i64, %"github.com/goplus/llgo/runtime/internal/runtime.Slice") + +declare %"github.com/goplus/llgo/runtime/abi.StructField" @"github.com/goplus/llgo/runtime/internal/runtime.StructField"(%"github.com/goplus/llgo/runtime/internal/runtime.String", ptr, i64, %"github.com/goplus/llgo/runtime/internal/runtime.String", i1) + +declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64) + +declare void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamed"(ptr, ptr, %"github.com/goplus/llgo/runtime/internal/runtime.Slice", %"github.com/goplus/llgo/runtime/internal/runtime.Slice") + +declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Func"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice", %"github.com/goplus/llgo/runtime/internal/runtime.Slice", i1) + +declare void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr) + +declare double @"github.com/goplus/llgo/cl/_testdata/geometry1370.(*Rectangle).Area"(ptr) + +declare i64 @"github.com/goplus/llgo/cl/_testdata/geometry1370.(*Rectangle).GetID"(ptr) + +declare void @"github.com/goplus/llgo/cl/_testdata/geometry1370.(*Rectangle).setID"(ptr, i64) + +declare i1 @"github.com/goplus/llgo/cl/_testdata/geometry1370.(*Rectangle).validate"(ptr) + +declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.PointerTo"(ptr) + +declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Interface"(%"github.com/goplus/llgo/runtime/internal/runtime.String", %"github.com/goplus/llgo/runtime/internal/runtime.Slice") + +declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewItab"(ptr, ptr) + +declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String") + +declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8) + +declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64)