Commit Graph

774 Commits

Author SHA1 Message Date
Florian Diebold
0f7e4a7d24 Implement a very naive implements check
... to make the infer_trait_method_simple test have the correct result.
2019-03-25 21:28:36 +01:00
Florian Diebold
c947c15ce1 Basics for trait method resolution 2019-03-25 21:28:36 +01:00
Aleksey Kladov
309716cffe move tests to where they belong 2019-03-25 14:29:24 +03:00
Aleksey Kladov
5ce84f3cbc tweak diagnostics API 2019-03-25 10:52:50 +03:00
Aleksey Kladov
4c4a714328 test diagnostics 2019-03-25 10:52:50 +03:00
Aleksey Kladov
c7ffd939f6 more enterprisey diagnostics setup 2019-03-25 10:52:50 +03:00
Aleksey Kladov
7ee2887d1e fixes 2019-03-25 10:52:50 +03:00
Aleksey Kladov
45fbab2b1a check impls as well 2019-03-25 10:52:50 +03:00
Aleksey Kladov
79df62bc74 cleanup 2019-03-25 10:52:50 +03:00
Aleksey Kladov
3fb88e95aa switch modules to new diagnostics 2019-03-25 10:52:50 +03:00
Aleksey Kladov
fcca35969d allow dyn diagnostics 2019-03-25 10:52:12 +03:00
Aleksey Kladov
7e8f17188e diagnostics 2019-03-25 10:52:12 +03:00
Marco Groppo
67055c47da Target only the actual operator.
Renamed `BinExpr::op()` and `PrefixExpr::op()` to `op_kind`.
Now `op()` returns the `SyntaxNode`.
2019-03-24 22:21:22 +01:00
Florian Diebold
dbfc68cea0 Fix apply_substs assertion failure
Fixes #1030.
2019-03-23 18:03:09 +01:00
Aleksey Kladov
46a21b07e6 remove obsolete diagnostic 2019-03-23 16:31:11 +03:00
Aleksey Kladov
3f0cf6ebe1 rename persistent hir database -> def database 2019-03-23 15:44:24 +03:00
Aleksey Kladov
4fd8cfd6ad replace todo with fixme 2019-03-23 11:07:09 +03:00
yanchith
504c8c7c2e Refactor primitive types into more orthogonal representation 2019-03-22 10:09:35 +01:00
Florian Diebold
1ee779d1f7 Assert in apply_substs that the number of parameters doesn't change
... and fix a small bug revealed by that.
2019-03-21 22:39:31 +01:00
Florian Diebold
cbb418ebb8 Rename name field to ctor as well 2019-03-21 22:29:12 +01:00
Florian Diebold
97be0e6c46 Some more doc comments 2019-03-21 22:23:52 +01:00
Florian Diebold
f10f5a81b3 TypeName => TypeCtor 2019-03-21 22:20:03 +01:00
Florian Diebold
8a5fbf4713 Remove the old variants replaced by Ty::Apply 2019-03-21 22:17:00 +01:00
Florian Diebold
7a8ba53542 Add Ty::Apply 2019-03-21 22:11:53 +01:00
Florian Diebold
bc7752e527 Represent FnPtr and Tuple using Substs 2019-03-21 22:11:53 +01:00
Aleksey Kladov
f5165af9a7 make Name::new private 2019-03-20 22:33:26 +03:00
Vincent Esche
21f20d5deb Fixed typo in Interner’s name (Intener) 2019-03-20 09:29:10 +01:00
Aleksey Kladov
5641feeddb import resolution is immutable 2019-03-19 18:35:03 +03:00
bors[bot]
40c6dd1f4c Merge #982
982: Implement BindingMode for pattern matching. r=flodiebold a=mjkillough

