Skip to content

Conversation

@JsonFreeman
Copy link
Contributor

The spec section 3.9 does not say that interface / class types depend on their base types. And they shouldn't. However, the compiler eagerly resolves the base types of classes and interfaces, so if a class / interface is referenced by a type alias, it might lead to a circular reference error.

The issue can be seen in #1936.

The fix is to make collection of base types lazy, so that base type computation is done on demand when base types are needed.

@JsonFreeman
Copy link
Contributor Author

I hope to make similar changes for indexers and return types of call and construct signatures.

Copy link
Contributor

Choose a reason for hiding this comment

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

we have ObjectType and ResolvedObjectType. Should we have InterfaceType and ResolvedInterfaceType?

Copy link
Contributor

Choose a reason for hiding this comment

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

you do the cast 4 times. Can you just cast once to a local, and then use that from then on?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can use a local. The problem with ResolvedInterfaceType is that it implies that the type elements (members, call signatures, etc) are resolved, and that is not in fact the case.

@CyrusNajmabadi
Copy link
Contributor

👍

JsonFreeman added a commit that referenced this pull request Apr 17, 2015
@JsonFreeman JsonFreeman merged commit f3c073e into master Apr 17, 2015
@JsonFreeman JsonFreeman deleted the lazyBaseTypes branch April 17, 2015 21:31
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 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.

4 participants