Skip to content

Add parse/stringify round-trip test for TypeCast#992

Merged
inducer merged 3 commits intoparse_type_castfrom
copilot/sub-pr-991
Mar 21, 2026
Merged

Add parse/stringify round-trip test for TypeCast#992
inducer merged 3 commits intoparse_type_castfrom
copilot/sub-pr-991

Conversation

Copy link
Contributor

Copilot AI commented Mar 21, 2026

lp.TypeCast lacked a test verifying that stringification and re-parsing produce an identical expression.

Changes

  • New test test_type_cast_parse_stringify_roundtrip: Creates a TypeCast expression, stringifies it via loopy's StringifyMapper, parses the result, and asserts equality.
expr = lp.TypeCast(np.float64, parse("x[i]"))
stringified = StringifyMapper()(expr)
# → "cast(np:dtype('float64'), x[i])"
parsed = parse(stringified)
assert expr == parsed

⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.

Copilot AI self-assigned this Mar 21, 2026
Copilot AI and others added 2 commits March 21, 2026 19:00
Copilot AI changed the title [WIP] Add test for parse and stringification round-trip for cast Add parse/stringify round-trip test for TypeCast Mar 21, 2026
Copilot AI requested a review from inducer March 21, 2026 19:02
@inducer inducer marked this pull request as ready for review March 21, 2026 21:10
Copilot AI review requested due to automatic review settings March 21, 2026 21:10
@inducer inducer merged commit fb5c6b2 into parse_type_cast Mar 21, 2026
18 checks passed
@inducer inducer deleted the copilot/sub-pr-991 branch March 21, 2026 21:10
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

Adds a regression test to ensure lp.TypeCast expressions can be stringified via Loopy’s StringifyMapper, parsed back, and remain structurally identical—guarding against future stringify/parser drift in Loopy’s symbolic layer.

Changes:

  • Add test_type_cast_parse_stringify_roundtrip to validate TypeCast stringify→parse round-trip equality.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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