Skip to content

V2.0.1#5

Merged
kampute merged 10 commits intomainfrom
v2.0.1
Dec 19, 2025
Merged

V2.0.1#5
kampute merged 10 commits intomainfrom
v2.0.1

Conversation

@kampute
Copy link
Owner

@kampute kampute commented Dec 19, 2025

This pull request introduces several improvements and refinements to the handling of constructors and explicit interface implementations in the documentation toolkit. The changes enhance the accuracy of metadata extraction, reduce noise in generated documentation by omitting trivial constructors, and expand test coverage for complex interface scenarios. Additionally, the logic for identifying compiler-generated bridge methods for explicit interface implementations has been made more robust.

Constructor Handling Improvements:

  • Updated the definition of IsDefaultConstructor in IConstructor to consider any non-static, parameterless constructor as default, regardless of visibility, and clarified the documentation accordingly.
  • Changed CompositeTypeModel so that if a type only has a default constructor with no documentation, it is omitted from the constructor collection, reducing clutter in generated documentation. [1] [2]
  • Improved logic in TypeParameterAdapter to only consider constructors of accessible types and require that default constructors are public, ensuring more accurate filtering.
  • Updated XML doc inspection option to reflect that omission of missing summary tags applies to all default constructors, not just public ones.

Explicit Interface Implementation and Bridge Method Detection:

  • Significantly refactored the logic for detecting compiler-generated bridge methods for explicit interface implementations involving in parameters. The new approach checks for the presence of in parameters and searches for corresponding public methods, improving accuracy and maintainability. [1] [2]

Test Coverage and Sample Expansion:

  • Added and updated test cases in Acme.cs to cover generic interface methods with in parameters, overloads, and operator overloads, ensuring the toolkit correctly handles these scenarios. [1] [2] [3] [4] [5] [6]
  • Updated test assertions to match new parameter types and expanded expected member lists to include new interface implementations. [1] [2]

Build and Configuration Adjustments:

  • Updated the kampose.json assembly glob pattern to support all target frameworks, improving compatibility.
  • Incremented the package version to 2.0.1 in the project file.This pull request introduces improvements and clarifications to the handling of constructors and explicit interface method implementations, especially those with in-parameters, in the metadata and model layers. It also updates and expands the test suite to cover these scenarios more thoroughly. The most important changes are grouped below.

Constructor Handling Improvements

  • The definition of IsDefaultConstructor in the IConstructor interface was updated to consider any non-static, parameterless constructor as default, regardless of visibility, and the remarks were clarified.
  • The logic for identifying default constructors in TypeParameterAdapter was updated to ensure only accessible, public, non-abstract types with public default constructors are considered, improving accuracy for generic constraints.
  • The CompositeTypeModel now omits default constructors from its constructor collection if they are the only constructor and lack documentation, aligning with the new definition and reducing noise in metadata representations. [1] [2]
  • The XML documentation inspection option was clarified to omit missing summary reports for all default constructors, not just public ones.

Explicit Interface Implementation & Bridge Method Detection

  • The method for detecting compiler-generated bridge methods in CompositeTypeAdapter was refactored and expanded. It now specifically checks for explicit interface implementations with in-parameters and properly matches generic and non-generic methods, improving metadata accuracy for these cases.
  • The necessary using directive for System.Runtime.CompilerServices was added to enable method inlining.

Test Suite Enhancements

  • Tests were expanded and updated to cover new interface methods with in-parameters, explicit implementations, and overloads, including generic scenarios. This ensures comprehensive coverage of bridge method detection and metadata representation. [1] [2] [3] [4] [5] [6]
  • Constructor-related tests were updated to reflect the new definition of default constructors, ensuring both public and non-public parameterless constructors are handled correctly. [1] [2]
  • A new indexer was added to a sample interface for completeness in test coverage.
  • Test cases were updated to match changes in method signatures, particularly for interface methods with in-parameters.This pull request refines the handling and definition of default constructors and improves the detection of compiler-generated bridge methods for explicit interface implementations, particularly those involving in parameters. It also expands and updates the test suite to cover new scenarios and clarifies documentation. The most significant changes are detailed below.

Default Constructor Semantics and Accessibility:

  • The definition of a default constructor (IsDefaultConstructor) now ignores visibility, treating any instance parameterless constructor as default, regardless of its access modifier. This is reflected in both the interface and its documentation.
  • The logic for determining if a type has a default constructor now checks for type accessibility and public visibility of the constructor, ensuring only accessible, non-abstract types with a public default constructor are considered.
  • The CompositeTypeModel omits the default constructor from its collection if it is the only constructor and lacks documentation, treating it as implicit. [1] [2]
  • The XML doc inspection option for omitting missing summary tags now applies to all default constructors, not just public ones.

Compiler-Generated Bridge Method Detection:

  • The method for identifying compiler-generated bridge methods for explicit interface implementations with in parameters has been rewritten for accuracy. It now checks for the presence of in parameters and attempts to match a corresponding public method, handling both generic and non-generic cases.
  • Added a missing using for System.Runtime.CompilerServices to support method inlining.

