aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/tests.rs
Commit message (Collapse)AuthorAgeFilesLines
* make AstId untypedAleksey Kladov2019-05-131-1/+1
|
* Use traits from prelude for method resolutionFlorian Diebold2019-05-121-0/+29
|
* Blacklist some traits from being considered in where clausesFlorian Diebold2019-05-121-6/+6
| | | | | | | For Send/Sync/Sized, we don't handle auto traits correctly yet and because they have a lot of impls, they can easily lead to slowdowns. In the case of Fn/FnMut/FnOnce, we don't parse the special Fn notation correctly yet and don't handle closures yet, so we are very unlikely to find an impl.
* Add support for inline boundsFlorian Diebold2019-05-111-0/+33
| | | | E.g. impl<T: Clone> Foo for T.
* Reduce Chalk max_size parameter, add test for slow caseFlorian Diebold2019-05-111-0/+29
|
* Handle Chalk conversion for FnDefFlorian Diebold2019-05-111-0/+13
|
* Handle resolution errors in where clausesFlorian Diebold2019-05-111-0/+15
| | | | | This is slightly hacky, but maybe more elegant than alternative solutions: We just use a hardcoded Chalk trait ID which we special-case to have no impls.
* Handle where clauses in trait solvingFlorian Diebold2019-05-111-3/+38
|
* fill struct fields diagnosticSergey Parilin2019-05-061-0/+1
|
* Chalk integrationFlorian Diebold2019-05-041-1/+1
| | | | | - add proper canonicalization logic - add conversions from/to Chalk IR
* Introduced resolve_macro_call on resolverLenard Pratt2019-04-231-0/+26
| | | | | | changed to manual expansion fix for nested macros
* Add HIR for where clauses & ignore impls with where clauses in trait resolutionFlorian Diebold2019-04-211-0/+17
| | | | | This prevents any `impl<T> Trait for T where ...` from being treated as a blanket impl while we don't handle where clauses yet.
* Add a simple test for str method completionFlorian Diebold2019-04-201-0/+22
|
* Fix 1099Edwin Cheng2019-04-171-2/+61
|
* Refactor method candidate generation a bitFlorian Diebold2019-04-141-0/+65
| | | | | | This fixes the order in which candidates are chosen a bit (not completely though, as the ignored test demonstrates), and makes autoderef work with trait methods. As a side effect, this also makes completion of trait methods work :)
* More trait infrastructureFlorian Diebold2019-04-141-8/+43
| | | | | | | | | | - make it possible to get parent trait from method - add 'obligation' machinery for checking that a type implements a trait (and inferring facts about type variables from that) - handle type parameters of traits (to a certain degree) - improve the hacky implements check to cover enough cases to exercise the handling of traits with type parameters - basic canonicalization (will probably also be done by Chalk)
* simplifyAleksey Kladov2019-04-121-11/+12
|
* simplify testsAleksey Kladov2019-04-121-26/+13
|
* type-safer source-map for bindingsAleksey Kladov2019-04-101-1/+1
|
* updated snapshotsLenard Pratt2019-04-071-41/+41
|
* Parse and infer tuple indicesrobojumper2019-04-061-0/+59
|
* Merge #1076bors[bot]2019-04-021-4/+57
|\ | | | | | | | | | | | | | | | | 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 <[email protected]>
| * Added const bodies and static body to the astLenard Pratt2019-04-021-4/+57
| | | | | | | | | | | | and added inference the inference test reduce code duplication
* | switch to new rowanAleksey Kladov2019-04-011-8/+6
|/
* Implement a very naive implements checkFlorian Diebold2019-03-251-1/+1
| | | | ... to make the infer_trait_method_simple test have the correct result.
* Basics for trait method resolutionFlorian Diebold2019-03-251-6/+6
|
* test diagnosticsAleksey Kladov2019-03-251-0/+24
|
* Fix apply_substs assertion failureFlorian Diebold2019-03-231-0/+23
| | | | Fixes #1030.
* Merge #982bors[bot]2019-03-171-0/+54
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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](https://github.com/rust-lang/rust/blob/e17c48e2f21eefd59748e364234efc7037a3ec96/src/librustc_typeck/check/_match.rs#L77) (and [definition of `BindingMode`](https://github.com/rust-lang/rust/blob/e957ed9d10ec589bdd523b88b4b44c41b1ecf763/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 <[email protected]>
| * Split test case and use tested_by!.Michael Killough2019-03-171-76/+99
| |
| * Implement BindingMode for pattern matching.Michael Killough2019-03-161-45/+76
| | | | | | | | | | | | | | 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.
* | Replace Display by a pretty printing trait for TyFlorian Diebold2019-03-161-2/+3
|/ | | | | This allows removing the names from Adt and FnDef (and more later), as a first step towards aligning more with chalk's Ty :)
* Inline type inference test snapshotsFlorian Diebold2019-03-031-244/+1096
|
* Add a bunch of tests for type inference involving traitsFlorian Diebold2019-03-021-0/+235
| | | | None of them works correctly yet, of course.
* rename syntax-mapping -> source-mapAleksey Kladov2019-03-021-5/+5
|
* Add const type inferenceVille Penttinen2019-02-251-0/+37
|
* Add test for recursive type aliasesFlorian Diebold2019-02-241-0/+14
|
* Implement support for type aliasesFlorian Diebold2019-02-241-0/+21
|
* Refactor associated method resolution a bit and make it work with genericsFlorian Diebold2019-02-231-1/+0
|
* Fix resolution of associated method calls across cratesFlorian Diebold2019-02-231-2/+39
| | | | | | 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.
* Merge #866bors[bot]2019-02-221-0/+134
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]>
| * Ignore failing test for nowVille Penttinen2019-02-211-0/+1
| |
| * Implement basic support for Associated Methods and ConstantsVille Penttinen2019-02-211-0/+133
| | | | | | | | | | | | | | 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.
* | Fix handling of generics in tuple variants and refactor a bitFlorian Diebold2019-02-201-0/+21
|/ | | | | | Also make them display a tiny bit nicer. Fixes #860.
* handle != operatorAleksey Kladov2019-02-181-0/+1
|
* Unify with the autorefed/autoderefed receiver type during method resolutionFlorian Diebold2019-02-171-0/+20
|
* Add a test for impl genericsFlorian Diebold2019-02-161-0/+32
|
* Fix another crashFlorian Diebold2019-02-121-0/+19
|
* Add comment and markFlorian Diebold2019-02-091-0/+1
|
* Fix another crash, and try harder to prevent stack overflowsFlorian Diebold2019-02-091-0/+25
|