Commit graph

66 commits

Author SHA1 Message Date
Marcus Klaas de Vries
3340807bd2 Get basic struct pattern type inference working! 2019-01-19 15:37:25 +03:00
Marcus Klaas de Vries
9c2d83a4c8 Add crude implementation of tuplestruct pattern inference 2019-01-19 15:37:25 +03:00
Marcus Klaas de Vries
3b0de53904 Work on type inference for ADT patterns 2019-01-19 15:37:25 +03:00
Marcus Klaas de Vries
5648dcd36e Implement type inference for tuples and refs 2019-01-19 15:37:25 +03:00
Marcus Klaas de Vries
afaa26636e Add additional pattern variants 2019-01-19 15:37:25 +03:00
Aleksey Kladov
a2ca03d10b ⬆️ salsa 2019-01-17 14:11:00 +03:00
Hirokazu Hata
0aedd4fb2f Add Ty::Array to walk_mut 2019-01-17 00:08:53 +09:00
Hirokazu Hata
f66ca1bd2e Fix test case invalid syntax 2019-01-16 23:39:14 +09:00
Hirokazu Hata
478ce1c8b5 Fix infer array test 2019-01-16 23:37:42 +09:00
Hirokazu Hata
2a3262c757 Add infer array test 2019-01-16 23:35:06 +09:00
Marcus Klaas de Vries
a2b6d3da30 Implement rudimentary type inference for unary operators 2019-01-16 00:04:39 +01:00
Aleksey Kladov
8ba9c2d4ce remove Cancelable from type inference 2019-01-15 20:54:18 +03:00
Aleksey Kladov
b871062e32 remove Cancelable from Ty 2019-01-15 20:43:37 +03:00
Aleksey Kladov
fafcd103d2 remove Cancelable from ids 2019-01-15 19:18:52 +03:00
Aleksey Kladov
18e9a710cd remove Cancelable from fn_scopes 2019-01-15 19:04:49 +03:00
Aleksey Kladov
8af9a18660 remove Cancelable from Crate API 2019-01-15 18:33:26 +03:00
Aleksey Kladov
c159e414b4 remove Cancelable from Module API, part 2 2019-01-15 18:30:58 +03:00
Aleksey Kladov
11f3c8afb2 remove Cancelable from source binders 2019-01-15 18:13:49 +03:00
Marcus Klaas de Vries
d67eabb512 Fix type inference for raw (byte) strings 2019-01-14 20:56:14 +01:00
Marcus Klaas de Vries
a9a6a50c75 Fixup tests 2019-01-14 19:30:21 +01:00
Marcus Klaas de Vries
81bc8e4973 don't try to treat arrays and tuples as literals 2019-01-14 13:55:49 +01:00
Marcus Klaas de Vries
1574715be5 Use type variables to determine exact type for ambiguous numeric literals 2019-01-14 13:54:31 +01:00
Marcus Klaas de Vries
5f5dc20d85 Try implementing integer type inference (WIP) 2019-01-14 13:52:57 +01:00
Marcus Klaas de Vries
a6146d35b1 Implement type inference for literals (WIP) 2019-01-14 13:52:55 +01:00
Hirokazu Hata
139da0841d Fix tuple test case 2019-01-13 22:23:06 +09:00
Hirokazu Hata
829f668bd7 Add infer tuple test 2019-01-13 21:04:03 +09:00
Florian Diebold
1ed7fbfc1b args -> params 2019-01-12 21:58:16 +01:00
Florian Diebold
5db5f5cc1d Small improvements from review comments 2019-01-12 21:51:56 +01:00
Florian Diebold
082ef52bcb Implement basic inherent method resolution 2019-01-12 15:01:19 +01:00
Florian Diebold
1212e59bee Fix assertion error in unification (hopefully)
Currently, all types that we handle during inference need to be resolved as far
as possible at the time. It's maybe too brittle of an invariant; I need to think
how we can do this better. This should fix #484 though, I hope (if
it's the same case as I managed to reproduce).
2019-01-11 22:59:00 +01:00
Marcus Klaas de Vries
978de5cf8b Implement type inference for enum variants 2019-01-10 14:32:56 +01:00
Aleksey Kladov
e8815b614e nicer trailing comma handling in types 2019-01-09 19:14:21 +03:00
Marcus Klaas de Vries
0b8fbb4fad Fix typos in ARCHITECTURE.md and a number of crates
specifically: gen_lsp_server, ra_arena, ra_cli, ra_db, ra_hir
2019-01-09 01:17:09 +01:00
Marcus Klaas de Vries
e51d44a2de Process explicit type hints for str, bool and char 2019-01-07 20:43:41 +01:00
Marcus Klaas de Vries
5d15dd70b0 Tidy up binary operator type inference; add test file 2019-01-07 20:39:23 +01:00
Marcus Klaas de Vries
7b0eaef580 Implement type inference for more binary operators
Mostly just for primitive numeric types such as u32 and f64. Not
yet a general solution using trait resolution.
2019-01-07 20:11:31 +01:00
Florian Diebold
7bb279b365 Implement autoderef for field accesses 2019-01-07 14:54:23 +01:00
Florian Diebold
d618b1f2ce if let -> match 2019-01-07 01:10:29 +01:00
Florian Diebold
71f7d82e45 Introduce ArenaMap 2019-01-07 00:05:19 +01:00
Florian Diebold
cf49a11263 Sort ranges in type inference tests
Also rename the files to remove the numbers (they don't serve a purpose now that
there are only the data files).
2019-01-07 00:05:19 +01:00
Florian Diebold
6210e82041 Use HIR Expr for type inference
Now we can reuse the type inference inside a function when typing whitespace
etc. :)
2019-01-07 00:05:19 +01:00
bors[bot]
31c1999505 Merge #440
440: Implement type inference for boolean operators r=flodiebold a=marcusklaas

Tried implementing the easiest part of https://github.com/rust-analyzer/rust-analyzer/issues/390. Hope this is somewhat close to what the intent of the issue was. Found it surprisingly easy to find my way around the repository - it's well organized!

Very grateful for any pointers.

Co-authored-by: Marcus Klaas de Vries <mail@marcusklaas.nl>
2019-01-06 21:28:36 +00:00
Marcus Klaas de Vries
82d9a77dad Touch up type inference for boolean operators
Also try to infer its subexpressions and set type expectations
whenever possible.
2019-01-06 22:17:54 +01:00
Florian Diebold
a6f33b4ca5 Add test for invalidation of inferred types when typing inside function
This currently fails, but should work once we have hir::Expr.
2019-01-05 22:41:12 +01:00
Marcus Klaas de Vries
4fc233a02e Implement type inference for boolean operators 2019-01-05 21:28:30 +01:00
Florian Diebold
538147bf94 Resolve the Self type 2019-01-04 19:13:50 +01:00
Florian Diebold
d4db61b9a1 Resolve the self parameter during type inference 2019-01-04 19:12:29 +01:00
Florian Diebold
111126ed3c Type the self parameter 2019-01-04 19:10:50 +01:00
Florian Diebold
226e31dae9 Add test for self type inference 2019-01-04 18:28:43 +01:00
Florian Diebold
b1590bdf6a Missing return type means unit, not unknown 2018-12-29 12:08:57 +01:00