Skip to content

[ConstraintSystem] Rename getFixedType/assignFixedType/getFixedTypeRecursive. #18327

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

Closed
wants to merge 1 commit into from
Closed

[ConstraintSystem] Rename getFixedType/assignFixedType/getFixedTypeRecursive. #18327

wants to merge 1 commit into from

Conversation

rudkx
Copy link
Contributor

@rudkx rudkx commented Jul 28, 2018

A few renames:

  • getFixedType => getBoundType
  • assignedFixedType => assignBoundType
  • getFixedTypeRecursive => resolveTypeVariable

Note this PR also has all of #18325.

@rudkx
Copy link
Contributor Author

rudkx commented Jul 28, 2018

@DougGregor @xedin Thoughts on the renames here?

getFixedTypeRecursive in particular has always bothered me since it doesn't just do getFixedType recursively, and isn't even recursive at this point.

@rudkx
Copy link
Contributor Author

rudkx commented Jul 28, 2018

@swift-ci Please smoke test

@xedin
Copy link
Contributor

xedin commented Jul 28, 2018

{get, assign}BoundType - {get, assign}Type, because it retrieves or assigns/binds a type for/to a type variable, and resolveTypeVariable - resolveType because it could resolve/simplify multiple type variables?

@rudkx
Copy link
Contributor Author

rudkx commented Jul 29, 2018

@xedin I had considered {get, assign}Type, but getType is already in use on ConstraintSystem and I didn't want to overload it for that purpose.

I started looking at this because I have other changes where I ended up calling getFixedType() instead of getFixedTypeRecursive() and that's an easy mistake to make. The former is just grabbing whatever type was assigned via assignFixedType(), i.e. the one bound to the type variable, whereas the latter drills down into dependent members and nested type variables, ultimately getting you to the most specific concrete type we can resolve to.

I'm not convinced resolveType() would be more clear than resolveTypeVariable(). They both have the very generic term resolve, which I'm not thrilled with but it attempts to convey the idea that we're doing something more than just a lookup.

…cursive.

A few renames:
- getFixedType => getBoundType
- assignedFixedType => assignBoundType
- getFixedTypeRecursive => resolveTypeVariable
@rudkx
Copy link
Contributor Author

rudkx commented Jul 29, 2018

@swift-ci Please smoke test

@xedin
Copy link
Contributor

xedin commented Jul 29, 2018

The reason why I want to drop Bound is because I don't think it carries any meaning, as soon as you want to assign a type or get a type for something it has to be a "bound" type, right?

Re: getFixedTypeRecursive maybe we should change it to resolveTypeVariables so at least it's plural?

@rudkx
Copy link
Contributor Author

rudkx commented Sep 21, 2018

Lots of conflicts. It's easy enough to do a global rename at a later date; closing.

@rudkx rudkx closed this Sep 21, 2018
@rudkx rudkx deleted the rename-fixed-to-bound branch September 21, 2018 00:05
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