carbon-language / carbon-lang

Carbon Language's main repository: documents, design, implementation, and related tools. (NOTE: Carbon Language is experimental; see README)
https://github.com/carbon-language/carbon-lang/blob/trunk/README.md
Other
32.31k stars 1.48k forks source link

Remove return_type_id from Function. #4051

Closed zygoloid closed 2 weeks ago

zygoloid commented 2 weeks ago

Instead of redundantly storing both the return_type_id and return_storage_id, where the declared return type is just the type of the return storage, store only the return_storage_id.

Add a convenience property to get the declared return type of the function.

In addition to avoiding storing redundant information, this is a preparatory step for an upcoming change for generics support that will make it more expensive and awkward to store TypeIds in places other than the type of an instruction.