aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/tests.rs
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* Fix another crash found when analyzing rustcFlorian Diebold2019-02-091-0/+15
|
* Fix handling of literal patternsFlorian Diebold2019-02-091-0/+15
| | | | | Wrap them in a LiteralPat node so they can be distinguished from literal expressions.
* Fix two crashes found by running inference on all of rustcFlorian Diebold2019-02-091-0/+33
|
* reformat the worldAleksey Kladov2019-02-081-7/+2
|
* Test more Self inferencekjeremy2019-02-041-0/+6
|
* Merge #701bors[bot]2019-01-301-1/+3
|\ | | | | | | | | | | | | | | | | | | 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 <[email protected]>
| * Add test for passing on ref expectationsMarcus Klaas de Vries2019-01-301-0/+1
| |
| * Infer type of match guardMarcus Klaas de Vries2019-01-281-1/+2
| |
* | Added support for primitive types type inference when using std::ops::NotWizardOfMenlo2019-01-281-0/+5
| |
* | Process second reviewMarcus Klaas de Vries2019-01-271-4/+2
| |
* | Use type information from the turbofishMarcus Klaas de Vries2019-01-271-0/+3
| |
* | First attempt at generic type inference for fnsMarcus Klaas de Vries2019-01-271-0/+22
|/
* Add marksFlorian Diebold2019-01-261-0/+5
|
* Handle cycles in type varsFlorian Diebold2019-01-261-0/+27
| | | | This might be the cause of #587.
* fix AST for if expressionsAleksey Kladov2019-01-261-0/+17
| | | | then is not always a block...
* rename source_file -> parseAleksey Kladov2019-01-261-1/+1
|
* rename FilesDatabase -> SourceDatabaseAleksey Kladov2019-01-261-1/+1
|
* fold syntax database into files databaseAleksey Kladov2019-01-261-1/+1
|
* Fix type inference of binops on int/float variablesFlorian Diebold2019-01-251-0/+13
| | | | Fixes #651.
* move SyntaxPtr to ra_syntaxAleksey Kladov2019-01-231-1/+1
|
* Use insta for ty testsFlorian Diebold2019-01-211-47/+29
|
* Fix panic trying to get substs on unknown typeFlorian Diebold2019-01-211-0/+16
| | | | Fixes #585.
* Fix panic on inferring field access on an enumFlorian Diebold2019-01-201-0/+14
|
* Make generics work in struct patternsFlorian Diebold2019-01-191-0/+26
|
* Add some testsFlorian Diebold2019-01-191-0/+63
|
* Fixup annotated bindingsMarcus Klaas de Vries2019-01-191-1/+5
|
* Add initial (flawed) implementation of binding annotationsMarcus Klaas de Vries2019-01-191-0/+4
|
* Infer pattern types for lambdas and loopsMarcus Klaas de Vries2019-01-191-0/+10
|