Added comprehensive result verification and assertions to ensure correctness:
go/token demo:
- Verify Pos values and IsValid() results
- Check token string representations
- Validate keyword detection (IsKeyword())
- Assert operator precedence relationships
- Verify file and position operations
go/types demo:
- Validate basic type kinds
- Check object names and types (Var, Const, Func, TypeName)
- Verify package path and name
- Assert interface method counts and names
- Check struct field counts, names, and types
- Validate signature params and results
- Verify tuple, array, slice, pointer, map, and chan properties
All demos now fail fast with panic() if results don't match expected values,
providing better test coverage than just printing output.
Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <51194195+luoliwoshang@users.noreply.github.com>
Expanded demo tests to cover more public methods and functions from go/types and go/token packages, as discovered via `go doc`.
**go/types additions:**
- Type comparison functions: Identical, AssignableTo, Comparable, ConvertibleTo
- Interface checking: Implements, AssertableTo
- String formatting: TypeString, ObjectString with qualifiers
- Lookup utilities: LookupFieldOrMethod, NewMethodSet
- Type utilities: IsInterface, Default, Id
**go/token additions:**
- Utility functions: IsExported, IsIdentifier, IsKeyword, Lookup
These additions provide better coverage of the packages' public APIs and demonstrate proper usage patterns for interface conversions and method calls.
Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <51194195+luoliwoshang@users.noreply.github.com>
- Removed header/footer print statements from main()
- Added '\n' prefix to section headers (except first) for consistent spacing
- Follows the pattern established in maphash and other demo files
This makes the output cleaner and consistent with other demo files in the project.
Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <51194195+luoliwoshang@users.noreply.github.com>
Removed the unused "go/ast" import from _demo/go/gotypes/main.go
that was causing compilation errors. The demo now compiles and runs
successfully with both standard go and llgo.
Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <51194195+luoliwoshang@users.noreply.github.com>
- Remove temporary .tmp-comment/ and .tmp-images/ directories
- Remove llgo binary from repository
- Refactor _demo/go/issue1370_case1 to include multiple test functions with proper validation
- Refactor _demo/go/issue1370_case2 to include multiple test functions with proper validation
- Tests now panic on failure with descriptive error messages
- Follow the same test structure as _demo/go/maphash
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Fixes os.ReadDir segfault caused by package path mismatch between llgo
overlay packages and canonical standard library paths.
The issue occurred in: os.ReadDir → sort.Slice → reflectlite.Swapper
where internal/reflectlite.Type interface has private methods common()
and uncommon(). Using mPkg.Path() returned the overlay path
'github.com/goplus/llgo/runtime/internal/lib/internal/reflectlite'
instead of the canonical 'internal/reflectlite', causing runtime to
only fill public methods and leave private method pointers NULL.
Changed to use abi.PathOf() which returns the correct canonical package
path for matching, ensuring all interface methods (both public and
private) are properly filled in the interface table.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- 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>
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>
- Regenerated all test case .ll files using llgen to reflect the
interface metadata package path fix
- Updated debug/out.ll which was previously a placeholder
- Removed cl/_testdata/gotypesissue test case as requested
- Removed _demo/go/gotypesissue demo as requested
- All cl tests pass
Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
Add a demo program to demonstrate the fix for cross-package interface
private method calls. This demo uses go/types.Scope.Insert which has
private methods in the go/types package, making it a good test case
for the bug fix in PR #1371.
Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
- Fix line 67: Change unused variable 'n' to blank identifier '_'
- Fix line 102: Correct WriteByte call to expect only error return value
(WriteByte returns only error, not (int, error))
These fixes resolve the compilation errors reported by the CI.
Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
- Add tests for all major hash/maphash public APIs:
* Hash basics (WriteString, Sum64, Reset)
* MakeSeed and SetSeed functionality
* Write methods (Write, WriteByte, WriteString)
* Bytes and String convenience functions
- Use panic() for unexpected errors instead of silent failures
- Add proper error checking and validation
- Document Comparable/WriteComparable limitations in overlay
Note: Comparable() and WriteComparable() are not yet supported and will
panic with 'intrinsic' error as they require runtime intrinsic support.
Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>