generated from cloudwego/.github
-
Notifications
You must be signed in to change notification settings - Fork 38
fix: self-reference detection and type alias dependency extraction #123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… export check Fixed an issue where arrow function default export detection was checking the arrow function's symbol instead of the variable declaration's symbol. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Fixed type dependency recognition for type aliases (especially union types) across all parsers by extracting symbols from TypeReference node's typeName child instead of the node itself. Changes: - DependencyUtils: capture union/intersection type aliases before recursing into members - TypeParser: extract symbols from typeName for TypeReference nodes, handle ExpressionWithTypeArguments, put type alias dependencies in InlineStruct instead of Implements - FunctionParser: extract symbols from TypeReference typeName for function parameter/return types - VarParser: extract symbols from TypeReference typeName for variable/property type annotations - Added comprehensive unit tests for all three parsers 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Collaborator
Author
|
我对 TS-Parser 进行了变更,Regression Test 不通过属于正常现象。 |
Collaborator
变更后,Result 的 Types 多了 T,这是期望行为吗 |
Collaborator
Author
fixed |
Hoblovski
approved these changes
Dec 2, 2025
Collaborator
Hoblovski
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just looked at the test results. Make sense.
AsterDY
approved these changes
Dec 3, 2025
3 tasks
Duslia
pushed a commit
that referenced
this pull request
Dec 7, 2025
…ollow-up to #123) (#125) * fix: use variable symbol instead of arrow function symbol for default export check Fixed an issue where arrow function default export detection was checking the arrow function's symbol instead of the variable declaration's symbol. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * upd version * fix: correct type alias symbol extraction from TypeReference nodes Fixed type dependency recognition for type aliases (especially union types) across all parsers by extracting symbols from TypeReference node's typeName child instead of the node itself. Changes: - DependencyUtils: capture union/intersection type aliases before recursing into members - TypeParser: extract symbols from typeName for TypeReference nodes, handle ExpressionWithTypeArguments, put type alias dependencies in InlineStruct instead of Implements - FunctionParser: extract symbols from TypeReference typeName for function parameter/return types - VarParser: extract symbols from TypeReference typeName for variable/property type annotations - Added comprehensive unit tests for all three parsers 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix type self-reference problem * filtering type parameters * support class parsing * fix: if a property in a class is defined as a function, categorize it as a method * fix bugs: construct symbol name by assignSymbolName * update version * add function parse --------- Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
Bug fix
Check the PR title.
PR Title:
(Optional) Translate the PR title into Chinese.
修复自引用检测和类型别名依赖提取
(Optional) More detailed description for this PR(en: English/zh: Chinese).
en:
Fixes two bugs in type dependency extraction:
Self-reference detection: Recursive types like
type TreeNode = { children: TreeNode[] }incorrectly included themselves in dependencies. Fixed by checking if type reference is within type definition instead of checking if definition is within function.Type alias extraction: Type aliases like
type Status = 'normal' | 'abnormal'were not extracted when used in function parameters or return types. Fixed by extracting direct symbol from type nodes before processing nested references.zh(optional):
修复类型依赖提取中的两个 bug:
自引用检测:递归类型如
type TreeNode = { children: TreeNode[] }错误地将自身包含在依赖中。通过检查类型引用是否在类型定义内(而非检查定义是否在函数内)修复。类型别名提取:类型别名如
type Status = 'normal' | 'abnormal'在函数参数或返回类型中使用时未被提取。通过在处理嵌套引用前先提取类型节点的直接符号修复。