Skip to content

处理 IPC 默认值,避免歧义#172

Merged
lindexi merged 1 commit intomainfrom
t/lvyi/am
Sep 10, 2025
Merged

处理 IPC 默认值,避免歧义#172
lindexi merged 1 commit intomainfrom
t/lvyi/am

Conversation

@walterlv
Copy link
Member

虽然让源生成器生成符合预期的代码更难一些,要多层引号,但不会再有歧义了,字符串里的东西一定是代码而不可能既可能是代码又可能是字符串

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR handles IPC default values to avoid ambiguity by changing the DefaultReturn property type from object? to string? and updating the code generation logic accordingly. The change ensures that default values are always treated as string representations of code rather than having ambiguous interpretation between code and string literals.

Key changes:

  • Changed DefaultReturn property type from object? to string? in IPC attributes
  • Updated attribute documentation with clear examples of string-to-code conversion
  • Simplified code generation by removing complex type-based formatting logic

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
IFakeIpcObject.cs Updated test interface to use escaped string literals for default values
IpcPropertyAttribute.cs Changed DefaultReturn type to string? and updated documentation
IpcMethodAttribute.cs Changed DefaultReturn type to string? and updated documentation
IpcPublicGenerator.cs Removed exception handling wrapper code
SemanticAttributeHelper.cs Added string type handling and cleaned up unused imports
IpcSemanticAttributeHelper.cs Updated method signatures to use string? instead of object?
IpcShapeAttributeNamedValues.cs Simplified formatting logic for default return values
IpcPublicAttributeNamedValues.cs Removed complex type-based formatting method
Diagnostics.cs Updated array syntax to use collection expressions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@lindexi lindexi merged commit da54fb7 into main Sep 10, 2025
3 checks passed
@lindexi lindexi deleted the t/lvyi/am branch September 10, 2025 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants