carbon-language / carbon-lang

Carbon Language's main repository: documents, design, implementation, and related tools. (NOTE: Carbon Language is experimental; see README)
http://docs.carbon-lang.dev/
Other
32.24k stars 1.48k forks source link

Build a generic representing the parameterization of the body of an interface by its implicit `Self` parameter. #4190

Closed zygoloid closed 1 month ago

zygoloid commented 1 month ago

This is distinct from the generic representing the interface itself, which may or may not exist but doesn't have the Self parameter.

For formatting purposes, I've merged the inner generic into the interface definition rather than adding a separate nested generic block. That seemed like the most logical option given that an interface definition is always generic and doesn't have parameters of its own, and this avoids an extra level of indentation for every interface. I'm also using the same SemIR scope name for the two generics and the interface itself, to minimize scope qualifications.

This is in preparation for using specifics of the generic with self for checking impls and uses of the interface rather than performing a from-scratch substitution each time.

zygoloid commented 1 month ago

Converted to draft: I'm not confident this is the right direction.