Commit graph

4269 commits

Author SHA1 Message Date
Aleksey Kladov
5a012fb9fd Implement ra_lsp_server --version 2019-12-09 16:11:46 +01:00
bors[bot]
6b1c2ee168
Merge #2500 #2505 #2506
2500: Fix format_args expansion & go to definition r=matklad a=flodiebold

The expansion of format_args wasn't yet correct enough to type-check. Also make macros in statement position expand to expressions for now, since it's not handled correctly in HIR lowering yet. This finally fixes go to definition within print macros, I think 🙂 

2505: Remove more dead code r=matklad a=matklad



2506: Remove one more Ty r=matklad a=matklad



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-08 16:53:21 +00:00
Aleksey Kladov
61c3887b70 Remove one more Ty 2019-12-08 17:50:43 +01:00
Aleksey Kladov
a1639d0d1e Remove more dead code 2019-12-08 17:45:14 +01:00
Aleksey Kladov
6805bb01e2 Cleanup module structure 2019-12-08 17:45:14 +01:00
bors[bot]
d0ad30ad97
Merge #2501 #2502 #2503
2501: Fix coercion from &Foo to an inference variable in a reference r=matklad a=flodiebold

We didn't try to unify within the reference, but we should.

2502: Delay legacy macro expansion r=matklad a=edwin0cheng

This PR make the following changes:

* Delay legacy macro expansion such that we concentrated all item collecting macro expansion in one place.
* Add `MacroDirective` to replace 3-tuples 
* After this refactoring, no macro is expanded recursively, hence we can remove the `MacroStackMonitor` and we handle the expansion limit by the fix-point loop count. 

2503: Code: check whether the LSP binary is in PATH r=matklad a=lnicola

I'm not really sure about the TS changes. I just made a couple of functions async and it seems to work.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2019-12-08 16:44:29 +00:00
Edwin Cheng
3a95d01d0c Delay legacy macro expansion 2019-12-08 20:33:42 +08:00
Florian Diebold
d0c9bb0abf Fix coercion from &Foo to an inference variable in a reference
We didn't try to unify within the reference, but we should.
2019-12-08 13:06:59 +01:00
Florian Diebold
5e096def15 Expand macros in blocks to expressions for now
Expanding to statements isn't handled properly yet and breaks things.
2019-12-08 13:03:13 +01:00
Florian Diebold
2223620313 Fix range in goto_through_format test 2019-12-08 13:02:52 +01:00
Florian Diebold
91f28e43a2 Fix expansion of format_args 2019-12-08 13:02:52 +01:00
bors[bot]
596e6db46c
Merge #2499
2499: Remove ty from code_model r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-08 11:52:43 +00:00
Aleksey Kladov
e2cc552076 Remove dead code 2019-12-08 12:51:25 +01:00
Aleksey Kladov
b37c6a746b Remove ty from code_model 2019-12-08 12:44:14 +01:00
Aleksey Kladov
b77d7c24aa Remove bodies from code_model 2019-12-08 12:27:21 +01:00
Aleksey Kladov
b017bae837 remove infer method from CodeModel 2019-12-08 12:26:53 +01:00
bors[bot]
7a6b6ed0a5
Merge #2498
2498: Drop some unused methods r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-08 11:24:44 +00:00
Aleksey Kladov
7aacf9a197 Drop some unused methods 2019-12-08 12:24:21 +01:00
Aleksey Kladov
200bda3daf Cleanup Field ty 2019-12-08 12:16:57 +01:00
Aleksey Kladov
08d3166c8b Cleanup Crate API 2019-12-08 12:02:53 +01:00
bors[bot]
b236f6aa49
Merge #2466
2466: Handle partial resolve cases r=matklad a=edwin0cheng

Another try to fix #2443 :

