Marcus Klaas de Vries
ac216880f5
Implement unlabeled struct field pattern inference
2019-01-19 15:37:25 +03:00
Marcus Klaas de Vries
ab5deb7811
Create struct patterns up to the hir level
2019-01-19 15:37:25 +03:00
Marcus Klaas de Vries
afaa26636e
Add additional pattern variants
2019-01-19 15:37:25 +03:00
Aleksey Kladov
b82fe73d1a
make token set a const-fn
2019-01-19 15:36:58 +03:00
Hirokazu Hata
4729a1b054
Update ARRAY_EXPR grammar
2019-01-16 23:22:14 +09:00
bors[bot]
d75a0368f5
Merge #536
...
536: Introduce variable semicolon block expr r=matklad a=yerke
Fix for https://github.com/rust-analyzer/rust-analyzer/issues/504
Feels a bit hacky...
Co-authored-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
2019-01-16 06:20:09 +00:00
Yerkebulan Tulibergenov
5e35f191fc
add has_semi to ExprStmt
2019-01-15 20:26:46 -08:00
Marcus Klaas de Vries
d67eabb512
Fix type inference for raw (byte) strings
2019-01-14 20:56:14 +01:00
Marcus Klaas de Vries
a9a6a50c75
Fixup tests
2019-01-14 19:30:21 +01:00
Marcus Klaas de Vries
606d66a714
Start moving literal interpretation to the AST (WIP)
2019-01-14 13:56:43 +01:00
Marcus Klaas de Vries
5f5dc20d85
Try implementing integer type inference (WIP)
2019-01-14 13:52:57 +01:00
Marcus Klaas de Vries
a6146d35b1
Implement type inference for literals (WIP)
2019-01-14 13:52:55 +01:00
Hirokazu Hata
6efda8f6ce
Update TUPLE_EXPR grammar
2019-01-13 21:04:03 +09:00
Aleksey Kladov
8e554ea5fa
support ref-patterns
2019-01-13 13:36:06 +03:00
DJMcNab
0b9e462ab0
Fix handling of attributes in positional field lists
2019-01-12 15:42:12 +00:00
Aleksey Kladov
2d3940d0ab
rename TreePtr -> TreeArc
...
This is much clearer about the semantics
2019-01-11 19:59:06 +03:00
DJMcNab
afdb569902
Fix handling of where clauses in tuple structs
2019-01-10 18:21:01 +00:00
Aleksey Kladov
921689b70d
kill text utils
2019-01-08 22:03:13 +03:00
Aleksey Kladov
f553837c1c
upstream text-utils to text_unit
2019-01-08 21:50:04 +03:00
Aleksey Kladov
0c88360eb4
add comment
2019-01-08 21:01:41 +03:00
Aleksey Kladov
702bdacb03
move node at offset to aglo already
2019-01-08 21:01:41 +03:00
Aleksey Kladov
96236a9be5
assist to convert if-let to match
2019-01-08 14:21:29 +03:00
Aleksey Kladov
fa6e0b0d38
itroduce trait for ast tokens
2019-01-08 12:23:10 +03:00
Aleksey Kladov
da0b348ae9
migrate ra_hir to rowan 2.0
2019-01-08 11:28:42 +03:00
Aleksey Kladov
fe53b28250
migrate ra_db to new rowan
2019-01-08 11:20:15 +03:00
Aleksey Kladov
b73c51ff9b
wrap TreePtr
2019-01-08 11:20:15 +03:00
Aleksey Kladov
5618c8ade1
regenerate
2019-01-08 11:20:15 +03:00
Aleksey Kladov
d91a98ec84
switch ra_syntax to new rowan API
2019-01-08 11:20:15 +03:00
Marcus Klaas de Vries
7b0eaef580
Implement type inference for more binary operators
...
Mostly just for primitive numeric types such as u32 and f64. Not
yet a general solution using trait resolution.
2019-01-07 20:11:31 +01:00
Marcus Klaas de Vries
3238c06a5a
Add remaining binary operations to AST
2019-01-07 19:04:25 +01:00
bors[bot]
31c1999505
Merge #440
...
440: Implement type inference for boolean operators r=flodiebold a=marcusklaas
Tried implementing the easiest part of https://github.com/rust-analyzer/rust-analyzer/issues/390 . Hope this is somewhat close to what the intent of the issue was. Found it surprisingly easy to find my way around the repository - it's well organized!
Very grateful for any pointers.
Co-authored-by: Marcus Klaas de Vries <mail@marcusklaas.nl>
2019-01-06 21:28:36 +00:00
Marcus Klaas de Vries
82d9a77dad
Touch up type inference for boolean operators
...
Also try to infer its subexpressions and set type expectations
whenever possible.
2019-01-06 22:17:54 +01:00
Florian Diebold
8e3e5ab2c8
Make FnScopes use hir::Expr
...
This was a bit complicated. I've added a wrapper type for now that does the
LocalSyntaxPtr <-> ExprId translation; we might want to get rid of that or give
it a nicer interface.
2019-01-06 00:29:36 +01:00
Florian Diebold
136aba1cf3
Add HIR Expr machinery
2019-01-05 22:41:12 +01:00
Marcus Klaas de Vries
4fc233a02e
Implement type inference for boolean operators
2019-01-05 21:28:30 +01:00
Aleksey Kladov
79fd6b5c88
change visibility can change pub to pub(crate)
2019-01-05 15:28:07 +03:00
Aleksey Kladov
ea3504057e
split import assist
2019-01-05 13:56:33 +03:00
Florian Diebold
bb029cd29b
Rename traits::impl_item -> impl_block as well, as well as the tests
2019-01-04 19:15:15 +01:00
Florian Diebold
111126ed3c
Type the self parameter
2019-01-04 19:10:50 +01:00
Florian Diebold
ae9530addc
Add HIR for impl blocks
...
Since we need to be able to go from def to containing impl block, as well as the
other direction, and to find all impls for a certain type, a design similar to
the one for modules, where we collect all impls for the whole crate and keep
them in an arena, seemed fitting. The ImplBlock type, which provides the public
interface, then consists only of an Arc to the arena containing all impls, and
the index into it.
2019-01-04 19:10:47 +01:00
Florian Diebold
fe6c4115f6
Rename ImplItem to ImplBlock
...
rustc uses the name ImplItem for items in impls, not the impl {} block itself,
which could lead to confusion.
2019-01-04 18:28:36 +01:00
csmoe
a0ef196d04
add mod doc comments test in ast
2019-01-04 21:51:45 +08:00
csmoe
f604ff5b2f
parse doc comment for items
2019-01-04 21:29:00 +08:00
bors[bot]
6295bbe6ec
Merge #391
...
391: docing parser methods r=csmoe a=csmoe
Co-authored-by: csmoe <csmoe@msn.com>
2019-01-04 04:36:40 +00:00
csmoe
58139c558a
consume trivias for type/const def
2019-01-04 12:22:57 +08:00
csmoe
df591a1e48
doc parsing events
2019-01-04 12:21:47 +08:00
Aleksey Kladov
a4635a199b
more enterprisey assists API
2019-01-03 18:59:17 +03:00
Aleksey Kladov
0a80d9685a
visibility owner
2019-01-03 15:21:31 +03:00
Aleksey Kladov
756e878158
add items from macros to modules
2019-01-01 22:15:35 +03:00
Aleksey Kladov
7dc45745a3
save top-level macros in module items
2019-01-01 22:15:35 +03:00
DJMcNab
0ddeb3b824
Fix the same bug as #396 but for bytes too
2019-01-01 12:10:21 +00:00
DJMcNab
0fd87cbc47
Use an else if
2019-01-01 11:10:08 +00:00
csmoe
b01e707dba
doc parser input
2019-01-01 16:09:32 +08:00
DJMcNab
72ab6f7727
Fix the panic
found whilst fuzzing
2018-12-31 23:02:04 +00:00
csmoe
ea7b569e1b
docing parser methods
2018-12-31 21:00:05 +08:00
bors[bot]
c0d1b17a4e
Merge #366
...
366: parse minus before number literal pattern r=matklad a=csmoe
r?@matklad
![unknown](https://user-images.githubusercontent.com/35686186/50547871-d5449e00-0c7d-11e9-9ff5-1031e78019de.png )
Co-authored-by: csmoe <csmoe@msn.com>
2018-12-30 16:40:16 +00:00
csmoe
53c94e3ad8
parse minus before number literal
2018-12-30 23:25:07 +08:00
DJMcNab
054f22f231
Fix a fuzzing bug and add Cargo.lock to the fuzzing directory
2018-12-29 12:40:08 +00:00
Aleksey Kladov
406505e096
super simplistic macro expansion
2018-12-28 16:59:58 +03:00
Aleksey Kladov
072028e679
add macro-call node
2018-12-28 13:27:30 +03:00
Aleksey Kladov
49b0fe20ab
fix suffix ranges
2018-12-27 15:10:30 +03:00
Aleksey Kladov
a912b261d3
dump validation errors
2018-12-27 15:07:51 +03:00
Aleksey Kladov
359e70d1b2
support literal suffixes
2018-12-27 15:03:18 +03:00
Aleksey Kladov
73ded3c63c
dedupe literal parsers
2018-12-27 14:42:46 +03:00
Florian Diebold
cdca397061
Add a hir::TypeRef as an intermediate between ast::TypeRef and ty::Ty
2018-12-25 21:14:13 +01: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
ab0b63992b
Implement basic completion for fields
2018-12-25 15:27:15 +01:00
Florian Diebold
0d724ea572
Improve parsing of incomplete field accesses in preparation for field completion
...
We need to be able to get the receiver even if there is no field name yet, and
currently "a." wouldn't get parsed as a field name at all. This seems to help.
2018-12-25 15:16:42 +01:00
Florian Diebold
55c941cd9f
Type field accesses
2018-12-25 15:16:42 +01:00
Florian Diebold
4cb7b0f2af
Add AST definitions for struct/variant fields etc.
...
Fixes #117
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
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
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
bors[bot]
e4d0930d9c
Merge #316
...
316: Fix handling of nested self in paths r=matklad a=DJMcNab
See https://github.com/rust-analyzer/rust-analyzer/issues/231#issuecomment-442449505 .
Co-authored-by: DJMcNab <36049421+djmcnab@users.noreply.github.com>
2018-12-21 23:19:14 +00:00
DJMcNab
4dbf71d332
Remove uneeded todo in lexer
2018-12-21 22:41:09 +00:00
DJMcNab
d8d60215da
Fix handling of nested self in paths
2018-12-21 22:29:59 +00:00
DJMcNab
bd5a358910
Fix where clauses using fully qualified path syntax
2018-12-21 17:20:38 +00:00
Aleksey Kladov
a5987bd715
show debug repr of literals
2018-12-21 18:49:52 +03:00
DJMcNab
55ebe449c9
Fix parsing of contextual_keyword union
2018-12-20 19:46:03 +00:00
DJMcNab
1d1950336f
Use a better way of skipping SEMIs
2018-12-20 19:07:11 +00:00
DJMcNab
dc1c64f5b9
Support a blank expression before a semicolon
2018-12-20 19:07:11 +00:00
DJMcNab
134fe4f566
Fix the tests and fix the precommit hook
2018-12-20 16:45:54 +00:00
DJMcNab
466885aa5b
Fix missing DOTDOTEQs
2018-12-20 16:22:13 +00:00
DJMcNab
f35151afed
Don't require a command before EQ in a where clause
2018-12-20 15:50:42 +00:00
DJMcNab
27e814e182
Simplify NO_BLOCK testing
2018-12-20 12:28:59 +00:00
DJMcNab
5205c016e9
Fix ambiguity with if break
...
Brought up by #290
2018-12-20 11:35:02 +00:00
DJMcNab
a3b842fb8b
Add tests and only traverse in the crates directory
2018-12-19 21:19:32 +00:00
DJMcNab
db67741430
Move is_block to lower in the call tree
2018-12-19 20:55:24 +00:00
DJMcNab
def0a95d35
Revert "Revert to f6f7c5"
...
This approach is correct, but it needs an addition to Restrictions too
This reverts commit ad00d0c8a5f64142e6636e8b048204c8f8982f4a.
2018-12-19 20:12:18 +00:00
DJMcNab
4dce66ad31
Fix handling of structs in match arms
2018-12-19 20:12:18 +00:00
DJMcNab
cd8e33fb7e
Revert to f6f7c5
2018-12-19 20:12:18 +00:00
DJMcNab
7a8560ba38
Fix expression parsing by bailing out upon a macro block being found
...
TODO: Fix this when the block like macro is in expression position
E.g. `test(test!{})` currently parses
2018-12-19 20:12:18 +00:00
DJMcNab
97e70bf50f
Possibly fix #225
2018-12-19 20:12:18 +00:00
DJMcNab
29bf389034
Actually fix at_ts doc comment (committed wrong file :P)
2018-12-19 20:12:18 +00:00
DJMcNab
012537bd6c
Fix at_ts doc comment
2018-12-19 20:12:18 +00:00
DJMcNab
20bbe0127c
Fix parsing of inclusive ranges ( #214 )
...
I'm not certain that this is correct, so extra eyes would be good
2018-12-19 20:12:18 +00:00
Roland Ruckerbauer
d0f1334226
Fixed cast expression parsing in ra_syntax.
...
The cast expression expected any type via types::type_() function,
but the language spec does only allow TypeNoBounds (types without direct extra bounds
via `+`).
**Example:**
```rust
fn test() {
6i8 as i32 + 5;
}
```
This fails, because the types::type_() function which should parse the type after the
as keyword is greedy, and takes all plus sign after path types as extra.
My proposed fix is to replace the not implemented `type_no_plus()` just calls (`type_()`)
function, which is used at several places. The replacement is `type_with_bounds_cond(p: &mut Parser, allow_bounds: bool)`, which passes the condition to relevant sub-parsers.
This function is then called by `type_()` and the new public `type_no_bounds()`.
2018-12-17 17:26:24 +01:00
Bernardo
0527e3b283
rename Edit to TextEdit and AtomEdit to AtomTextEdit
2018-12-11 19:07:17 +01:00
Bernardo
7344d28768
extract AtomEdit and Edit into new ra_text_edit crate
2018-12-10 22:09:12 +01:00
Aleksey Kladov
4cbc902fcc
grand module rename
2018-12-08 19:30:35 +03:00
DJMcNab
f88e0700e6
Add a better text for hover and stop duplicating work done in approximatelly_resolve_symbol
2018-12-08 19:28:10 +03:00
DJMcNab
89cf7d8743
Clarify and correct comment about multi_byte_tokens
2018-12-08 19:28:10 +03:00
Florian Diebold
1dfd06fc8a
Use json comparison code from cargo for heavy tests
2018-12-06 21:32:15 +01:00
Aleksey Kladov
28ddecf6c9
modernize even more
2018-12-06 21:16:37 +03:00
Aleksey Kladov
1761a7d213
modernize some files
2018-12-06 20:49:36 +03:00
bors[bot]
25cf2349ab
Merge #256
...
256: Improve/add use_item documentation r=matklad a=DJMcNab
Adds some documentation to use_item explaining all code paths (use imports are hard, especially with the ongoing discussion of anchored v. uniform paths - see https://github.com/rust-lang/rust/issues/55618 for what appears to be the latest developments)
Co-authored-by: DJMcNab <36049421+djmcnab@users.noreply.github.com>
2018-12-06 17:30:36 +00:00
DJMcNab
5da245ec33
Fix a copy and pasting typo
2018-12-05 21:46:43 +00:00
DJMcNab
0a82d768c4
Improve/add the use_item documentation
2018-12-05 21:43:40 +00:00
Aleksey Kladov
ebc4e75253
switch back to the latest beta
2018-11-24 21:52:49 +03:00
Aleksey Kladov
edeec6a414
Complete paths after ::
2018-11-21 18:34:20 +03:00
Aleksey Kladov
bcdcfa9df2
Some import resolution boilerplate
2018-11-20 19:24:58 +03:00
Adolfo Ochagavía
c96bfe7e2d
Split string lexing and run rustfmt
2018-11-11 21:00:31 +01:00
Adolfo Ochagavía
30cd4d5acb
Validate byte string literals
2018-11-11 20:41:43 +01:00
Adolfo Ochagavía
c258b4fdb0
Add validator for byte
2018-11-11 20:27:00 +01:00
Adolfo Ochagavía
3b4c02c19e
Validate string literals
2018-11-09 14:52:17 +01:00
Aleksey Kladov
6d253b58da
Complete paths in use trees
2018-11-07 21:38:41 +03:00
Aleksey Kladov
2ed1514df3
rename ROOT -> SOURCE_FILE
2018-11-07 18:42:36 +03:00
Aleksey Kladov
f8b36bbc3b
Rename File -> SourceFileNode
2018-11-07 18:42:36 +03:00
Jeremy A. Kolb
6df71da81f
Add some more DocCommentsOwner
2018-11-07 18:24:55 +03:00
bors[bot]
2e2445444a
Merge #207
...
207: Finish implementing char validation r=aochagavia a=aochagavia
The only thing missing right now are good integration tests (and maybe more descriptive error messages)
Co-authored-by: Adolfo Ochagavía <github@adolfo.ochagavia.xyz>
2018-11-07 11:09:40 +00:00
Adolfo Ochagavía
433a806191
Fix backslash escape
2018-11-07 12:04:26 +01:00
Adolfo Ochagavía
3b2ba59526
Use ArrayString instead of hand rolled data structure
2018-11-07 11:58:34 +01:00
Adolfo Ochagavía
e37ba706cc
cargo format
2018-11-07 11:41:42 +01:00
Adolfo Ochagavía
94796e6447
Add lots of tests
2018-11-07 11:35:33 +01:00
Adolfo Ochagavía
fdb9f06880
Store hex digits in a stack-allocated buffer
2018-11-07 10:40:58 +01:00
Aleksey Kladov
8eaf7952ae
ra_syntax::File is just RootNode
2018-11-06 23:26:26 +03:00
Aleksey Kladov
7f88fe8790
Add a pinch of comments
2018-11-06 22:06:58 +03:00
Aleksey Kladov
a5301e94d5
Generalize Owned nodes
2018-11-06 21:52:00 +03:00
Aleksey Kladov
ec131b6c7b
grammar: fix where clause parsing
...
closes #205
2018-11-06 21:19:32 +03:00
Aleksey Kladov
dafe747dcc
upstream basic tree algorithms to rowan
2018-11-06 20:56:32 +03:00
Adolfo Ochagavía
c56db92d1f
Finish implementing char validation
2018-11-06 17:07:27 +01:00
bors[bot]
f605f6e70a
Merge #188
...
188: Introduce `SyntaxErrorKind` and `TextRange` to `SyntaxError` r=matklad a=aochagavia
Co-authored-by: Adolfo Ochagavía <aochagavia92@gmail.com>
Co-authored-by: Adolfo Ochagavía <github@adolfo.ochagavia.xyz>
2018-11-05 21:32:25 +00:00
Adolfo Ochagavía
59405bfe4a
cargo format
2018-11-05 22:29:33 +01:00
Adolfo Ochagavía
fda8ddc5fe
Introduce Location and make SyntaxError fields private
2018-11-05 18:38:34 +01:00
Aleksey Kladov
80e50cae00
Switch ra_syntax to 2015 edition
2018-11-05 15:47:59 +03:00
Aleksey Kladov
6502bd2c96
reduce code duplication
2018-11-05 11:39:51 +03:00
Aleksey Kladov
9010cb9839
grammar: for predicates in where
...
closes #191
2018-11-05 11:24:08 +03:00
Adolfo Ochagavía
3b42ddae60
Introduce SyntaxErrorKind and TextRange in SyntaxError
2018-11-04 21:16:38 +01:00
Adolfo Ochagavía
9b5bbab104
Add character literal parsing and validation
2018-11-04 15:17:24 +01:00
Aleksey Kladov
cca5f862de
Don't order import alphabetical
...
alphabetical ordering is no more consistent, and much less useful then
the ordering which arises naturally when you add import.
2018-11-01 16:18:53 +03:00
Aleksey Kladov
d685a9b564
Use From to get an owned AST
2018-11-01 13:41:20 +03:00
Jeremy A. Kolb
61580f3cb8
Remove DOC_COMMENT
...
Closes #166
2018-10-31 17:38:18 -04:00
Aleksey Kladov
6be50f7d5d
Reformat all
2018-10-31 23:41:43 +03:00
Jeremy A. Kolb
d2bcd1a386
ast::DocCommentsOwner
which represents a documentation comment owner
2018-10-31 15:08:37 -04:00
Aleksey Kladov
b67295134b
Move FnDescriptors to analyzer
2018-10-31 10:56:31 +03:00
Aleksey Kladov
3068af79ff
Introduce owned ast nodes
...
ast::FooNode is an owned 'static counterpart to ast::Foo<'a>
2018-10-31 10:29:32 +03:00
Aleksey Kladov
1643d94a65
switch to TextRange::subrange
2018-10-30 21:26:55 +03:00
Aleksey Kladov
69d07df201
Complete crate:: paths
2018-10-24 18:37:25 +03:00