Represent integer literals as IntLiteral not as i32. (#4532)

When an `IntLiteral` appears as an operand of an `if` expression,
convert it to `i32` for now, so that we don't reject things like `if
cond then 1 else 2` due to having a non-constant value of type
`IntLiteral`.

For tuple indexing expressions such as `(a, b).0`, convert the index to
type `IntLiteral`, not to type `i32`. This isn't strictly necessary to
do in this PR, but avoids the need to provide an `IntLiteral` -> `i32`
implicit conversion for `no_prelude` tests using this syntax.
This commit is contained in:
Richard Smith
2024-11-15 23:24:15 +00:00
committed by GitHub
parent 980ce6b25a
commit bc395eb889
249 changed files with 19281 additions and 6668 deletions
-4
View File
@@ -29,10 +29,6 @@ constexpr DiagnosticKind UntestedDiagnosticKinds[] = {
DiagnosticKind::ErrorStattingFile,
DiagnosticKind::FileTooLarge,
// Int literals are currently limited to i32. Once that's fixed, this
// should be tested.
DiagnosticKind::ArrayBoundTooLarge,
// These aren't feasible to test with a normal testcase, but are tested in
// lex/tokenized_buffer_test.cpp.
DiagnosticKind::TooManyTokens,