Commit graph

134 commits

Author SHA1 Message Date
Florian Diebold
d571d26955 Make the Resolution variants tuple variants 2019-02-01 22:54:30 +01:00
Florian Diebold
6b076f1931 Use new Resolver API in type inference 2019-02-01 22:45:23 +01:00
csmoe
4dffdcf14a split HirDatabase api 2019-02-01 22:05:24 +08:00
bors[bot]
28fdb8d03c Merge #701
701: Minor type inference tweaks r=flodiebold a=marcusklaas

Pass down expectation for reference expressions and type the guard in match expressions.

I wasn't able to add a test for the former addition because the type variable previously introduced would always resolve to the right type in the things I tried!

Co-authored-by: Marcus Klaas de Vries <mail@marcusklaas.nl>
2019-01-30 20:51:47 +00:00
Florian Diebold
65864d85f9 Rename FnScopes -> ExprScopes
The reason for this is that it describes scopes for any body expression, not
just that of a function. It did not actually refer to functions at all anymore.
2019-01-30 21:23:50 +01:00
Marcus Klaas de Vries
3daca3eb4d Infer type of match guard 2019-01-28 23:09:14 +01:00
WizardOfMenlo
ec32b2e39c Use match-all instead of individual branches 2019-01-28 17:17:04 +00:00
WizardOfMenlo
9416904d14 Added support for primitive types type inference when using std::ops::Not 2019-01-28 14:52:43 +00:00
Marcus Klaas de Vries
6249989e6c Process second review 2019-01-27 17:59:21 +01:00
Marcus Klaas de Vries
f6eb44cd9e Use type information from the turbofish 2019-01-27 17:59:21 +01:00
Marcus Klaas de Vries
0da1e8b2f8 Add a FnSig to Ty::FnDef 2019-01-27 17:59:21 +01:00
Marcus Klaas de Vries
089b1c57c1 Address some issues flagged in review 2019-01-27 17:59:21 +01:00
Marcus Klaas de Vries
aa06893a14 Add type params to FnSignature 2019-01-27 17:59:21 +01:00
Marcus Klaas de Vries
67e40e431a Initial implementation of generics for method calls 2019-01-27 17:59:21 +01:00
Marcus Klaas de Vries
3bd47c0285 First attempt at generic type inference for fns 2019-01-27 17:59:21 +01:00
Florian Diebold
94bbb2418a Add marks 2019-01-26 23:59:11 +01:00
Florian Diebold
77f92674f9 Handle cycles in type vars
This might be the cause of #587.
2019-01-26 23:48:01 +01:00
Florian Diebold
5a1385007c Fix type inference of binops on int/float variables
Fixes #651.
2019-01-25 21:32:49 +01:00
Aleksey Kladov
9f2574c97e add ability to get strcut field source 2019-01-25 20:38:03 +03:00
Aleksey Kladov
0044514a4e remember where fields resolve to during inference 2019-01-25 20:02:53 +03:00
Aleksey Kladov
87ac5f5b36 use positional ids for fields 2019-01-25 14:21:14 +03:00
Aleksey Kladov
31d3a56b18 move adt to adt 2019-01-25 01:53:07 +03:00
Aleksey Kladov
ff9c5bef7b ModuleDef is Def-free 2019-01-25 01:32:47 +03:00
Aleksey Kladov
0f2f3a21e7 Migrate trait & type to new ids 2019-01-25 01:31:32 +03:00
Aleksey Kladov
1db2cbcb8b move consts&statics to new id 2019-01-25 00:50:08 +03:00
Aleksey Kladov
f3a37522a0 removed untyped typabledef 2019-01-24 23:39:39 +03:00
Aleksey Kladov
4c514a3e02 move enum variant to the new API 2019-01-24 23:32:41 +03:00
Aleksey Kladov
a7c0336a75 macro-generate froms 2019-01-24 19:16:25 +03:00
Aleksey Kladov
ce2041252a kill unused defs 2019-01-24 18:57:38 +03:00
Aleksey Kladov
566c8e321e migrate enums to new id 2019-01-24 18:56:38 +03:00
Aleksey Kladov
60a607d33f new struct id 2019-01-24 17:54:18 +03:00
Aleksey Kladov
ec7ed054e0 Functions use new id scheme 2019-01-24 15:28:50 +03:00
Aleksey Kladov
3ab1519cb2 Change ids strategy
this is a part of larghish hir refactoring which aims to

* replace per-source-root module trees with per crate trees
* switch from a monotyped DedId to type-specific ids
2019-01-24 13:29:19 +03:00
Florian Diebold
e45f476d56 Fix panic trying to get substs on unknown type
Fixes #585.
2019-01-21 21:42:19 +01:00
Florian Diebold
3c4a4c6ae9 Fix panic on inferring field access on an enum 2019-01-20 18:14:19 +01:00
Florian Diebold
5f3509e140 Add an assert 2019-01-19 19:00:36 +01:00
Florian Diebold
969f588025 Generics -> GenericParams 2019-01-19 18:58:04 +01:00
Florian Diebold
9e4b5ecec4 Make generics work in struct patterns 2019-01-19 16:02:06 +01:00
Florian Diebold
d37bb128ef Collect generic args in struct variant paths as well 2019-01-19 16:02:06 +01:00
Florian Diebold
cc4562ab6e Collect generic args in type paths
E.g. `let x: A<X>` is handled correctly.
2019-01-19 16:02:06 +01:00
Florian Diebold
fa7f9d696f Make Module impl methods crate-private, update some comments 2019-01-19 16:02:06 +01:00
Florian Diebold
688a45e00b Implement beginnings of generics
- add HIR for generic params
 - resolve generic params in type paths
 - add substitions for ADTs
 - insert type variables for substitutions
2019-01-19 16:02:06 +01:00
Marcus Klaas de Vries
bcbfa2cc11 Finish move of StructField for pattern type inference 2019-01-19 15:37:26 +03:00
Marcus Klaas de Vries
4277f420aa Replace Expectation by &Ty in infer_pat method 2019-01-19 15:37:26 +03:00
Marcus Klaas de Vries
d2769837f1 Move pattern type inference from adt::StructField to core_model_impl (WIP) 2019-01-19 15:37:26 +03:00
Marcus Klaas de Vries
b5466f3fb3 Address issues flagged in review 2019-01-19 15:37:26 +03:00
Marcus Klaas de Vries
5027c5d4ee Fix bug in match arm type unification 2019-01-19 15:37:26 +03:00
Marcus Klaas de Vries
44e9a9605b Fixup annotated bindings 2019-01-19 15:37:26 +03:00
Marcus Klaas de Vries
d48d5b8b6c Add initial (flawed) implementation of binding annotations 2019-01-19 15:37:26 +03:00
Marcus Klaas de Vries
9433a108cf Make pattern inference work w/o proper expecations 2019-01-19 15:37:25 +03:00