Skip to content

Add tests for casts to arrays of generic instances - #311

Merged
josesimoes merged 1 commit into
nanoframework:developfrom
josesimoes:array-argument-tests
Nov 24, 2026
Merged

josesimoes merged 1 commit into
nanoframework:developfrom
josesimoes:array-argument-tests

Conversation

@josesimoes

@josesimoes josesimoes commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Description

  • Tests for is, casts and T[] against type parameters bound to arrays of generic instances and to interfaces of them.

Motivation and Context

How Has This Been Tested?

  • [tested against nanoclr BuildId 68574]

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)
  • Dev Containers (changes related with Dev Containers, has no impact on code or features)
  • Dependencies/declarations (update dependencies or assembly declarations 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.

@nfbot nfbot left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

✅ The PR template looks good now. Thanks!

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Tests
    • Expanded coverage for type checks and casts involving arrays and nested generic types, including matching and mismatched values, invalid casts, and null values.
    • Added checks for behavior aligned with .NET 10.

The test project adds a suite for generic type checks and casts involving arrays and nested generic instances. The tests cover matching and mismatching types, null values, and direct casts.

Changes: Generic array reflection tests

Layer / File(s) Summary
Test fixtures and project inclusion
Tests/NFUnitTestSystemLibReflection3/UnitTestGenericArrayArgumentTests.cs, Tests/NFUnitTestSystemLibReflection3/NFUnitTestSystemLibReflection3.nfproj
The project includes the new test file. The file defines generic helper types and methods used by the tests.
Type checks and cast behavior
Tests/NFUnitTestSystemLibReflection3/UnitTestGenericArrayArgumentTests.cs
Tests cover method- and class-bound type parameters, nested array shapes, matching and mismatching types, null casts, and exact direct casts.

Estimated code review effort: 2 (Simple) | ~15 minutes

Change: Other

Possibly related PRs

Suggested labels: Type: Unit Tests

Merge Risk: Minimal · up to 96249

This change only adds tests for generic array type checks and casts, and it does not alter runtime behavior. The risk of merging is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "Add tests for casts to arrays of generic instances" matches the changeset, which adds UnitTestGenericArrayArgumentTests covering type checks and casts involving arrays of generic instances.…
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.
Description check Passed The description states the PR adds tests for is, casts, and T[] against type parameters bound to arrays of generic instances and their interfaces. This matches the changeset, which adds UnitTestGe…
Full details: Title check

Explanation

The title "Add tests for casts to arrays of generic instances" matches the changeset, which adds UnitTestGenericArrayArgumentTests covering type checks and casts involving arrays of generic instances. It is 50 characters, which meets the under-50-character guideline, has no PR or issue references, and does not end with a full stop.

Full details: Description check

Explanation

The description states the PR adds tests for is, casts, and T[] against type parameters bound to arrays of generic instances and their interfaces. This matches the changeset, which adds UnitTestGenericArrayArgumentTests.cs with tests for those cases and includes the project file change that compiles it. The description also names the related nf-interpreter fix and the checked type of tests, so it is specific enough to pass.

  • 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: 4b2666cc-2a6c-4a3c-84f3-c4d34e5cfa55
Commits

Reviewing files that changed from the base of the PR and between 6473369 and 96249e8.

Files selected for processing: 2

  • Tests/NFUnitTestSystemLibReflection3/NFUnitTestSystemLibReflection3.nfproj
  • Tests/NFUnitTestSystemLibReflection3/UnitTestGenericArrayArgumentTests.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.

@nfbot

nfbot commented Nov 24, 2026

Copy link
Copy Markdown
Member

⚠️ Native declaration update required!

The native contract hash of nanoFramework.CoreLibrary has changed. The native declaration in nf-interpreter must be updated before this package can be released.

Previously published This build
Native contract hash 0x940E6E23 0x272B0DC7

👉 Tracking issue: nanoframework/Home#1957

The issue contains a link to the stubs artifact from this build and instructions for GitHub Copilot to perform the update.

@josesimoes

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 24, 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.

- Add tests for type parameters bound to arrays of generic instances.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@josesimoes

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

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

@sonarqubecloud

Copy link
Copy Markdown

@josesimoes
josesimoes merged commit ff0f3b5 into nanoframework:develop Nov 24, 2026
7 checks passed
@josesimoes
josesimoes deleted the array-argument-tests branch November 24, 2026 14:50
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