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.38k stars 1.48k forks source link

Add builtin for performing checked conversion between integer types. #4523

Closed zygoloid closed 1 week ago

zygoloid commented 1 week ago

As a prerequisite for switching the type of int literals to be the IntLiteral type, add support for performing conversions of in-bounds integer constant values to other integer types in which they fit.

This incidentally is our first compile-time-only builtin function, so add very minimal support for compile-time-only functions while we're here.