Commit graph

83 commits

Author SHA1 Message Date
Florian Diebold
4142792d1f Add more docs in ty.rs
Also get rid of the indirection through query_definitions for the type-related
queries.
2018-12-29 20:27:13 +01:00
Florian Diebold
b1590bdf6a Missing return type means unit, not unknown 2018-12-29 12:08:57 +01:00
Florian Diebold
cfa1de72eb Implement type variables
This will really become necessary when we implement generics, but even now, it
allows us to reason 'backwards' to infer types of expressions that we didn't
understand for some reason.

We use ena, the union-find implementation extracted from rustc, to keep track of
type variables.
2018-12-29 12:04:34 +01:00
Aleksey Kladov
7928995876 nameify structs&enums 2018-12-28 21:34:58 +03:00
Aleksey Kladov
11122e29b7 completion for enum variants 2018-12-28 21:07:47 +03:00
Aleksey Kladov
1a860dba38 simplify 2018-12-28 20:45:58 +03:00
Aleksey Kladov
13631a2955 ⬆️ salsa 2018-12-28 19:10:31 +03:00
Aleksey Kladov
dddbac6877 remove FnId 2018-12-27 23:51:44 +03:00
Aleksey Kladov
e066050671 use names everywhere 2018-12-27 21:21:10 +03:00
Aleksey Kladov
63f54d234f dont leak Name details in testing 2018-12-27 21:02:08 +03:00
Aleksey Kladov
a9f55029b9 introduce known names 2018-12-27 20:26:15 +03:00
Aleksey Kladov
d963042ca9 introduce hir::Name 2018-12-27 20:07:21 +03:00
Aleksey Kladov
e4de2c8d7f add function to completion ctx 2018-12-27 17:33:52 +03:00
dependabot[bot]
4017966a0b
Bump parking_lot from 0.6.4 to 0.7.0
Bumps [parking_lot](https://github.com/Amanieu/parking_lot) from 0.6.4 to 0.7.0.
- [Release notes](https://github.com/Amanieu/parking_lot/releases)
- [Changelog](https://github.com/Amanieu/parking_lot/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Amanieu/parking_lot/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-27 13:14:24 +00:00
dependabot[bot]
6fb53caea5
Bump arrayvec from 0.4.9 to 0.4.10
Bumps [arrayvec](https://github.com/bluss/arrayvec) from 0.4.9 to 0.4.10.
- [Release notes](https://github.com/bluss/arrayvec/releases)
- [Commits](https://github.com/bluss/arrayvec/compare/0.4.9...0.4.10)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-27 12:32:18 +00:00
Florian Diebold
bc745a1396 Resolve field types lazily
I.e. not already when getting the HIR for the struct.
2018-12-25 21:40:33 +01:00
Florian Diebold
cdca397061 Add a hir::TypeRef as an intermediate between ast::TypeRef and ty::Ty 2018-12-25 21:14:13 +01:00
Florian Diebold
2870effd5c Implement reference / pointer types
- parse them
 - infer types of & and * expressions
2018-12-25 20:36:06 +01:00
Florian Diebold
b96d361239 Handle structs/enums with missing names a bit better 2018-12-25 17:55:50 +01:00
Florian Diebold
3befd1a9e8 Cleanup 2018-12-25 15:44:10 +01:00
Florian Diebold
ab0b63992b Implement basic completion for fields 2018-12-25 15:27:15 +01:00
Florian Diebold
55c941cd9f Type field accesses 2018-12-25 15:16:42 +01:00
Florian Diebold
07a7285965 Collect field data for structs/enum variants 2018-12-25 15:16:42 +01:00
Florian Diebold
6fcd38cc81 Infer result of struct literals, and recurse into their child expressions 2018-12-25 15:16:42 +01:00
Florian Diebold
4ff1618520 Do name resolution by namespace (types/values) 2018-12-25 15:16:42 +01:00
Florian Diebold
b5b68f2094 Add basic HIR and types for structs/enums 2018-12-25 15:16:42 +01:00
Florian Diebold
4befde1eee Change inference tests to have one per file 2018-12-24 15:36:54 +01:00
Florian Diebold
655f5bc261 Rename a variable for consistency 2018-12-24 15:19:49 +01:00
Florian Diebold
76fb05d91d Clean up Ty a bit
Removing irrelevant comments copied from rustc etc.
2018-12-24 15:18:37 +01:00
Florian Diebold
a1d0b5bc3c Prepare Ty::new for resolution 2018-12-23 17:49:30 +01:00
Florian Diebold
c85748f5fb Type the return values of call expressions 2018-12-23 17:29:03 +01:00
Florian Diebold
ef67581104 Resolve paths to defs (functions currently) during type inference 2018-12-23 17:13:11 +01:00
Florian Diebold
93ffbf80c6 Make let statements kind of work 2018-12-23 14:01:50 +01:00
Florian Diebold
5d60937090 Remove unwraps 2018-12-23 13:48:04 +01:00
Florian Diebold
b4139d54fc Get rid of the terrible nesting in PathExpr inference 2018-12-23 13:48:04 +01:00
Florian Diebold
515c3bc59b Cleanup 2018-12-23 13:48:04 +01:00
Florian Diebold
7348f7883f Add testing infrastructure for type inference
- move dir_tests to test_utils for that.
2018-12-23 13:48:04 +01:00
Florian Diebold
3899898d75 Parse integer / float types 2018-12-23 13:48:04 +01:00
Florian Diebold
3ac605e687 Add beginnings of type infrastructure 2018-12-23 13:48:04 +01:00
Aleksey Kladov
49e746b010 completion uses hir scopes 2018-12-22 11:01:03 +03:00
bors[bot]
4e4ca27eab Merge #319
319: Completion icons r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-12-21 23:28:47 +00:00
Aleksey Kladov
8e056ef042 debug pring 2018-12-22 02:23:25 +03:00
Aleksey Kladov
97cb463c9b moar icons 2018-12-22 02:20:14 +03:00
bors[bot]
e4d0930d9c Merge #316
316: Fix handling of nested self in paths r=matklad a=DJMcNab

See https://github.com/rust-analyzer/rust-analyzer/issues/231#issuecomment-442449505.

Co-authored-by: DJMcNab <36049421+djmcnab@users.noreply.github.com>
2018-12-21 23:19:14 +00:00
DJMcNab
bb1ee2f13a Move the self handling from directly inside the loop 2018-12-21 23:01:16 +00:00
Aleksey Kladov
f1f2804c71 move completion items to conv 2018-12-22 01:59:32 +03:00
DJMcNab
d8d60215da Fix handling of nested self in paths 2018-12-21 22:29:59 +00:00
Aleksey Kladov
ccca5aae43 scope-based copmletions on original file 2018-12-22 00:52:02 +03:00
Aleksey Kladov
fd927ea3a9 use root-relative paths 2018-12-21 12:30:28 +03:00
Aleksey Kladov
2d4582bfc6 fixme comment 2018-12-20 12:15:38 +03:00