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

Members' type functions now accept an optional descendant context declaration. #256

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

bicknellr
Copy link
Contributor

Component members are discovered within the context of some declaration associated with a single AST node. If that declaration has free type parameters, then asking the type checker for that declaration's AST node's type will return a type that still contains those free type parameters. Further, different choices for those type parameters in descendant component declarations may cause the type of the member to vary.

To allow a member to return its type with all type arguments substituted, members' type functions can now optionally be passed a component declaration that (inclusively) descends from the member's declaration. The type returned will be the type of this member for an instance of the given declaration.

…eclaration. (...)

Component members are discovered within the context of some declaration
associated with a single AST node. If that declaration has free type parameters,
then asking the type checker for that declaration's AST node's type will return
a type that still contains those free type parameters. Further, different
choices for those type parameters in descendant component declarations may cause
the type of the member to vary.

To allow a member to return its type with all type arguments substituted,
members' `type` functions can now optionally be passed a component declaration
that (inclusively) descends from the member's declaration. The type returned
will be the type of this member *for an instance of the given declaration*.
@bicknellr bicknellr force-pushed the contextual-member-types branch from a3de3ba to cb8b7b4 Compare January 5, 2023 23:50
@bicknellr bicknellr marked this pull request as ready for review January 12, 2023 22:03
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.

1 participant