Skip to content

[eudsl-python-extras] Implement generic type parameter validation#456

Merged
makslevental merged 1 commit into
mainfrom
users/makslevental/fix-generics-type-checking
Jun 28, 2026
Merged

[eudsl-python-extras] Implement generic type parameter validation#456
makslevental merged 1 commit into
mainfrom
users/makslevental/fix-generics-type-checking

Conversation

@makslevental

Copy link
Copy Markdown
Contributor

Summary

  • Implement type checking in ReifiedTypeParam (resolves the TODO at line 205).
  • When type_var_bound is "type", validates the concrete value is an MLIR Type instance.
  • For other bounds (e.g., "MemRefType"), rejects non-Type values like plain ints.
  • Change test from @pytest.mark.xfail to pytest.raises(TypeError).

Test plan

  • pytest tests/test_generics.py::test_wrong_generics_types -xvs passes (raises TypeError)
  • All 23 generics tests pass (no regression)

@makslevental makslevental force-pushed the users/makslevental/fix-generics-type-checking branch 3 times, most recently from 0904f25 to ab5e768 Compare June 28, 2026 06:23
Add type checking in ReifiedTypeParam to validate that concrete values
match their type bounds. When type_var_bound is "type", checks that the
value is an MLIR Type instance. For other bounds (e.g., "MemRefType"),
checks that non-Type values are rejected.

This catches errors like passing an int where a MemRefType is expected.
@makslevental makslevental force-pushed the users/makslevental/fix-generics-type-checking branch from ab5e768 to b017892 Compare June 28, 2026 06:23
@makslevental makslevental merged commit 8d031aa into main Jun 28, 2026
20 checks passed
@makslevental makslevental deleted the users/makslevental/fix-generics-type-checking branch June 28, 2026 06:26
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.

1 participant