Skip to content

Conversation

@TheVeryDarkness
Copy link
Collaborator

An integer literal without suffix now can be matched with any constants with the same mathematical value.

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

This PR introduces a new IntTy::AnyInt variant to represent integer literals without a type suffix, enabling them to match MIR constants with any integer type that has the same mathematical value. Previously, unsuffixed integer literals defaulted to Usize, but with this change they can match both signed and unsigned integer types.

Changes:

  • Added IntTy::AnyInt enum variant for unsuffixed integer literals
  • Updated integer matching logic to accept AnyInt with any signed or unsigned integer type
  • Modified normalization and pretty-printing to handle AnyInt appropriately

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
crates/rpl_context/src/pat/ty.rs Adds AnyInt variant to IntTy enum; updates from_integer to return AnyInt for unsuffixed literals; modifies normalize to handle AnyInt by returning value unchanged
crates/rpl_match/src/statement.rs Updates constant matching logic to accept AnyInt patterns matching any Int or Uint MIR type
crates/rpl_context/src/pat/pretty.rs Implements Debug formatting for AnyInt to display integer value without type suffix

💡 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.

1 participant