summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2024-04-28 20:42:15 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2024-04-28 20:42:15 +0200
commit5d1fbc20691354f54cf4943631326773ccb48644 (patch)
treeeaa418a64a580f6f90c12a8dfc5b02813f92884e
parent89f2dce6f163e20f198667e3eddcc668b10545e6 (diff)
downloadrebel-5d1fbc20691354f54cf4943631326773ccb48644.tar
rebel-5d1fbc20691354f54cf4943631326773ccb48644.zip
rebel-lang: typing: rename Coerce::Dynamic to Compare
Compare conveys what this Coercion mode is used for more accurately.
-rw-r--r--crates/rebel-lang/src/typing.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/rebel-lang/src/typing.rs b/crates/rebel-lang/src/typing.rs
index 2a0a4ec..48886ec 100644
--- a/crates/rebel-lang/src/typing.rs
+++ b/crates/rebel-lang/src/typing.rs
@@ -15,7 +15,7 @@ pub type Result<T> = std::result::Result<T, TypeError>;
pub enum Coerce {
None,
Common,
- Dynamic,
+ Compare,
Assign,
}
@@ -134,7 +134,7 @@ impl Type {
),
(Int, Sub, Int) => Int,
(Array(t1, _), Sub, Array(t2, _)) => {
- (*t1).clone().unify(*t2, Coerce::Dynamic)?;
+ (*t1).clone().unify(*t2, Coerce::Compare)?;
Array(t1, ArrayLen::Dynamic)
}
(Int, Mul, Int) => Int,
@@ -143,11 +143,11 @@ impl Type {
(Bool, And, Bool) => Bool,
(Bool, Or, Bool) => Bool,
(l, Eq, r) => {
- l.unify(r, Coerce::Dynamic)?;
+ l.unify(r, Coerce::Compare)?;
Bool
}
(l, Ne, r) => {
- l.unify(r, Coerce::Dynamic)?;
+ l.unify(r, Coerce::Compare)?;
Bool
}
(Int, Lt, Int) => Bool,
@@ -380,8 +380,8 @@ impl ArrayLen {
(len, Free, _) => len,
(l1, l2, _) if l1 == l2 => l1,
(_, _, Coerce::Common) => Dynamic,
- (Dynamic, Fixed(_), Coerce::Dynamic | Coerce::Assign) => Dynamic,
- (Fixed(_), Dynamic, Coerce::Dynamic) => Dynamic,
+ (Dynamic, Fixed(_), Coerce::Compare | Coerce::Assign) => Dynamic,
+ (Fixed(_), Dynamic, Coerce::Compare) => Dynamic,
_ => return Err(TypeError),
})
}