diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-03-22 12:27:54 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-03-22 12:27:54 +0000 |
commit | 6bc09e2ff82c588d3923aed3fe3c869e8aa70dc1 (patch) | |
tree | e8682a3f3a5017932dd31decc979daca7d9a2daa /crates/ra_hir/src/ty/lower.rs | |
parent | 2a6544f906818263e2791bc4cdf4fcbdf7260ab9 (diff) | |
parent | 504c8c7c2e371f2adccbc292ad09af2b31e05787 (diff) |
Merge #1015
1015: Change primitive integers to have signedness and bitness r=matklad a=yanchith
Fixes #1004
This creates enums: `Signedness`, `IntBitness` and `FloatBitness`, and condenses `UintTy` with `IntTy`, making use of the created enums. `FloatTy` is also changed from an enum into a struct containing `FloatBitness`.
`UncertainIntTy` and `UncertainFloatTy` now look much more similar.
`Ord` was removed from the types because `{u,i}size` aren't easily orderable with the rest. Fortunately this wasn't depended on anywhere.
Co-authored-by: yanchith <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/ty/lower.rs')
-rw-r--r-- | crates/ra_hir/src/ty/lower.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs index 72b1234bf..7f9af307b 100644 --- a/crates/ra_hir/src/ty/lower.rs +++ b/crates/ra_hir/src/ty/lower.rs | |||
@@ -61,10 +61,10 @@ impl Ty { | |||
61 | pub(crate) fn from_hir_path(db: &impl HirDatabase, resolver: &Resolver, path: &Path) -> Self { | 61 | pub(crate) fn from_hir_path(db: &impl HirDatabase, resolver: &Resolver, path: &Path) -> Self { |
62 | if let Some(name) = path.as_ident() { | 62 | if let Some(name) = path.as_ident() { |
63 | // TODO handle primitive type names in resolver as well? | 63 | // TODO handle primitive type names in resolver as well? |
64 | if let Some(int_ty) = primitive::UncertainIntTy::from_type_name(name) { | 64 | if let Some(int_ty) = primitive::IntTy::from_type_name(name) { |
65 | return Ty::simple(TypeCtor::Int(int_ty)); | 65 | return Ty::simple(TypeCtor::Int(primitive::UncertainIntTy::Known(int_ty))); |
66 | } else if let Some(float_ty) = primitive::UncertainFloatTy::from_type_name(name) { | 66 | } else if let Some(float_ty) = primitive::FloatTy::from_type_name(name) { |
67 | return Ty::simple(TypeCtor::Float(float_ty)); | 67 | return Ty::simple(TypeCtor::Float(primitive::UncertainFloatTy::Known(float_ty))); |
68 | } else if let Some(known) = name.as_known_name() { | 68 | } else if let Some(known) = name.as_known_name() { |
69 | match known { | 69 | match known { |
70 | KnownName::Bool => return Ty::simple(TypeCtor::Bool), | 70 | KnownName::Bool => return Ty::simple(TypeCtor::Bool), |