From e51d72b318a762a6e077b7e3d1db9f1996052651 Mon Sep 17 00:00:00 2001 From: xunilrj Date: Thu, 7 Sep 2023 11:31:25 +0100 Subject: [PATCH] fix string literal length --- .../ast_node/expression/intrinsic_function.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/sway-core/src/semantic_analysis/ast_node/expression/intrinsic_function.rs b/sway-core/src/semantic_analysis/ast_node/expression/intrinsic_function.rs index f6cdc1bc87e..817f9c94d3e 100644 --- a/sway-core/src/semantic_analysis/ast_node/expression/intrinsic_function.rs +++ b/sway-core/src/semantic_analysis/ast_node/expression/intrinsic_function.rs @@ -356,11 +356,7 @@ fn type_check_to_str_array( match &arg.kind { ExpressionKind::Literal(Literal::String(s)) => { - let literal_length = s - .as_str() - .len() - .checked_sub(2) - .expect("unexpected string literal with less than 2 characters"); + let literal_length = s.as_str().len(); let l = Length::new(literal_length, s.clone()); let t = TypeInfo::StringArray(l);