aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/tests/traits.rs
Commit message (Collapse)AuthorAgeFilesLines
* Fix inference of indexing argument (partly)Florian Diebold2020-07-031-0/+36
| | | | | | | | We need to add the `T: Index<Arg>` obligation to be resolved later as well, otherwise we can't make inferences about `Arg` later based on the `Index` impls. This still doesn't fix indexing with integer variables though; there's a further problem with Chalk floundering because of the variable, I think.
* Implement Chalk variable kindsFlorian Diebold2020-07-011-0/+18
| | | | | | | | | This means we need to keep track of the kinds (general/int/float) of variables in `Canonical`, which requires some more ceremony. (It also exposes some places where we're not really dealing with canonicalization correctly -- another thing to be cleaned up when we switch to using Chalk's types directly.) Should fix the last remaining issue of #2534.
* Update the rest of the testsAleksey Kladov2020-06-291-212/+130
|
* Bump chalkLaurențiu Nicola2020-06-261-4/+4
|
* Use only one code-path for parsing fixturesAleksey Kladov2020-06-231-747/+747
| | | | | This removes leading newlines everywhere, shifting all ranges in tests by one
* Push obligation instead of matching on solutionadamrk2020-06-201-4/+4
|
* Add test for dyn Fn Outputadamrk2020-06-201-0/+68
|
* move tests to ra_hir_tyadamrk2020-06-201-0/+155
|
* Make known paths use `core` instead of `std`Jonas Schievink2020-06-111-14/+16
|
* Fix type parameter defaultsFlorian Diebold2020-06-051-27/+27
| | | | | They should not be applied in expression or pattern contexts, unless there are other explicitly given type args.
* Review fixesFlorian Diebold2020-06-051-15/+58
|
* Implement return position impl trait / opaque type supportFlorian Diebold2020-06-051-1/+46
| | | | | | | | | | | | | This is working, but I'm not that happy with how the lowering works. We might need an additional representation between `TypeRef` and `Ty` where names are resolved and `impl Trait` bounds are separated out, but things like inference variables don't exist and `impl Trait` is always represented the same way. Also note that this doesn't implement correct handling of RPIT *inside* the function (which involves turning the `impl Trait`s into variables and creating obligations for them). That intermediate representation might help there as well.
* Upgrade ChalkFlorian Diebold2020-05-291-5/+49
| | | | Fixes #4072.
* Use Chalk's Ty::Function for function pointer typesFlorian Diebold2020-05-221-0/+32
| | | | | | Function pointers can be 'higher-ranked' over lifetimes, which is why they're not an application type in Chalk, but since we don't model lifetimes it doesn't matter for us yet.
* Use Chalk's built-in representation of function item typesFlorian Diebold2020-05-221-0/+42
|
* Add some tests for Chalk built-in trait implsFlorian Diebold2020-05-221-0/+78
|
* Switch to new magic marksAleksey Kladov2020-05-201-4/+4
|
* Add more tests for Fn traitsHrvoje Ban2020-05-181-0/+132
|
* Remove whitespacesEdwin Cheng2020-05-031-1/+1
|
* Support macro for trait itemsEdwin Cheng2020-05-031-19/+21
|
* For associated type shorthand (T::Item), use the substs from the where clauseFlorian Diebold2020-04-261-0/+30
| | | | | So e.g. if we have `fn foo<T: SomeTrait<u32>>() -> T::Item`, we want to lower that to `<T as SomeTrait<u32>>::Item` and not `<T as SomeTrait<_>>::Item`.
* Convert tests to text-sizeAleksey Kladov2020-04-251-553/+553
|
* Merge #4023bors[bot]2020-04-181-0/+36
|\ | | | | | | | | | | | | | | 4023: Fix another crash from wrong binders r=matklad a=flodiebold Basically, if we had something like `dyn Trait<T>` (where `T` is a type parameter) in an impl we lowered that to `dyn Trait<^0.0>`, when it should be `dyn Trait<^1.0>` because the `dyn` introduces a new binder. With one type parameter, that's just wrong, with two, it'll lead to crashes. Co-authored-by: Florian Diebold <[email protected]>
| * Fix another crash from wrong bindersFlorian Diebold2020-04-171-0/+36
| | | | | | | | | | | | | | Basically, if we had something like `dyn Trait<T>` (where `T` is a type parameter) in an impl we lowered that to `dyn Trait<^0.0>`, when it should be `dyn Trait<^1.0>` because the `dyn` introduces a new binder. With one type parameter, that's just wrong, with two, it'll lead to crashes.
* | Fix type equality for dyn TraitFlorian Diebold2020-04-171-0/+24
| | | | | | | | | | | | | | Fixes a lot of false type mismatches. (And as always when touching the unification code, I have to say I'm looking forward to replacing it by Chalk's...)
* | Add two more tests for associated typesFlorian Diebold2020-04-171-0/+174
|/
* Test for non-working proc macro server assoc typesFlorian Diebold2020-04-161-0/+68
|
* Switch Chalk to recursive solverFlorian Diebold2020-04-161-29/+21
| | | | + various fixes related to that.
*-. Merge #3966 #3968bors[bot]2020-04-151-0/+27
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 3966: Add support for bounds on associated types in trait definitions r=matklad a=flodiebold E.g. ```rust trait Trait { type Item: SomeOtherTrait; } ``` Note that these don't simply desugar to where clauses; as I understand it, where clauses have to be proved by the *user* of the trait, but these bounds are proved by the *implementor*. (Also, where clauses on associated types are unstable.) (Another one from my recursive solver branch...) 3968: Remove format from syntax_bridge hot path r=matklad a=edwin0cheng Although only around 1% speed up by running: ``` Measure-Command {start-process .\target\release\rust-analyzer "analysis-stats -q ." -NoNewWindow -wait} ``` Co-authored-by: Florian Diebold <[email protected]> Co-authored-by: Edwin Cheng <[email protected]>
| * | Add support for bounds on associated types in trait definitionsFlorian Diebold2020-04-131-0/+27
| |/ | | | | | | | | | | | | | | | | | | | | | | E.g. ``` trait Trait { type Item: SomeOtherTrait; } ``` Note that these don't simply desugar to where clauses; as I understand it, where clauses have to be proved by the *user* of the trait, but these bounds are proved by the *implementor*. (Also, where clauses on associated types are unstable.)
| |
| \
*-. \ Merge #3964 #3965 #3967bors[bot]2020-04-151-1/+72
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 3964: Nicer Chalk debug logs r=matklad a=flodiebold I'm looking at a lot of Chalk debug logs at the moment, so here's a few changes to make them slightly nicer... 3965: Implement inline associated type bounds r=matklad a=flodiebold Like `Iterator<Item: SomeTrait>`. This is an unstable feature, but it's used in the standard library e.g. in the definition of Flatten, so we can't get away with not implementing it :) (This is cherry-picked from my recursive solver branch, where it works better, but I did manage to write a test that works with the current Chalk solver as well...) 3967: Handle `Self::Type` in trait definitions when referring to own associated type r=matklad a=flodiebold It was implemented for other generic parameters for the trait, but not for `Self`. (Last one off my recursive solver branch :smile: ) Co-authored-by: Florian Diebold <[email protected]>
| | * Handle `Self::Type` in trait definitions when referring to own associated typeFlorian Diebold2020-04-131-1/+25
| |/ |/| | | | | It was implemented for other generic parameters for the trait, but not for `Self`.
| * Implement inline associated type boundsFlorian Diebold2020-04-131-0/+47
|/ | | | | | | Like `Iterator<Item: SomeTrait>`. This is an unstable feature, but it's used in the standard library e.g. in the definition of Flatten, so we can't get away with not implementing it :)
* Fix Chalk panicFlorian Diebold2020-04-061-0/+25
| | | | | Fixes #3865. Basically I forgot to shift 'back' when we got `dyn Trait`s back from Chalk, so after going through Chalk a few times, the panic happened.
* Hide unit fn return typesLaurențiu Nicola2020-04-051-6/+6
|
* Resolve `Self::AssocTy` in implsFlorian Diebold2020-03-061-0/+41
| | | | | | | | | | To do this we need to carry around the original resolution a bit, because `Self` gets resolved to the actual type immediately, but you're not allowed to write the equivalent type in a projection. (I tried just comparing the projection base type with the impl self type, but that seemed too dirty.) This is basically how rustc does it as well. Fixes #3249.
* Do autoderef for indexingFlorian Diebold2020-02-291-0/+28
|
* Normalize associated types in types coming from ChalkFlorian Diebold2020-02-211-0/+42
| | | | Fixes #3232.
* Make Self implement the trait inside trait default methodsFlorian Diebold2020-02-141-0/+48
|
* Add two more testsFlorian Diebold2020-02-071-0/+51
|
* Don't print implicit type args from impl TraitFlorian Diebold2020-02-071-11/+11
|
* Deal better with implicit type parameters and argument listsFlorian Diebold2020-02-071-0/+108
|
* Clean up RPIT a bitFlorian Diebold2020-02-071-13/+11
|
* Fix APIT some moreFlorian Diebold2020-02-071-23/+28
|
* Change Ty::Param to contain param IDFlorian Diebold2020-02-071-2/+1
|
* WIP use params for APITFlorian Diebold2020-02-071-0/+53
|
* Fix assoc type selectionFlorian Diebold2020-02-071-3/+3
|
* Fix enum constructorsFlorian Diebold2020-02-071-1/+1
|
* Fix printing of function typesFlorian Diebold2020-02-071-16/+16
|
* wip implement lowering modeFlorian Diebold2020-02-071-20/+8
|