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
Marcus Klaas de Vries
4fc233a02e
Implement type inference for boolean operators
2019-01-05 21:28:30 +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
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
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
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
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