Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TY: improve type inference around call expressions #8790

Merged
merged 5 commits into from
Apr 26, 2022
Merged

Conversation

vlad20012
Copy link
Member

@vlad20012 vlad20012 commented Apr 25, 2022

Not the plugin should support these cases:

fn foo(f: &&fn() -> i32) {
    let a = f();
    a;
} //^ i32

and

use std::rc::Rc;
fn foo(f: Rc<fn() -> i32>) {
    let a = f();
    a;
} //^ i32

and

struct S();
impl S {
    fn new() {
        let a = Self();
        a;
    } //^ S
}

Also, I moved E0618 implementation into the type inference engine, so it should work more precisely.

Fixes #6682
Fixes #8311

@vlad20012 vlad20012 self-assigned this Apr 25, 2022
@Undin Undin added the fix Pull requests that fix some bug(s) label Apr 25, 2022
@vlad20012 vlad20012 force-pushed the ty-call-deref branch 3 times, most recently from 7db2b13 to 9df0aee Compare April 26, 2022 13:36
@vlad20012
Copy link
Member Author

bors r+

bors bot added a commit that referenced this pull request Apr 26, 2022
8790: TY: improve type inference around call expressions r=vlad20012 a=vlad20012

Not the plugin should support these cases:

```rust
fn foo(f: &&fn() -> i32) {
    let a = f();
    a;
} //^ i32
```

and

```rust
use std::rc::Rc;
fn foo(f: Rc<fn() -> i32>) {
    let a = f();
    a;
} //^ i32
```

and

```rust
struct S();
impl S {
    fn new() {
        let a = Self();
        a;
    } //^ S
}
```

Also, I moved E0618 implementation into the type inference engine, so it should work more precisely. 

Fixes #6682
Fixes #8311

Co-authored-by: vlad20012 <beskvlad@gmail.com>
@bors
Copy link
Contributor

bors bot commented Apr 26, 2022

Canceled.

@vlad20012
Copy link
Member Author

bors r+

@bors
Copy link
Contributor

bors bot commented Apr 26, 2022

Build succeeded:

@bors bors bot merged commit f2ed05d into master Apr 26, 2022
@bors bors bot deleted the ty-call-deref branch April 26, 2022 17:16
@github-actions github-actions bot added this to the v170 milestone Apr 26, 2022
@mili-l mili-l self-assigned this May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Pull requests that fix some bug(s)
Projects
None yet
3 participants