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

feat(exporter): thir: call: separate trait VS method generic args #750

Merged
merged 1 commit into from
Jul 8, 2024

Conversation

W95Psp
Copy link
Collaborator

@W95Psp W95Psp commented Jul 8, 2024

This PR separates method generic args and trait generic args of the call nodes of THIR expressions.

Consider the following example:

trait MyTrait<TraitType> {
  fn meth<MethType>(...) {...}
}
fn example_call<TraitType, SelfType: MyTrait<TraitType>>(x: SelfType) {
  x.meth::<String>(...)
}

Before this commit, the call x.meth::<String> produced a Call node whose field generic_args was [SelfType, TraitType, String].

Now, that Call node has a trait-specific generic arguments field [SelfType, TraitType] and a method/function-specific generic arguments field [String].

This commit does no change to the engine, that will be for a subsequent PR.

This PR is related to #719.

This PR separates method generic args and trait generic args of the
`call` nodes of THIR expressions.

Consider the following example:
```rust
trait MyTrait<TraitType> {
  fn meth<MethType>(...) {...}
}
fn example_call<TraitType, SelfType: MyTrait<TraitType>>(x: SelfType) {
  x.meth::<String>(...)
}
```

Before this commit, the call `x.meth::<String>` produced a `Call` node
whose field `generic_args` was `[SelfType, TraitType, String]`.

Now, that `Call` node has a trait-specific generic arguments field
`[SelfType, TraitType]` and a method/function-specific generic
arguments field `[String].`

This commit does no change to the engine, that will be for a
subsequent PR.

This PR is related to #719.
@W95Psp W95Psp force-pushed the frontend-thir-calls-impl-generics branch from c0ed2d2 to 14786e7 Compare July 8, 2024 12:00
@W95Psp W95Psp added this pull request to the merge queue Jul 8, 2024
Merged via the queue into main with commit 20853d8 Jul 8, 2024
13 checks passed
@W95Psp W95Psp deleted the frontend-thir-calls-impl-generics branch July 8, 2024 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants