Skip to content

Add generic variance and type identity tests - #192

Merged
josesimoes merged 4 commits into
developfrom
add-variance-tests
Nov 23, 2026
Merged

josesimoes merged 4 commits into
developfrom
add-variance-tests

Conversation

@josesimoes

Copy link
Copy Markdown
Member

Description

  • Add covariance, array view, Array.Copy and generic type identity tests over List<T> and Dictionary.
  • Fix int[] is now an IList<uint>.

Motivation and Context

How Has This Been Tested?

Screenshots

Types of changes

  • Improvement (non-breaking change that improves a feature, code or algorithm)
  • Bug fix (non-breaking change which fixes an issue with code or algorithm)
  • New feature (non-breaking change which adds functionality to code)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Config and build (change in the configuration and build system, has no impact on code or features)
  • Dependencies (update dependencies and changes associated, has no impact on code or features)
  • Unit Tests (add new Unit Test(s) or improved existing one(s), has no impact on code or features)
  • Documentation (changes or updates in the documentation, has no impact on code or features)

Checklist:

  • My code follows the code style of this project (only if there are changes in source code).
  • My changes require an update to the documentation (there are changes that require the docs website to be updated).
  • I have updated the documentation accordingly (the changes require an update on the docs in this repo).
  • I have read the CONTRIBUTING document.
  • I have tested everything locally and all new and existing tests passed (only if there are changes in source code).
  • I have added new tests to cover my changes.

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Explain Change →

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Central YAML; Path: .coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: a0588c6f-7cac-4b74-bb70-73103a379253

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Tests
    • Expanded coverage for generic variance, array covariance, collection behavior, and generic type reflection.
    • Added checks for compatible and incompatible array views, including integral and enum types.
    • Updated an array type assertion to verify that an integer array is not treated as a list of long values.

The test project adds coverage for generic variance, array operations, and generic type reflection. It also includes the new test file and changes an existing negative array interface check from IList<uint> to IList<long>.

Changes: Generic variance tests

Layer / File(s) Summary
Add and integrate variance coverage
Tests/GenericCollections/GenericCollections.nfproj, Tests/GenericCollections/VarianceTests.cs, Tests/GenericCollections/ArrayGenericInterfaceTests.cs
The project compiles tests for collection and array variance, array operations, and generic type reflection. Supporting types provide test inputs. An existing array interface assertion now checks against IList<long>.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Other

Merge Risk: Minimal · previous review 25aa5

This change only adds unit tests for generic variance and type identity, so production behavior is unaffected. The tests have not been run yet, so confirm the test project passes on the target runtime before merging.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "Add generic variance and type identity tests" (44 characters) matches the main change: a new VarianceTests.cs suite covering covariance, array views, Array.Copy, and generic type identity. …
Description check Passed The description lists the added covariance, array view, Array.Copy and generic type identity tests over List and Dictionary, and the int[] to IList fix. It also marks the Unit Tests type and …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Add generic variance and type identity tests" (44 characters) matches the main change: a new VarianceTests.cs suite covering covariance, array views, Array.Copy, and generic type identity. It is under 50 characters, has no PR or issue references, does not end with a full stop, and gives a short, descriptive summary.

Full details: Description check

Explanation

The description lists the added covariance, array view, Array.Copy and generic type identity tests over List<T> and Dictionary, and the int[] to IList<uint> fix. It also marks the Unit Tests type and links a related issue. It is clearly related to the changeset.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Central YAML; Path: .coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 34975772-b969-4ae0-812c-8f8b63e8e443
Commits

Reviewing files that changed from the base of the PR and between 5416900 and 25aa50a.

Files selected for processing: 3

  • Tests/GenericCollections/ArrayGenericInterfaceTests.cs
  • Tests/GenericCollections/GenericCollections.nfproj
  • Tests/GenericCollections/VarianceTests.cs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@josesimoes

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@josesimoes

Copy link
Copy Markdown
Member Author

Unit tests failing as expected. Need new nanoclr.

@josesimoes

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@josesimoes

Copy link
Copy Markdown
Member Author

@nfbot updatedependencies develop

josesimoes and others added 3 commits November 23, 2026 18:39
- Add covariance, array view, `Array.Copy` and generic type identity tests over `List<T>` and `Dictionary`.
- Fix `int[]` is now an `IList<uint>`.

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
- Expect ArrayTypeMismatchException instead of Exception.
@sonarqubecloud

Copy link
Copy Markdown

@josesimoes
josesimoes merged commit a0145b5 into develop Nov 23, 2026
7 checks passed
@josesimoes
josesimoes deleted the add-variance-tests branch November 23, 2026 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants