Aleksey Kladov
62d01dd4df
hide resolver
2019-04-13 11:00:15 +03:00
Aleksey Kladov
f4a94e74bc
fold ScopeWithSyntax into SourceAnalyzer
2019-04-13 10:49:01 +03:00
Aleksey Kladov
30481808fb
make stuff private
2019-04-13 09:53:02 +03:00
Aleksey Kladov
1e8569dce9
make private
2019-04-13 09:46:39 +03:00
Aleksey Kladov
d4043a8dba
only def-with-body remains
2019-04-13 09:45:52 +03:00
Aleksey Kladov
d88269bc2d
generalize
2019-04-13 09:38:37 +03:00
Aleksey Kladov
17a0e22883
simplify
2019-04-13 09:36:28 +03:00
Aleksey Kladov
65b0073653
simplify
2019-04-13 09:33:34 +03:00
Aleksey Kladov
9ead801a9c
make private
2019-04-13 09:32:25 +03:00
Aleksey Kladov
3aae223d93
hide some scopes
2019-04-13 09:31:03 +03:00
Aleksey Kladov
58fe5598e7
simplify
2019-04-13 01:32:43 +03:00
Aleksey Kladov
b0d8f9ff5d
make stuff private
2019-04-13 01:07:24 +03:00
Aleksey Kladov
81e91980dd
simplify
2019-04-13 01:05:18 +03:00
Aleksey Kladov
7c13e22334
simplify tests
2019-04-13 00:56:57 +03:00
Aleksey Kladov
0fd93bc14a
use really correct resolver for expressions
2019-04-13 00:44:47 +03:00
Aleksey Kladov
cf2ba2791d
add todo
2019-04-11 17:14:41 +03:00
Aleksey Kladov
a347208bb2
use correct resolver for expressions
2019-04-11 16:51:30 +03:00
Aleksey Kladov
ebb0c377f0
remove resolver from CompletonContext
2019-04-11 16:49:35 +03:00
Aleksey Kladov
3c9f2d0e37
simplify
2019-04-11 16:39:56 +03:00
Aleksey Kladov
5471c1ef4b
generalize SourceAnalyzer to handle all defs with bodies
2019-04-11 16:37:29 +03:00
Aleksey Kladov
07cc047b4f
minimize the API
2019-04-11 16:29:33 +03:00
Aleksey Kladov
b6809b6695
rename
2019-04-11 16:29:33 +03:00
Aleksey Kladov
505acc973b
Make call info to use real name resolution
2019-04-11 16:29:33 +03:00
Aleksey Kladov
10d66d63d7
introduce SourceAnalyzer
2019-04-11 16:29:33 +03:00
Aleksey Kladov
6a8b3c1d4b
fix typo
2019-04-11 11:13:31 +03:00
Aleksey Kladov
10726fdb65
type-safer source-map for bindings
2019-04-10 10:48:15 +03:00
Aleksey Kladov
1cd184d653
use either for uses
2019-04-10 10:12:54 +03:00
Aleksey Kladov
6b993a9760
migrate to salsas interning
2019-04-09 22:51:22 +03:00
Laurențiu Nicola
61c09edb4a
Avoid two-phase borrow conflict
2019-04-08 16:47:28 +03:00
Lenard Pratt
b27fa33a9f
updated snapshots
2019-04-07 13:23:18 +01:00
Lenard Pratt
e175921932
Added ArrayExprKind,
...
changed the display for fixed array types,
Added Array Enum to ra_hir/expr
2019-04-07 13:23:14 +01:00
Lenard Pratt
2d73c909fe
Added inference of array length
2019-04-07 13:23:12 +01:00
robojumper
ca40ca93a5
Parse and infer tuple indices
2019-04-06 01:07:35 +02:00
bors[bot]
c6c88070c4
Merge #1068
...
1068: profiling crate first draft r=matklad a=pasa
I've made this first draft for #961
Could you look at it? Is this something what you are looking for?
It has lack of tests. I can't figure out how to test stderr output in rust right now. Do you have some clues?
Additionally I'm thinking about to implement procedural macros to annotate methods with this profiler. Will it be helpful?
Co-authored-by: Sergey Parilin <sergey.parilin@fxdd.com>
2019-04-03 09:09:11 +00:00
bors[bot]
fdbebccd71
Merge #1076
...
1076: Const body inference r=flodiebold a=Lapz
This is the second part of #887 . I've added type inference on const bodies and introduced the DefWithBody containing Function, Const and Static. I want to add tests but im unsure on how I would go about testing that completions work.
Co-authored-by: Lenard Pratt <l3np27@gmail.com>
2019-04-02 19:01:54 +00:00
Lenard Pratt
b9d2c2c21f
made ExprCollector pub(crate) and moved
...
collect_fn_body_syntax
2019-04-02 19:22:06 +01:00
Lenard Pratt
88e22e9d70
Added const bodies and static body to the ast
...
and added inference the inference test
reduce code duplication
2019-04-02 19:21:36 +01:00
Aleksey Kladov
0de89f786f
always produce source for import
2019-04-02 17:58:04 +03:00
Sergey Parilin
b74449e995
Merge remote-tracking branch 'upstream/master' into issue961_profiling
2019-04-02 17:55:14 +03:00
Sergey Parilin
9b73f80959
PR issuse resolved
2019-04-02 17:52:04 +03:00
Aleksey Kladov
49f13d3a9b
fix a panic with glob-import missing a source map
2019-04-02 13:26:09 +03:00
Aleksey Kladov
0e1e40676a
rename flavor to kind
2019-04-02 12:53:44 +03:00
Aleksey Kladov
f3a82c372c
remove flavor
2019-04-02 12:25:24 +03:00
gfreezy
4ca51cfbcf
intelligently add parens when inlining local varaibles
2019-04-01 22:53:47 +08:00
Aleksey Kladov
9e213385c9
switch to new rowan
2019-04-01 12:06:24 +03:00
Lenard Pratt
7f3bf7cc73
Added defWithBody
2019-03-30 10:50:00 +00:00
Aleksey Kladov
a3fee2bda0
more realistic test for incrementality
2019-03-26 19:54:52 +03:00
Aleksey Kladov
1325a31e34
reduce visibility
2019-03-26 19:15:39 +03:00
Aleksey Kladov
e28db444df
rename
2019-03-26 19:11:01 +03:00
Aleksey Kladov
b17217b34a
simplify
2019-03-26 18:57:57 +03:00
Aleksey Kladov
cffa3f960e
make stuff private
2019-03-26 18:47:52 +03:00
Aleksey Kladov
8f32477312
more type safety
2019-03-26 18:27:22 +03:00
Aleksey Kladov
071a19537d
strongy-typed ids for macros
2019-03-26 18:03:17 +03:00
Aleksey Kladov
fb8b354dcc
add typed ids
2019-03-26 17:25:14 +03:00
Aleksey Kladov
6e5562224e
remove some dead code
2019-03-26 16:47:52 +03:00
Aleksey Kladov
f6f2d69bb8
simplify
2019-03-26 14:54:05 +03:00
Aleksey Kladov
0b820cacab
move source_id to a separate file
2019-03-26 14:42:28 +03:00
Aleksey Kladov
e231277ab2
make macro parsing a query
2019-03-26 14:13:17 +03:00
Aleksey Kladov
e4646ce0d5
reduce visibility
2019-03-26 13:53:50 +03:00
Aleksey Kladov
5270bca5f7
store macro def inside macro id
...
This solves the problem of "macro expansion can't call into name
resolution, because name resolution calls back into macro expansion"
Because we store macro def as a part of call id, macro expansion just
knows the def!
2019-03-26 13:20:54 +03:00
Florian Diebold
99711c1863
Clean up comments / use nicer Iterator methods
2019-03-25 21:28:36 +01:00
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