Skip to content

Conversation

@konard
Copy link
Member

@konard konard commented Sep 14, 2025

Summary

  • Added comprehensive test cases for nullable numeric types (int?, double?, bool?) to verify they are correctly marked as CanBeNumeric
  • Verified that the existing implementation already handles nullable numeric types correctly
  • The NumericType<T> class properly extracts the underlying type for nullable types and checks if that type can be numeric

Test plan

  • Added unit tests for nullable numeric types in NumericTypeTests.cs
  • Verified all existing tests still pass (12 total tests)
  • Created experimental code to demonstrate the functionality works as expected
  • Confirmed nullable numeric types (int?, double?, etc.) return CanBeNumeric: True
  • Confirmed non-numeric nullable types (string?) return CanBeNumeric: False

Analysis

The issue was already resolved in the current implementation. The NumericType<T> constructor correctly:

  1. Detects if a type is nullable using type.IsNullable()
  2. Extracts the underlying type using Nullable.GetUnderlyingType(type)
  3. Checks if the underlying type can be numeric using underlyingType.CanBeNumeric()

This means int? becomes int, double? becomes double, and so on, and since these underlying types are numeric, the nullable versions are correctly marked as CanBeNumeric.

Fixes #22

🤖 Generated with Claude Code

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #22
@konard konard self-assigned this Sep 14, 2025
- Added test cases for int?, double?, and bool? to verify they are correctly marked as CanBeNumeric
- Verified existing implementation already handles nullable numeric types correctly
- Added experiment code to demonstrate the functionality

Fixes #22

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Mark Nullable numeric types as CanBeNumeric Add tests for nullable numeric types CanBeNumeric property Sep 14, 2025
@konard konard marked this pull request as ready for review September 14, 2025 07:27
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.

Mark Nullable numeric types as CanBeNumeric

2 participants