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

Introduce the TypeBinding type #2195

Merged
merged 145 commits into from
Jul 13, 2022
Merged

Conversation

emilyaherbert
Copy link
Contributor

@emilyaherbert emilyaherbert commented Jun 30, 2022

This PR introduces the TypeBinding type, which represents the application of turbofish upon some LHS declaration or type, which will bind the type arguments of the turbofish to the type parameters in the LHS. This allows us to do things like:

struct Data<T> {
  value: T
}

impl<T> Data<T> {
  fn noop<F>(other: F) -> F {
    other
  }
}

let data = ~Data::<bool>::noop::<u64>(1u64);

previously, we were unable to have different generics between the data type and the internal methods.

emilyaherbert and others added 30 commits June 10, 2022 16:07
…-1143-3/disallow-unconstrained-type-parameters
…-1143-3/disallow-unconstrained-type-parameters
…-1143-3/disallow-unconstrained-type-parameters
…-1143-3/disallow-unconstrained-type-parameters
…constrained-type-parameters' into emilyaherbert-1898-2/semantic-type-constraints
…emilyaherbert-1898-2/semantic-type-constraints
…ters' into emilyaherbert-1898-2/semantic-type-constraints
emilyaherbert and others added 16 commits July 1, 2022 14:43
…heck' into emilyaherbert/use-callpath-as-wrapper
…apper' into emilyaherbert/use-type-binding
Base automatically changed from emilyaherbert/use-callpath-as-wrapper to master July 6, 2022 00:29
@emilyaherbert emilyaherbert marked this pull request as ready for review July 12, 2022 01:14
@emilyaherbert emilyaherbert enabled auto-merge (squash) July 12, 2022 01:14
@emilyaherbert emilyaherbert requested a review from a team July 12, 2022 01:14
Copy link
Contributor

@otrho otrho left a comment

Choose a reason for hiding this comment

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

I will admit I've been avoiding this review since it's big and I don't fully understand exactly what is going on, but it still looks good to me.

@otrho otrho requested a review from a team July 13, 2022 02:15
@emilyaherbert
Copy link
Contributor Author

I will admit I've been avoiding this review since it's big and I don't fully understand exactly what is going on, but it still looks good to me.

I'd say about 50% of the green additions are from introducing a new test, hopefully that helps calm your feelings 😄

Copy link
Contributor

@mohammadfawaz mohammadfawaz left a comment

Choose a reason for hiding this comment

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

The new syntax looks more correct and reasonable. The rest of the PR looks good! And the testing seems quite extensive.

@emilyaherbert emilyaherbert merged commit 916ab86 into master Jul 13, 2022
@emilyaherbert emilyaherbert deleted the emilyaherbert/use-type-binding branch July 13, 2022 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen P: critical Should be looked at before anything else
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

First use of a generic method fixes its generic type
3 participants