Commit graph

21 commits

Author SHA1 Message Date
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
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
a9f55029b9 introduce known names 2018-12-27 20:26:15 +03: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
55c941cd9f Type field accesses 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
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
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