From d3fb1dd105a9673d735220b9436d7f51c4e2353f Mon Sep 17 00:00:00 2001 From: acassimiro Date: Thu, 5 Sep 2024 10:39:20 -0300 Subject: [PATCH] Fixing missing implicitCast rule --- rust-semantics/expression/casts.md | 2 ++ rust-semantics/preprocessing/constants.md | 10 +++++----- rust-semantics/representation.md | 2 ++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/rust-semantics/expression/casts.md b/rust-semantics/expression/casts.md index ebbd293..5ffd642 100644 --- a/rust-semantics/expression/casts.md +++ b/rust-semantics/expression/casts.md @@ -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) diff --git a/rust-semantics/preprocessing/constants.md b/rust-semantics/preprocessing/constants.md index 788e33d..9d3edf5 100644 --- a/rust-semantics/preprocessing/constants.md +++ b/rust-semantics/preprocessing/constants.md @@ -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 diff --git a/rust-semantics/representation.md b/rust-semantics/representation.md index 5f6f4e9..8dedb5c 100644 --- a/rust-semantics/representation.md +++ b/rust-semantics/representation.md @@ -59,6 +59,8 @@ module RUST-REPRESENTATION | "u32" [token] | "i64" [token] | "u64" [token] + | "bool" [token] + syntax MaybeIdentifier ::= ".Identifier" | Identifier endmodule