Skip to content

Commit

Permalink
Fixing missing implicitCast rule
Browse files Browse the repository at this point in the history
  • Loading branch information
ACassimiro committed Sep 5, 2024
1 parent 39ccfe6 commit d3fb1dd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 2 additions & 0 deletions rust-semantics/expression/casts.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ module RUST-CASTS
rule implicitCast(u128(Value), i64) => i64(Int2MInt(MInt2Unsigned(Value)))
rule implicitCast(u128(Value), u64) => u64(Int2MInt(MInt2Unsigned(Value)))
rule implicitCast(V:Bool, bool) => V
// Rewrites
rule V:Value ~> implicitCastTo(T:Type) => implicitCast(V, T)
Expand Down
10 changes: 5 additions & 5 deletions rust-semantics/preprocessing/constants.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ module RUST-CONSTANTS
rule
(const Name:Identifier : T:Type = V:Value;):ConstantItem:KItem
=> setConstant(Name, implicitCast(V, T)) [priority(100)]
rule
(const Name:Identifier : _:Type = V:Bool;):ConstantItem:KItem
=> setConstant(Name, V) [priority(50)]
=> setConstant(Name, implicitCast(V, T))
// rule
// (const Name:Identifier : _:Type = V:Bool;):ConstantItem:KItem
// => setConstant(Name, V) [priority(50)]
rule
<k>
Expand Down
2 changes: 2 additions & 0 deletions rust-semantics/representation.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ module RUST-REPRESENTATION
| "u32" [token]
| "i64" [token]
| "u64" [token]
| "bool" [token]
syntax MaybeIdentifier ::= ".Identifier" | Identifier
endmodule
Expand Down

0 comments on commit d3fb1dd

Please sign in to comment.