From d5d485ef9289589332893f2c0ad96cb366afe9d6 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 28 Jun 2020 21:17:27 +0200 Subject: Implement Chalk variable kinds This means we need to keep track of the kinds (general/int/float) of variables in `Canonical`, which requires some more ceremony. (It also exposes some places where we're not really dealing with canonicalization correctly -- another thing to be cleaned up when we switch to using Chalk's types directly.) Should fix the last remaining issue of #2534. --- crates/ra_hir_ty/src/tests/traits.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'crates/ra_hir_ty/src/tests/traits.rs') diff --git a/crates/ra_hir_ty/src/tests/traits.rs b/crates/ra_hir_ty/src/tests/traits.rs index 01c919a7e..766790576 100644 --- a/crates/ra_hir_ty/src/tests/traits.rs +++ b/crates/ra_hir_ty/src/tests/traits.rs @@ -3029,3 +3029,21 @@ fn infer_dyn_fn_output() { "### ); } + +#[test] +fn variable_kinds() { + check_types( + r#" +trait Trait { fn get(self, t: T) -> T; } +struct S; +impl Trait for S {} +impl Trait for S {} +fn test() { + S.get(1); + //^^^^^^^^ u128 + S.get(1.); + //^^^^^^^^ f32 +} + "#, + ); +} -- cgit v1.2.3