- 
                Notifications
    You must be signed in to change notification settings 
- Fork 11
0.5.0 #13
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
Conversation
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.
Pull Request Overview
This PR, version 0.5.0, improves protocol requirement search performance, refactors type parsing in Swift sections, updates the swift-tools-version, and tweaks demangle options for better type presentation. Key changes include:
- Changing the semantic type property in FunctionDeclaration to use the more granular .function(.declaration).
- Refactoring MachO-related extensions and cache handling for clarity and type safety.
- Updating Package.swift to support newer platforms and swift-tools-version 6.1.
Reviewed Changes
Copilot reviewed 20 out of 50 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description | 
|---|---|
| Sources/Semantic/Components/FunctionDeclaration.swift | Updated semantic type for function declarations. | 
| Sources/MachOTestingSupport/MachOFileName.swift | Renamed and augmented enum cases for clarity of file source identification. | 
| Sources/MachOTestingSupport/Extensions.swift | Added an extension on String defining a 'print' method using package visibility. | 
| Sources/MachOTestingSupport/DumpableTest.swift | Introduced several async dump methods for protocol and type descriptors. | 
| Sources/MachOTestingSupport/DemangleOptions.swift | Defined a new 'test' demangle options configuration. | 
| Sources/MachOSwiftSection/... (multiple files) | Refactored section lookup and descriptor reading for consistency. | 
| Sources/MachOPointer/Symbol/MachOSymbolCache.swift | Adjusted symbol caching API to pass context explicitly. | 
| Sources/Demangle/Main/NodePrinter.swift | Updated printing calls to use the new semantic types and added weak-prefix support. | 
| Sources/Demangle/Main/DemangleOptions.swift | Removed deprecated prefix option and introduced a new removeWeakPrefix option. | 
| Package.swift | Advanced swift-tools-version and added platform support along with dependency tweaks. | 
Comments suppressed due to low confidence (1)
Sources/MachOTestingSupport/Extensions.swift:28
- The method 'print' defined in the String extension may shadow Swift's global print function; consider renaming it to avoid potential confusion.
    package func print() {
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.
Summary of Changes
Hello @Mx-Iris, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request introduces a significant version bump for the project, aligning it with a newer Swift toolchain and broadening its compatibility across Apple platforms. A core focus of these changes is to enhance the accuracy and detail of Swift metadata parsing and demangling, particularly for protocols and types, by refining internal data handling and introducing more granular semantic representations. The changes also include various refactorings and new testing infrastructure to support these improvements.
Highlights
- Swift Toolchain & Platform Support: The project's swift-tools-versionhas been upgraded from 5.10 to 6.1, and platform support has been significantly expanded to include iOS (v13), tvOS (v13), watchOS (v6), and visionOS (v1), in addition to macOS (v10.15). An explicitswiftLanguageModes: [.v5]has also been added toPackage.swift.
- Swift Metadata Parsing & Demangling Enhancements: The search method for Protocol requirements has been optimized, improving the discovery of requirement symbols. Type parsing in the swift-sectioncommand-line tool has been refined from.remainingto.upToNextOption, addressing issues with type parsing errors whensynthesizeSugarTypesdemangle options are enabled. A newremoveWeakPrefixdemangling option was introduced, and theshowPrefixAndSuffixoption was removed.
- Mach-O Section & Symbol Handling Improvements: Centralized utility functions for finding Swift sections within Mach-O files and images have been introduced (MachORepresentable+.swift). The symbol caching mechanism inMachOSymbolCache.swifthas been enhanced to store both original and cache-adjusted offsets, improving symbol lookup robustness.MachOImagenow includes more robustcacheandstartOffsetcalculations.
- Semantic Type System Refactoring: The internal SemanticTypeenum has been refactored to use more granular nestedTypeKindandContextenums (e.g.,.type(.class, .declaration)), allowing for more precise semantic classification of code elements during demangling and dumping. This impacts variousDumpableextensions and CLI coloring.
- New Features & Utilities: Support for dumping AssociatedTypedescriptors has been added. TheClassdumping now correctly identifies and displaysactortypes. New array extension overloads for optional arrays were added. New test suites (DyldCacheDumpTests,MachOFileDumpTests,MachOImageDumpTests) have been introduced to validate dumping capabilities across different Mach-O contexts.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description | 
|---|---|---|
| Code Review | /gemini review | Performs a code review for the current pull request in its current state. | 
| Pull Request Summary | /gemini summary | Provides a summary of the current pull request in its current state. | 
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. | 
| Help | /gemini help | Displays a list of available commands. | 
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
- 
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩ 
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.
Code Review
The pull request includes several changes, including updating the Swift tools version, optimizing the search method for protocol requirements, changing the parsing method of types in swift-section, fixing type parsing errors, and adding support for new platforms. The code review focuses on suggesting minor improvements such as adding comments to explain certain code sections and ensuring code clarity.
Optimized the search method for Protocol requirements, now most requirement symbols should be found.
Changed the parsing method of types in swift-section from remaining to upToNextOption.
Switched swift-tools-version to 6.1.
Fixed the issue of type parsing errors after enabling synthesizeSugarTypes demangleOptions.