Commit graph

124 commits

Author SHA1 Message Date
Aleksey Kladov
8c4d277036 switch source-binders to Module 2019-01-06 17:35:29 +03:00
Aleksey Kladov
147b0f94e6 Start code_model::Module 2019-01-06 17:35:29 +03:00
Aleksey Kladov
9a820dc0ee move crate to code_model_api 2019-01-06 17:35:29 +03:00
Florian Diebold
98957f4e6f Add fn signature query 2019-01-06 01:13:31 +01:00
Florian Diebold
e5a6cf8153 Various small code review improvements 2019-01-06 00:38:08 +01:00
Florian Diebold
8e3e5ab2c8 Make FnScopes use hir::Expr
This was a bit complicated. I've added a wrapper type for now that does the
LocalSyntaxPtr <-> ExprId translation; we might want to get rid of that or give
it a nicer interface.
2019-01-06 00:29:36 +01:00
Florian Diebold
136aba1cf3 Add HIR Expr machinery 2019-01-05 22:41:12 +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
Florian Diebold
e6aeabf96f Rename ImplsInCrateQuery as well 2019-01-04 19:52:07 +01:00
Florian Diebold
443ddb73c3 Do impl collection per module, not per crate 2019-01-04 19:29:53 +01:00
Florian Diebold
334ca0d9a7 Rename ImplBlock::target -> target_type, and add target_trait already 2019-01-04 19:16:39 +01:00
Florian Diebold
6ab0e292d2 Refactor a bit 2019-01-04 19:14:22 +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
ae9530addc Add HIR for impl blocks
Since we need to be able to go from def to containing impl block, as well as the
other direction, and to find all impls for a certain type, a design similar to
the one for modules, where we collect all impls for the whole crate and keep
them in an arena, seemed fitting. The ImplBlock type, which provides the public
interface, then consists only of an Arc to the arena containing all impls, and
the index into it.
2019-01-04 19:10:47 +01:00
Florian Diebold
226e31dae9 Add test for self type inference 2019-01-04 18:28:43 +01:00
Florian Diebold
fe6c4115f6 Rename ImplItem to ImplBlock
rustc uses the name ImplItem for items in impls, not the impl {} block itself,
which could lead to confusion.
2019-01-04 18:28:36 +01:00
Aleksey Kladov
3fe6f422f9 remove id arena 2019-01-04 16:58:10 +03:00
Aleksey Kladov
d61707b4e1 index stuff produced by macros 2019-01-03 21:29:17 +03:00
Aleksey Kladov
3e764f97eb hardcode vec macro 2019-01-03 14:48:23 +03:00
Aleksey Kladov
28f6eedba5 simplify runnables 2019-01-02 20:12:38 +03:00
Aleksey Kladov
1076e82856 small rename 2019-01-02 16:00:35 +03:00
Aleksey Kladov
35b3fc02e0 comments 2019-01-02 16:00:01 +03:00
Aleksey Kladov
4fe0ec5497 rename 2019-01-02 12:49:47 +03:00
Aleksey Kladov
db8d293208 move macro id to ids 2019-01-02 00:37:36 +03:00
Aleksey Kladov
42cc77703b move more stuff to ids 2019-01-02 00:30:00 +03:00
Aleksey Kladov
37ed2f35ba rename MFileId -> HirFileId 2019-01-02 00:09:54 +03:00
Aleksey Kladov
9c65e61849 introduce ids module 2019-01-01 22:47:10 +03:00
Aleksey Kladov
fca1422ea3 add tests for macro generated items 2019-01-01 22:15:35 +03:00
Aleksey Kladov
756e878158 add items from macros to modules 2019-01-01 22:15:35 +03:00
Aleksey Kladov
4a3f76d3bb wip 2019-01-01 22:15:35 +03:00
Aleksey Kladov
f8d419ee89 fix tests 2019-01-01 22:15:35 +03:00
Aleksey Kladov
289391e163 use MFile 2019-01-01 22:15:35 +03:00
Aleksey Kladov
4161466918 introduce MFileId 2019-01-01 22:15:35 +03:00
Aleksey Kladov
9d4af40995 work towards brining macros to nameres 2019-01-01 22:15:35 +03:00
Aleksey Kladov
7dc45745a3 save top-level macros in module items 2019-01-01 22:15:35 +03:00
Aleksey Kladov
e5b2fd6771 hard-code expansion of query_group 2019-01-01 22:15:35 +03:00
Aleksey Kladov
832bae8e28 fix tests 2019-01-01 22:15:35 +03:00
Aleksey Kladov
882a86240f rename 2019-01-01 22:15:35 +03:00
Aleksey Kladov
b2fec18098 move more macros to hir 2019-01-01 22:15:35 +03:00
Aleksey Kladov
57030f587b use macros database in analysis 2019-01-01 22:15:35 +03:00
Aleksey Kladov
d753656192 introduce MacrosDatabase 2019-01-01 22:15:35 +03:00
Jan Jansen
05daa86634 Make modules with tests runnable
Fixes #154
2018-12-31 15:00:04 +01:00
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