Skip to content

Commit b2044d8

Browse files
authored
fix: Text cannot be casted at all (#832)
1 parent 1ff3ed0 commit b2044d8

File tree

1 file changed

+3
-4
lines changed
  • src/modules/expression/typeop

1 file changed

+3
-4
lines changed

src/modules/expression/typeop/cast.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl SyntaxModule<ParserMetadata> for Cast {
5151
impl TypeCheckModule for Cast {
5252
fn typecheck(&mut self, meta: &mut ParserMetadata) -> SyntaxResult {
5353
self.expr.typecheck(meta)?;
54-
54+
5555
let begin = meta.get_token_at(self.expr.pos.0);
5656
let end = meta.get_current_token();
5757
let pos = PositionInfo::from_between_tokens(meta, begin, end);
@@ -60,7 +60,7 @@ impl TypeCheckModule for Cast {
6060
let l_type = self.expr.get_type();
6161
let r_type = self.kind.clone();
6262
let message = Message::new_warn_at_position(meta, pos)
63-
.message(format!("Casting a value of type '{l_type}' value to a '{r_type}' is not recommended"))
63+
.message(format!("Casting a value of type '{l_type}' to '{r_type}' is not recommended"))
6464
.comment(format!("To suppress this warning, use '{flag_name}' compiler flag"));
6565
match (l_type, r_type) {
6666
(Type::Array(left), Type::Array(right)) => {
@@ -69,8 +69,7 @@ impl TypeCheckModule for Cast {
6969
}
7070
},
7171
(Type::Array(_) | Type::Null, Type::Array(_) | Type::Null) => meta.add_message(message),
72-
(Type::Text, Type::Num) => { meta.add_message(message) },
73-
(Type::Text, Type::Bool) => { meta.add_message(message) },
72+
(Type::Text, _) => { meta.add_message(message) },
7473
_ => {}
7574
}
7675
}

0 commit comments

Comments
 (0)