Implement `BindingMode` for pattern matching, so that types can be
correctly inferred using match ergonomics. The binding mode defaults to
`Move` (referred to as 'BindingMode::BindByValue` in rustc), and is
updated by automatic dereferencing of the value being matched.

Fixes #888.

 - [Binding modes in The Reference](https://doc.rust-lang.org/reference/patterns.html#binding-modes)
 - [`rustc` implementation](e17c48e2f2/src/librustc_typeck/check/_match.rs (L77)) (and [definition of `BindingMode`](e957ed9d10/src/librustc/ty/binding.rs))
 - [Match Ergonomics RFC](https://github.com/rust-lang/rfcs/blob/master/text/2005-match-ergonomics.md#binding-mode-rules)

Co-authored-by: Michael Killough <michaeljkillough@gmail.com>
2019-03-17 21:41:37 +00:00
Michael Killough
6299ccd350 Split test case and use tested_by!. 2019-03-17 19:08:51 +00:00
Michael Killough
33add0ee30 Simplify match statement. 2019-03-17 18:50:22 +00:00
Michael Killough
354134ffb4 impl Default for BindingMode.
This decouples callers from knowing what the default binding mode of
pattern matching is.
2019-03-17 18:46:01 +00:00
Aleksey Kladov
3a77023365 docs 2019-03-17 12:53:22 +03:00
Aleksey Kladov
4d7fa6d30b remove fixme 2019-03-17 12:53:22 +03:00
Aleksey Kladov
6955e392f8 remove old macro support 2019-03-17 12:53:22 +03:00
Aleksey Kladov
ee3cf6172b rename ModuleId -> CrateModuleId 2019-03-17 12:53:22 +03:00
Aleksey Kladov
c51a6a7bdd fix error on wrong path 2019-03-17 12:53:22 +03:00
Aleksey Kladov
0d6b8baa89 log time 2019-03-17 12:53:22 +03:00
Aleksey Kladov
967a4b64af Reorganize name resolution 2019-03-17 12:53:22 +03:00
Aleksey Kladov
b2a6c17362 remove lower module 2019-03-17 12:52:52 +03:00
Aleksey Kladov
c7259a899c remove ItemMap 2019-03-17 12:52:05 +03:00
Aleksey Kladov
71e5adf694 move tests over to crate-def-map 2019-03-17 12:49:07 +03:00
Aleksey Kladov
2195d1db6d Replace module_tree with CrateDefMap 2019-03-17 12:49:07 +03:00
Aleksey Kladov
182c05a96c add name resolution from the old impl
unlike the old impl, this also handles macro imports across crates
2019-03-17 12:46:13 +03:00
Aleksey Kladov
0d8d918656 add skeleton for macro-aware name resolutions 2019-03-17 12:46:13 +03:00
Michael Killough
b42c5ced68 Implement BindingMode for pattern matching.
Implement `BindingMode` for pattern matching, so that types can be
correctly inferred using match ergonomics. The binding mode defaults to
`Move` (referred to as 'BindingMode::BindByValue` in rustc), and is
updated by automatic dereferencing of the value being matched.
2019-03-16 18:13:13 +00:00
Florian Diebold
7faae12311 Remove FnSig from FnDef type
It doesn't need to be in there since it's just information from the def. Another
step towards aligning Ty with Chalk's representation.
2019-03-16 17:29:55 +01:00
Florian Diebold
a9ddaba905 Refactor FnSig a bit 2019-03-16 17:21:32 +01:00
Florian Diebold
628b530e92 Some more Ty displaying cleanup 2019-03-16 16:50:31 +01:00
Florian Diebold
c5ee60e05b Replace Display by a pretty printing trait for Ty
This allows removing the names from Adt and FnDef (and more later), as a first
step towards aligning more with chalk's Ty :)
2019-03-16 16:36:59 +01:00
pcpthm
adad641c52 derive Hash for ra_hir::ModuleDef 2019-03-14 17:25:51 +09:00
Aleksey Kladov
e9e792f2d7 remove Def 2019-03-12 12:36:37 +03:00
Ville Penttinen
4a0bb3d7c5 Add support for goto definition and hover on Self
This fixes #943
2019-03-07 17:34:44 +02:00
kjeremy
eb3ee7b8e5 Updates 2019-03-05 10:26:36 -05:00
kjeremy
ac678473b8 Use impl_froms! 2019-03-04 09:52:48 -05:00
kjeremy
1578375b89 Make ExpOrPatId private 2019-03-04 09:49:18 -05:00
Jeremy Kolb
ad2da5b1da Remove commented out code 2019-03-04 08:27:08 -05:00
Jeremy Kolb
3d8d880c59 Use ImplItems instead of just Function 2019-03-04 08:27:08 -05:00
kjeremy
49da9a3e81 Make goto definition/hover resolve constructors 2019-03-04 08:27:08 -05:00
Florian Diebold
2e8f258845 Inline type inference test snapshots 2019-03-03 12:41:42 +01:00
Florian Diebold
affaf7700a Represent unknown types as {unknown} instead of [unknown]
Since the latter could actually be a real type...
2019-03-03 03:00:17 +01:00
Florian Diebold
b7fdad8448 Add a bunch of tests for type inference involving traits
None of them works correctly yet, of course.
2019-03-02 16:42:51 +01:00
bors[bot]
fd7240837b Merge #915
915: Bring BodySyntaxMapping in line with other source-map instances r=flodiebold a=matklad

* rename to SourceMap
* don't store the actual body inline, just return a pair

r? @flodiebold 

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-03-02 14:09:46 +00:00
Aleksey Kladov
f0a9d026fc remove comment 2019-03-02 17:01:20 +03:00
Aleksey Kladov
8fc08d36e3 remove second way to get the body 2019-03-02 16:59:18 +03:00
Aleksey Kladov
03b2ab8e1f rename syntax_mapping as well 2019-03-02 16:56:09 +03:00
Florian Diebold
862b663501 A bit of cleanup in ty.rs 2019-03-02 14:53:12 +01:00
Aleksey Kladov
80bb7d86ec align lower module query names 2019-03-02 16:49:06 +03:00
Aleksey Kladov
fe5574b05a rename scopes 2019-03-02 16:38:28 +03:00
Aleksey Kladov
ca957edf96 rename to source_map 2019-03-02 16:36:25 +03:00
Aleksey Kladov
f4c5383103 dont store body inside source map 2019-03-02 16:18:40 +03:00
Aleksey Kladov
eaf1df26e9 rename syntax-mapping -> source-map 2019-03-02 15:40:40 +03:00
Ville Penttinen
d3ce69aee3 Remove TypeRef from item opts which implement TypeAscriptionOwner 2019-02-27 14:08:09 +02:00
Ville Penttinen
52054e1140 Use TypeAscriptionOwner
This replaces places where we would use node + node.type_ref() with things that
have an ascribed type, with using the TypeAscriptionOwner as the trait bound so
we can simply pass the node.
2019-02-26 11:47:13 +02:00
bors[bot]
7c9acf2f83 Merge #897
897: Add basic const/static type inference r=flodiebold a=vipentti

This adds basic const/static type inference discussed in #887.

Currently the inference does not work for const/static declared inside a block. In addition the inference does not work inside the bodies of const/static.

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
2019-02-25 12:03:57 +00:00
Aleksey Kladov
78f10fcdc4 rename type to type_alias in the AST as well 2019-02-25 13:49:32 +03:00
Ville Penttinen
cff9a7dfad Move ConstSignature creation to a single method 2019-02-25 10:55:39 +02:00
Ville Penttinen
29f93a7906 Add static type inference 2019-02-25 10:55:23 +02:00
Ville Penttinen
18b0bd9bff Add const type inference 2019-02-25 10:51:46 +02:00
Florian Diebold
bd8ed644e4 Rename Type => TypeAlias 2019-02-24 21:36:49 +01:00
Florian Diebold
c3c0979561 Add test for recursive type aliases 2019-02-24 20:54:04 +01:00
Florian Diebold
5d72b96988 Implement support for type aliases 2019-02-24 20:54:04 +01:00
Aleksey Kladov
d0a261468e introduce completion presentation
This module should remove completion rendering boilerplate from the
"brains" of completion engine.
2019-02-24 18:51:38 +03:00
Florian Diebold
c71740e956 Clean up imports a bit 2019-02-24 15:17:20 +01:00
Florian Diebold
82fe7b77a3 Refactor associated method resolution a bit and make it work with generics 2019-02-23 23:00:02 +01:00
Florian Diebold
dcfb4ee702 Split ty.rs into several modules
It was just getting too big. We now have:

 - ty: the `Ty` enum and helpers
 - ty::infer: actual type inference
 - ty::lower: lowering from HIR to `Ty`
 - ty::op: helpers for binary operations, currently
2019-02-23 15:36:38 +01:00
Florian Diebold
6a04d1f292 Fix resolution of associated method calls across crates
I think it'll be better to make the path resolution the number of unresolved
segments, not the first unresolved index; then this error could simply not have
happened. But I'll do that separately.
2019-02-23 12:37:29 +01:00
bors[bot]
3d8a0982a1 Merge #866
866: Implement basic support for Associated Methods r=flodiebold a=vipentti

This is my attempt at learning to understand how the type inference works by adding basic support for associated methods. Currently it does not resolve associated types or constants. 

The basic idea is that `Resolver::resolve_path` returns a new `PathResult` type, which has two variants, `FullyResolved` and `PartiallyResolved`, fully resolved matches the previous behavior, where as `PartiallyResolved` contains the `PerNs<Resolution` in addition to a `segment_index` which contains the index of the segment which we failed to resolve. This index can then be used to continue inference in `infer_path_expr` using the `Type` we managed to resolve.

This changes some of the previous apis, so looking for feedback and suggestions.

This should enable fixing #832

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
2019-02-22 19:58:22 +00:00
Ville Penttinen
247d1c17b3 Change resolve_path to return the fully resolved path or PerNs::none
This also adds new pub(crate) resolve_path_segments which returns the
PathResult, which may or may not be fully resolved. PathResult is also now
pub(crate) since it is an implementation detail.
2019-02-22 10:15:23 +02:00
Ville Penttinen
39679d499f Ignore failing test for now 2019-02-22 00:27:22 +02:00
Ville Penttinen
a34eb98a78 Make nameres::ResolvePathResult private and refactor 2019-02-22 00:11:21 +02:00
Ville Penttinen
2e7bc905be Remove Const inference for now, refactor PathResult 2019-02-21 23:57:07 +02:00
Florian Diebold
db9a5a9ac0 Add an assert (and fix the other) 2019-02-21 21:25:27 +01:00
Ville Penttinen
816971ebc9 Implement basic support for Associated Methods and Constants
This is done in `infer_path_expr`. When `Resolver::resolve_path` returns
`PartiallyResolved`, we use the returned `Resolution` together with the given
`segment_index` to check if we can find something matching the segment at
segment_index in the impls for that particular type.
2019-02-21 12:25:55 +02:00
Florian Diebold
72712b8a42 Fix handling of generics in tuple variants and refactor a bit
Also make them display a tiny bit nicer.

Fixes #860.
2019-02-20 22:48:55 +01:00
Aleksey Kladov
9738fb48a6 remove ignored macro tests
we need to significantly reengineer macros, so the tests as they exist
are useless
2019-02-19 20:06:53 +03:00
bors[bot]
564ab84b78 Merge #852
852: Handle != r=flodiebold a=matklad

r? @flodiebold

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-02-18 09:13:51 +00:00
Aleksey Kladov
4e8a3f565b handle != operator 2019-02-18 10:09:44 +03:00
Florian Diebold
b82db68400 Handle tuple structs / enum variants properly in type inference 2019-02-17 20:53:13 +01:00
Florian Diebold
3c7c7e5a04 Make GenericArgs::from_ast pub(crate) 2019-02-17 14:55:04 +01:00
Florian Diebold
795d718ba1 Unify with the autorefed/autoderefed receiver type during method resolution 2019-02-17 14:44:39 +01:00
Florian Diebold
a1bda3fc08 Handle generic args for method calls 2019-02-16 23:06:41 +01:00
Florian Diebold
65bd9bc3a8 Handle impl generics in method calls 2019-02-16 23:06:41 +01:00
Florian Diebold
2af067b391 Resolve impl generic params 2019-02-16 23:06:41 +01:00
Florian Diebold
da7056245d Add generic params to impl blocks 2019-02-16 23:06:41 +01:00
Florian Diebold
ccfc6b11c1 Add a test for impl generics 2019-02-16 23:06:41 +01:00
Florian Diebold
0242acae53 Turn ImplBlock into a copy type just containing IDs
This makes it more like the other code model types.

Also make Module::definition_source/declaration_source return HirFileIds, to
make them more like the other source functions.
2019-02-16 22:08:13 +01:00
Florian Diebold
911e32bca9 Complete names from prelude 2019-02-13 21:13:08 +01:00
Florian Diebold
92c595a6a6 Handle extern crates better, so they work correctly in 2015 edition
(see the removed comment.)
2019-02-13 21:13:08 +01:00
Florian Diebold
70839b7ef8 Make edition handling a bit nicer and allow specifying edition in crate_graph macro 2019-02-13 20:31:47 +01:00
Florian Diebold
d5ad38cbb8 Resolve 2015 style imports 2019-02-13 20:10:46 +01:00
Florian Diebold
3a9934e2c3 Keep track of crate edition 2019-02-13 20:10:46 +01:00
Florian Diebold
1526eb25c9 Import the prelude 2019-02-13 20:10:09 +01:00
Florian Diebold
e5f9d54661 Fix another crash 2019-02-12 21:49:54 +01:00
Aleksey Kladov
5f89180fd9 make token trees eq 2019-02-12 20:57:13 +03:00
Pascal Hertleif
4fd3613434 Fix some typos 2019-02-12 15:02:57 +01:00
Laurențiu Nicola
7e8527f748 Implement completion for associated items 2019-02-12 12:51:01 +02:00
Aleksey Kladov
60524771fd replace clone with copy 2019-02-12 13:32:34 +03:00
Aleksey Kladov
fa2e6e0bda fix obsolete comment 2019-02-12 13:29:27 +03:00
Aleksey Kladov
0d060b073c remove hard-coded query-group macro 2019-02-11 22:24:39 +03:00
Aleksey Kladov
bbcd3566de remove useless hash 2019-02-11 19:09:53 +03:00
Aleksey Kladov
28fd228c70 remove query_definitions 2019-02-11 17:44:54 +03:00
Aleksey Kladov
8cafdb3a99 rename combine -> or
This way we match API of Option

https://doc.rust-lang.org/std/option/enum.Option.html#method.or
2019-02-11 17:29:20 +03:00
Aleksey Kladov
58ed8ee665 use extern prelude in Resolver
This fixes two bugs:

- completion for paths works again
- we handle extern prelude shadowing more correctly
2019-02-11 15:41:39 +03:00
bors[bot]
2babbbb978 Merge #784
784: WIP: improve multi-crate fixtures r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-02-11 10:54:27 +00:00
Aleksey Kladov
9923383d53 add graph fixture 2019-02-11 13:47:17 +03:00
Aleksey Kladov
dced2f4ed4 Handle SourceRoots automatically in fixtures 2019-02-11 12:53:10 +03:00
Ville Penttinen
710975ecd8 Fix typo in Cargo.toml authors
Fixes typo introduced in #782
2019-02-11 10:20:04 +02:00
Ville Penttinen
ab3d231b1d Update authors field in Cargo.tomls to "rust-analyzer developers"
This closes #777
2019-02-11 08:55:35 +02:00
Florian Diebold
2f24e740db Implement glob imports within the same crate
Fixes #231.
2019-02-10 16:48:29 +01:00
Florian Diebold
2e1d739a80 Import glob imports from other crates
This is the easy part since we don't have to consider the fixpoint algorithm.
2019-02-10 16:20:01 +01:00
Florian Diebold
c1e295682e Implement glob imports from enums 2019-02-10 16:20:01 +01:00
Florian Diebold
35cfb418ba Add some tests 2019-02-10 16:20:01 +01:00
Florian Diebold
2e9194a621 Spell cases explicitly in Ty::walk{_mut} 2019-02-10 12:35:30 +01:00
Florian Diebold
6964a88e8c Add an ra_cli command that analyses all crates in the current workspace
... and prints various stats about how many expressions have a type etc.
2019-02-10 10:56:58 +01:00
Florian Diebold
c098a3fda5 Add comment and mark 2019-02-09 22:03:01 +01:00
Florian Diebold
a28d4befaf Fix another crash, and try harder to prevent stack overflows 2019-02-09 21:53:55 +01:00
Florian Diebold
c0c3b37255 Fix another crash found when analyzing rustc 2019-02-09 21:37:30 +01:00
Florian Diebold
f1afc93353 Fix handling of literal patterns
Wrap them in a LiteralPat node so they can be distinguished from literal
expressions.
2019-02-09 21:37:30 +01:00
Florian Diebold
7ebde241c0 Fix two crashes found by running inference on all of rustc 2019-02-09 21:37:09 +01:00
Aleksey Kladov
12e3b4c70b reformat the world 2019-02-08 14:49:43 +03:00
kjeremy
6753051a45 Some clippy cleanups 2019-02-06 15:50:26 -05:00
Aleksey Kladov
0c5fd8f7cb move assists to a separate crate 2019-02-06 17:00:00 +03:00
bors[bot]
4183825475 Merge #740
740: Update dependencies r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-02-05 12:16:25 +00:00
Florian Diebold
de4c5e381f Fix ReachedFixedPoint value for unresolved external prelude items 2019-02-04 23:26:25 +01:00
Florian Diebold
699ce06ac3 Complete extern prelude (again) 2019-02-04 22:09:56 +01:00
Florian Diebold
1056b480d6 Make extern crates in the root module add to the extern prelude
To accomplish this, separate the extern prelude from the per-module item maps.
2019-02-04 21:49:34 +01:00
Florian Diebold
d69023fc72 Lower extern crates to imports
This is probably not completely correct, but it kind of works.
2019-02-04 21:49:34 +01:00
Florian Diebold
397d84ee29 Add test for extern crate renames 2019-02-04 21:49:34 +01:00
kjeremy
5227102c12 Test more Self inference 2019-02-04 14:44:06 -05:00
kjeremy
8ec4b84013 Bump insta and proptest to latest 2019-02-04 14:11:51 -05:00
Aleksey Kladov
dbf9820e35 make HirDatabase object-safe 2019-02-03 22:15:31 +03:00
Florian Diebold
d8ef8acb47 Use aliases in import resolution 2019-02-02 00:23:59 +01:00
Florian Diebold
5a7fce4e4c Pass aliases to ImportData 2019-02-02 00:23:53 +01:00
Florian Diebold
aa5f6a1ee8 Add test for use as 2019-02-02 00:23:53 +01:00
Florian Diebold
c5852f422f Some cleanup and additional tests 2019-02-01 23:24:26 +01:00
Florian Diebold
d571d26955 Make the Resolution variants tuple variants 2019-02-01 22:54:30 +01:00
Florian Diebold
d3df80dfe4 Cleanup 2019-02-01 22:54:21 +01:00
Florian Diebold
afce8e4426 Use the new Resolver API for goto def 2019-02-01 22:45:43 +01:00
Florian Diebold
33ff7b56ff Use the new Resolver API in completion 2019-02-01 22:45:25 +01:00
Florian Diebold
6b076f1931 Use new Resolver API in type inference 2019-02-01 22:45:23 +01:00
Florian Diebold
758bc72873 Implement methods to build a resolver 2019-02-01 22:17:48 +01:00
Florian Diebold
5208c2aa93 Sketching the resolver API 2019-02-01 22:14:34 +01:00
csmoe
4dffdcf14a split HirDatabase api 2019-02-01 22:05:24 +08:00
csmoe
12433a7887 split hirdatabase 2019-02-01 21:36:51 +08:00
Aleksey Kladov
de85f1e947 remove hard-coded support for ctry macro
It was used mainly to prevent HirFileId infra from bitroting, but the
`vec![]` macro can serve that just as well!
2019-02-01 10:52:36 +03:00
kjeremy
f0fdc9d5c0 Go To Implementation for Trait 2019-01-31 18:34:52 -05:00
Aleksey Kladov
2d1f0b105d move test 2019-01-31 22:23:30 +02:00
Aleksey Kladov
40feacdeb9 split macros across crates 2019-01-31 22:23:30 +02:00
Aleksey Kladov
ad80a0c551 preserve token spacing 2019-01-31 22:23:30 +02:00
Aleksey Kladov
5934738854 first test sort-of passes 2019-01-31 22:23:30 +02:00
Aleksey Kladov
ce3636798b move macros to a separate crate 2019-01-31 22:23:30 +02:00
Aleksey Kladov
9a043a163c parses simple macro 2019-01-31 22:23:30 +02:00
Aleksey Kladov
0d9210e9bc handle multibyte tokens 2019-01-31 22:23:30 +02:00
Aleksey Kladov
f3489e8111 add eat methods 2019-01-31 22:23:30 +02:00
Aleksey Kladov
e28a5e048a parsing scaffold 2019-01-31 22:23:30 +02:00
Aleksey Kladov
2980508ad2 debug impls 2019-01-31 22:23:30 +02:00
Aleksey Kladov
82cf0185c3 add repeats to ast 2019-01-31 22:23:30 +02:00
Aleksey Kladov
3bd4560d6e convert punts and literals 2019-01-31 22:23:30 +02:00
Aleksey Kladov
c09c6fc97c start tt convertions boilerplate 2019-01-31 22:23:30 +02:00
Aleksey Kladov
a4342a7fee add conversion boilerplate 2019-01-31 22:23:30 +02:00
Aleksey Kladov
ca327f35ad add macro by example ide 2019-01-31 22:23:30 +02:00
Aleksey Kladov
6846ac2a16 shorten name :-) 2019-01-31 22:23:30 +02:00
Aleksey Kladov
b8f56f89c6 start token tree module 2019-01-31 22:23:30 +02: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
1acff307fe Move expr_scopes query to its module 2019-01-30 21:39:34 +01: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
13cb4a1b37 Add test for passing on ref expectations 2019-01-30 21:14:26 +01:00
Aleksey Kladov
ef7eb8c257 Use Crate instead of CrateId 2019-01-30 22:37:20 +03:00
Aleksey Kladov
95aa7e46fc move item_map_query 2019-01-30 22:36:22 +03:00
kjeremy
04eb15856b Resolve crate 2019-01-30 13:18:21 -05:00
Jeremy Kolb
3c17643b30 Go to Implementation for structs and enums 2019-01-29 19:13:02 -05: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
04748a0f16 Add missing ty test snapshot 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
Erlend Tobiassen
b775fa285c
Revert parts of "Test non standard crate root"
Prefer cursor position over file_map
2019-01-27 16:32:31 +01:00
Erlend Tobiassen
b149882d19
Remove dbg!(...) 2019-01-27 15:44:59 +01:00
Erlend Tobiassen
08e12f974c
Fix bad rebase and rustfmt 2019-01-27 15:37:43 +01:00
Erlend Tobiassen
c5e6db16b1
fix #668 2019-01-27 15:19:38 +01:00
Erlend Tobiassen
683e5e64f4
Test non standard crate root 2019-01-27 15:15:56 +01:00
bors[bot]
ffcf618842 Merge #662
662: Preserve indentation in doc comments r=matklad a=kjeremy

Fixes #502 

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-01-27 08:21:04 +00: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
bors[bot]
e40d8d4032 Merge #683
683: fix AST for if expressions r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-01-26 21:41:27 +00:00
Aleksey Kladov
619af1e22c fix AST for if expressions
then is not always a block...
2019-01-27 00:37:11 +03:00
Aleksey Kladov
a128075af9 remove Option<SourceFileItemId> hack 2019-01-26 23:27:01 +03:00
Aleksey Kladov
9c1a18a626 store syntax ptr in FileItems
we cache the tree in file_item query anyway
2019-01-26 22:48:04 +03:00
Aleksey Kladov
ae97a45c35 remove dead code 2019-01-26 22:43:07 +03:00
Jeremy Kolb
a892067951 Make doc comments optional 2019-01-26 10:35:23 -05:00
Aleksey Kladov
9457b1f0e6 rename source_file -> parse 2019-01-26 11:51:36 +03:00
Aleksey Kladov
4711cbcace rename FilesDatabase -> SourceDatabase 2019-01-26 11:20:30 +03:00
Aleksey Kladov
3223de5976 move ide queries to ide db 2019-01-26 11:17:05 +03:00
Aleksey Kladov
be1a005ebd fold syntax database into files database 2019-01-26 11:09:39 +03:00
Aleksey Kladov
23172a116c rename POS_FIELD -> POS_FIELD_DEF
to match NAMED_FIELD_DEF
2019-01-26 00:24:12 +03:00
bors[bot]
3c7acecade Merge #656
656: :arrow_up deps r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-01-25 20:43:09 +00:00
bors[bot]
d0ddc5a7c1 Merge #655
655: Fix type inference of binops on int/float variables r=matklad a=flodiebold

Fixes #651.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-01-25 20:36:56 +00: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
1fd18f020d ⬆️ salsa 2019-01-25 23:27:16 +03:00
Aleksey Kladov
54f30bb6d8 nicer behavior in case of bugs
We should always reach a fixed point, but if we fail, let's fail
loudly!
2019-01-25 23:13:07 +03:00
Jeremy A. Kolb
7a0bc2dd64 Add docs to struct fields 2019-01-25 14:29:56 -05:00
Aleksey Kladov
f0c6a040bd remove dead code 2019-01-25 21:14:41 +03:00
bors[bot]
cc73d3ccbc Merge #646
646: Add module documentation support r=matklad a=kjeremy



Co-authored-by: Jeremy A. Kolb <jkolb@ara.com>
2019-01-25 17:55:29 +00:00
Jeremy A. Kolb
6588579116 Add module documentation support 2019-01-25 12:51:36 -05: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
bors[bot]
021e691997 Merge #639
639: Update salsa r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-01-25 12:34:10 +00:00
Aleksey Kladov
08c12e424d use set methods 2019-01-25 15:25:01 +03:00
Aleksey Kladov
8cf092d5de :arrow_up salsa 2019-01-25 15:16:50 +03:00
Aleksey Kladov
64d4f42558 reduce visibility 2019-01-25 14:25:30 +03:00
Aleksey Kladov
87ac5f5b36 use positional ids for fields 2019-01-25 14:21:14 +03:00
Aleksey Kladov
47e5536678 rename struct field -> struct field data 2019-01-25 12:58:01 +03:00
Aleksey Kladov
87288d802c pack enum variants into arena 2019-01-25 12:50:46 +03:00
Aleksey Kladov
2ee2fba752 switch to positional enum variants 2019-01-25 11:35:38 +03:00
Aleksey Kladov
0707f65806 drop obsolete fixme 2019-01-25 10:31:45 +03:00
Aleksey Kladov
3b45ddd984 deglobify 2019-01-25 10:29:55 +03:00
Aleksey Kladov
74beb5bfcb simplify 2019-01-25 10:29:00 +03:00
Aleksey Kladov
ed27bd8d77 remove useless wrapper 2019-01-25 10:20:35 +03:00
Aleksey Kladov
b90b90cb95 fix comment 2019-01-25 10:17:50 +03:00
Aleksey Kladov
bc77f91cf6 rename def_id -> def 2019-01-25 10:16:28 +03:00
Aleksey Kladov
e884ab05c2 write path resolution code only once 2019-01-25 10:15:10 +03:00
Aleksey Kladov
857c35ddb0 refactor import resolution
extract path resolution
use enums instead of bools
2019-01-25 10:08:21 +03:00
Aleksey Kladov
31d3a56b18 move adt to adt 2019-01-25 01:53:07 +03:00