diff options
Diffstat (limited to 'crates/hir_def/src')
-rw-r--r-- | crates/hir_def/src/body/lower.rs | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/crates/hir_def/src/body/lower.rs b/crates/hir_def/src/body/lower.rs index 1deaa90f2..cd7958746 100644 --- a/crates/hir_def/src/body/lower.rs +++ b/crates/hir_def/src/body/lower.rs | |||
@@ -953,18 +953,19 @@ impl From<ast::BinOp> for BinaryOp { | |||
953 | impl From<ast::LiteralKind> for Literal { | 953 | impl From<ast::LiteralKind> for Literal { |
954 | fn from(ast_lit_kind: ast::LiteralKind) -> Self { | 954 | fn from(ast_lit_kind: ast::LiteralKind) -> Self { |
955 | match ast_lit_kind { | 955 | match ast_lit_kind { |
956 | LiteralKind::IntNumber { suffix } => { | 956 | LiteralKind::IntNumber(lit) => { |
957 | let known_name = suffix.and_then(|it| BuiltinInt::from_suffix(&it)); | 957 | if let Some(float_suffix) = lit.suffix().and_then(BuiltinFloat::from_suffix) { |
958 | 958 | return Literal::Float(Default::default(), Some(float_suffix)); | |
959 | Literal::Int(Default::default(), known_name) | 959 | } |
960 | let ty = lit.suffix().and_then(|it| BuiltinInt::from_suffix(&it)); | ||
961 | Literal::Int(Default::default(), ty) | ||
960 | } | 962 | } |
961 | LiteralKind::FloatNumber { suffix } => { | 963 | LiteralKind::FloatNumber(lit) => { |
962 | let known_name = suffix.and_then(|it| BuiltinFloat::from_suffix(&it)); | 964 | let ty = lit.suffix().and_then(|it| BuiltinFloat::from_suffix(&it)); |
963 | 965 | Literal::Float(Default::default(), ty) | |
964 | Literal::Float(Default::default(), known_name) | ||
965 | } | 966 | } |
966 | LiteralKind::ByteString => Literal::ByteString(Default::default()), | 967 | LiteralKind::ByteString(_) => Literal::ByteString(Default::default()), |
967 | LiteralKind::String => Literal::String(Default::default()), | 968 | LiteralKind::String(_) => Literal::String(Default::default()), |
968 | LiteralKind::Byte => Literal::Int(Default::default(), Some(BuiltinInt::U8)), | 969 | LiteralKind::Byte => Literal::Int(Default::default(), Some(BuiltinInt::U8)), |
969 | LiteralKind::Bool(val) => Literal::Bool(val), | 970 | LiteralKind::Bool(val) => Literal::Bool(val), |
970 | LiteralKind::Char => Literal::Char(Default::default()), | 971 | LiteralKind::Char => Literal::Char(Default::default()), |