We resolve all imports every time in `DefCollector::collect` loop even it is resolved previously.  
This is because other unresolved imports and macros will bring in another `PerNs`, so we can only assume that it has been partially resolved.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-08 10:44:30 +00:00
Edwin Cheng
509fedd9d2 Remove MacroFileKind 2019-12-08 16:16:52 +08:00
Aleksey Kladov
6e2e60cbc9 Discover type parameters in more cases 2019-12-07 21:55:02 +01:00
Aleksey Kladov
88c5b1282a Rename GenericParam -> TypeParam
We don't have LifetimeParam yet, but they are planned!
2019-12-07 20:25:48 +01:00
Aleksey Kladov
f4f8b81474 Get the right analyzer for impls 2019-12-07 20:05:08 +01:00
Aleksey Kladov
7d2080a031 Classify name works for TypeParams 2019-12-07 19:52:09 +01:00
Aleksey Kladov
d1a01aa2f8 Gotodef for TypeParameters 2019-12-07 19:44:43 +01:00
Aleksey Kladov
1692f07393 ToNav for GenericParam 2019-12-07 19:44:43 +01:00
Aleksey Kladov
dda9587e75 Track source of type parameters 2019-12-07 19:44:43 +01:00
Aleksey Kladov
d75f768c13 Minor 2019-12-07 19:44:43 +01:00
Aleksey Kladov
decc4cb084 Show type hints for & patterns 2019-12-07 19:15:52 +01:00
Aleksey Kladov
6bd9fb8525
Merge pull request #2491 from matklad/skip-heavy-tests-by-default
Skip slow tests by default
2019-12-07 13:46:02 +01:00
Aleksey Kladov
8ec5f2fcdc Skip slow tests by default 2019-12-07 13:19:42 +01:00
Aleksey Kladov
29b5e1ec2a Reformat 2019-12-07 13:19:21 +01:00
Aleksey Kladov
d6c2b92409 Refactor parameter count tracking 2019-12-07 13:13:00 +01:00
Aleksey Kladov
8e9837df21 Remove idx and parent generics from generics
This makes `hir_def::GenericParams` flatter. The logic for
re-numbering the params is moved to hir instead.
2019-12-07 13:05:56 +01:00
Aleksey Kladov
30fefcc08c Store GenericParams in arena 2019-12-07 13:05:56 +01:00
Edwin Cheng
51f4fb448f Refactor resolve_imports logic 2019-12-07 19:24:15 +08:00
Florian Diebold
de08d30b80 Get rid of unwraps in add_new
Probably fixes #2464.
2019-12-07 11:54:26 +01:00
Edwin Cheng
e5997e1746 Push glob_imports only if non-exists 2019-12-07 09:50:21 +08:00
bors[bot]
431836f4a0
Merge #2489
2489: Implement `format_args` r=flodiebold a=flodiebold

This fixes a huge amount of type mismatches (because every format call was a type mismatch so far); I also hoped to get go to def working within `format!` etc., and the test says it should, but in practice it still doesn't seem to...

Also remove the `len` parameter from `Name::new_inline_ascii`, which I'm assuming was only there because of `const fn` limitations?

cc @edwin0cheng 

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-12-06 20:59:51 +00:00
Florian Diebold
b2c01f446e Implement ancestors_with_macros in a better way 2019-12-06 21:53:31 +01:00
bors[bot]
f18b7e18c4
Merge #2484
2484: DynMap r=matklad a=matklad

Implement a `DynMap` a semi-dynamic, semi-static map, which helps to thread heterogeneously typed info in a uniform way. Totally inspired by df3bee3038/compiler/frontend/src/org/jetbrains/kotlin/resolve/BindingContext.java. 

@flodiebold wdyt? Seems like a potentially useful pattern for various source-map-like things.

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-06 20:28:28 +00:00
Aleksey Kladov
8c86963d47 DynMap
This might, or might not help us to reduce boilerplate associated with
plumbing values from analysis to the IDE layer
2019-12-06 21:28:05 +01:00
Florian Diebold
c80dc0ad3a Make the goto_through_format test actually fail :( 2019-12-06 21:25:22 +01:00
Florian Diebold
4a99ef5c39 Builtin macros only use caller tokens 2019-12-06 21:25:22 +01:00
Florian Diebold
a565072dde Try to make go to definition work in format!
SourceAnalyzer didn't work properly within expression macro expansions because
it didn't find the enclosing function. Fix this by going up the expansion chain
to find ancestors. This makes the test work, but apparently in real usage it's
still not working.
2019-12-06 21:25:22 +01:00
Florian Diebold
eae425b10f Implement format_args more properly 2019-12-06 21:25:22 +01:00
Florian Diebold
3a5aa03e66 Remove unnecessary len parameter for Name::new_inline_ascii
I assume it was previously required because `len` was not const, but that
doesn't seem to be a problem anymore.
2019-12-06 21:25:22 +01:00
Florian Diebold
c5ffb0dc81 Add stub implementation of format_args{_nl} macros
Just enough to fix the huge amount of type mismatches they cause.
2019-12-06 21:25:22 +01:00