Skip to content

fix: Respect coercions in inline_call #9557

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

Merged
merged 2 commits into from
Jul 10, 2021
Merged

fix: Respect coercions in inline_call #9557

merged 2 commits into from
Jul 10, 2021

Conversation

Veykril
Copy link
Member

@Veykril Veykril commented Jul 10, 2021

bors r+

bors bot added a commit that referenced this pull request Jul 10, 2021
9557: fix: Respect coercions in `inline_call` r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <[email protected]>
@bors
Copy link
Contributor

bors bot commented Jul 10, 2021

Build failed:

@Veykril
Copy link
Member Author

Veykril commented Jul 10, 2021

bors retry

@bors
Copy link
Contributor

bors bot commented Jul 10, 2021

@bors bors bot merged commit 2e52d6e into rust-lang:master Jul 10, 2021
@Veykril Veykril deleted the add-ty branch July 10, 2021 17:35
@@ -216,14 +216,18 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> {
self.imp.type_of_expr(expr)
}

pub fn type_of_expr_with_coercion(&self, expr: &ast::Expr) -> Option<Type> {
pub fn type_of_expr_with_coercion(&self, expr: &ast::Expr) -> Option<(Type, Option<Type>)> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's very unclear what this returns now 😬

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think an API that always returns the adjusted type (which might be the original one if there are no adjustments) would be much clearer. For cases where we want to see whether an adjustment happened, we could return the list of adjustments additionally, or even just a boolean?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, that sounds reasonable. I'll fix that up later today/tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants