Skip to content

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