Test Suite Enhancements:

  • Expanded test coverage in Acme.cs to include new interface methods and overloads with in parameters, as well as explicit and implicit implementations in various classes and interfaces. [1] [2] [3] [4] [5] [6]
  • Updated and added tests to verify the new semantics for default constructors, including checks for parameterless and parameterized constructors across different types. [1] [2]
  • Adjusted test expectations and cases to match changes in method signatures and interface implementations, particularly for methods with in parameters. [1] [2]

Documentation Improvements:

  • Clarified and expanded XML documentation for constructors, methods, and interface members to reflect the new behaviors and ensure accurate code comments throughout the codebase. [1] [2] [3] [4] [5] [6] [7] [8] [9]

These changes collectively improve the accuracy of metadata representation, ensure more robust handling of C# language features, and provide better test coverage for edge cases.This pull request introduces several improvements and refinements to how constructors and explicit interface implementations are handled in the metadata and model layers, along with expanded and corrected test coverage. The main changes enhance the identification of default constructors, improve the exclusion of compiler-generated bridge methods, and add new test cases for generic and in-parameter interface methods.

Constructor handling improvements:

  • Refined the definition of IsDefaultConstructor in IConstructor to include public, protected, and protected internal parameterless constructors, not just public ones. Updated remarks and logic accordingly.
  • Updated CompositeTypeModel so that if a type only has a default constructor with no documentation, it is omitted from the constructor list, treating it as implicit. [1] [2]
  • Adjusted related XML documentation and test descriptions to reflect the broader definition of default constructors. [1] [2] [3]

Compiler-generated bridge method exclusion:

  • Improved the logic in CompositeTypeAdapter.IsCompilerGeneratedBridgeMethod to more accurately detect and exclude compiler-generated bridge methods for explicit interface implementations with in parameters, including handling generic methods and matching signatures.
  • Added System.Runtime.CompilerServices import for MethodImplOptions.AggressiveInlining used in helper methods.

Test suite enhancements:

  • Added and updated tests to cover new interface methods with in parameters and their implementations, including generic overloads and explicit interface implementations. [1] [2] [3] [4] [5] [6]
  • Expanded tests for constructor overload counts and clarified expected results for default and parameterized constructors.
  • Updated or removed test cases to match new method signatures and behaviors (e.g., parameter types for InterfaceMethodWithInParam).

Other improvements:

  • Added an indexer property to ISampleExtendedConstructedGenericInterface in the test suite for broader interface coverage.

These changes collectively improve the accuracy and clarity of the metadata and documentation generation, especially around constructors and explicit interface methods involving advanced parameter types.

Expand default constructor to include public, protected, and protected internal parameterless constructors. Update `IsDefaultConstructor` logic, documentation, and related comments. Adjust model logic to omit undocumented default constructors. Revise unit tests and option descriptions to reflect new definition.
Improve detection of compiler-generated bridge methods by handling generic methods as well. Include more tests to cover this scenario.
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 pull request refines constructor and explicit interface implementation handling in the metadata and model layers, along with expanded test coverage for interface methods with in parameters. The changes improve how default constructors are identified and omitted from documentation, enhance compiler-generated bridge method detection for explicit interface implementations, and add comprehensive test cases for generic and non-generic interface methods with in parameters.

Key changes:

  • Broadened the definition of "default constructor" to include public, protected, and protected internal parameterless constructors, and updated logic to omit undocumented default constructors from the model
  • Enhanced bridge method detection in CompositeTypeAdapter.IsCompilerGeneratedBridgeMethod to handle generic methods with in parameters and perform more accurate signature matching
  • Added test data and test cases for interface methods with in parameters, including generic overloads and explicit implementations

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Metadata/IConstructor.cs Updated IsDefaultConstructor definition to include protected and protected internal constructors
src/Models/CompositeTypeModel.cs Modified constructor initialization to omit single undocumented default constructors from the collection
src/Metadata/Adapters/CompositeTypeAdapter.cs Enhanced bridge method detection with separate handling for generic and non-generic methods, added helper methods for parameter matching
src/XmlDoc/XmlDocInspectionOptions.cs Updated documentation comment to reflect broader definition of default constructors
tests/Acme.cs Changed interface method parameter from int to decimal, added generic method overloads with in parameters, added operator overloads, and added indexer to test interface
tests/Metadata/ConstructorTests.cs Updated test method names and consolidated test cases for default constructor detection, added overload count test
tests/Metadata/MethodTests.cs Renamed test method and added overload count test for various method types
tests/Metadata/PropertyTests.cs Added overload count test for indexers
tests/Metadata/OperatorTests.cs Added overload count test for operators
tests/Metadata/ClassTypeTests.cs Added expected method names for new interface method implementations
tests/Metadata/InterfaceTypeTests.cs Added expected method names for new generic interface method overloads
tests/Metadata/StructTypeTests.cs Added expected method names for new interface method implementations
tests/Languages/CSharpTests.cs Removed test case for explicit interface implementation with in parameter

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

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

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

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

@kampute kampute merged commit 26a2bd0 into main Dec 19, 2025
1 check passed
@kampute kampute deleted the v2.0.1 branch December 19, 2025 19:37
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