Skip to content

Compare shapes of objects before comparing contained types #18126

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
Sep 3, 2017

Conversation

ahejlsberg
Copy link
Member

With this PR, when comparing two object types we first check that the source type contains all properties required by the target type. Only when that is the case do we then proceed to compare the types of the properties. Previously we'd do both of these things in the same pass which could cause us to needlessly drill into the (possibly deep) types of matching properties only to later discover that other properties are missing (meaning that the types are not related).

As can be seen from the baseline differences, we now bail out quicker when types are not related. This reduces noise in error messages and should also help performance.

Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

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

It would be nice to know how much this helps performance, but the change is worth it for the improvement in error messages alone.

@ahejlsberg ahejlsberg merged commit 1edecac into master Sep 3, 2017
@ahejlsberg ahejlsberg deleted the propertyRelations branch September 3, 2017 19:34
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants