refactor: move issue #1370 regression tests to _demo/go
Move the three regression test cases from _demo/ to _demo/go/: - issue1370_gotypes (go/types.Object test) - issue1370_goast (go/ast.Expr test) - issue1370_geometry (custom interface test) Updated import path in geometry.go to reflect new location. Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: luoliwoshang <51194195+luoliwoshang@users.noreply.github.com>
This commit is contained in:
151
.tmp-comment/codeagent-comments-1761548372-b1eec08bdc2eb312.log
Normal file
151
.tmp-comment/codeagent-comments-1761548372-b1eec08bdc2eb312.log
Normal file
@@ -0,0 +1,151 @@
|
||||
# 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.
|
||||
|
||||
<details><summary>Additional details and impacted files</summary>
|
||||
|
||||
|
||||
|
||||
```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
|
||||
```
|
||||
</details>
|
||||
|
||||
[: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).
|
||||
<details><summary> :rocket: New features to boost your workflow: </summary>
|
||||
|
||||
- :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.
|
||||
</details>
|
||||
|
||||
---
|
||||
|
||||
**@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.
|
||||
|
||||
---
|
||||
|
||||
181
.tmp-comment/codeagent-comments-1761548945-e666e25cb6be24bd.log
Normal file
181
.tmp-comment/codeagent-comments-1761548945-e666e25cb6be24bd.log
Normal file
@@ -0,0 +1,181 @@
|
||||
# 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.
|
||||
|
||||
<details><summary>Additional details and impacted files</summary>
|
||||
|
||||
|
||||
|
||||
```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
|
||||
```
|
||||
</details>
|
||||
|
||||
[: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).
|
||||
<details><summary> :rocket: New features to boost your workflow: </summary>
|
||||
|
||||
- :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.
|
||||
</details>
|
||||
|
||||
---
|
||||
|
||||
**@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.
|
||||
|
||||
---
|
||||
|
||||
214
.tmp-comment/codeagent-comments-1761549818-1aa4d6d7d042da0c.log
Normal file
214
.tmp-comment/codeagent-comments-1761549818-1aa4d6d7d042da0c.log
Normal file
@@ -0,0 +1,214 @@
|
||||
# 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.
|
||||
|
||||
<details><summary>Additional details and impacted files</summary>
|
||||
|
||||
|
||||
|
||||
```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
|
||||
```
|
||||
</details>
|
||||
|
||||
[: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).
|
||||
<details><summary> :rocket: New features to boost your workflow: </summary>
|
||||
|
||||
- :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.
|
||||
</details>
|
||||
|
||||
---
|
||||
|
||||
**@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`
|
||||
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user