Files
carbon-lang/toolchain/check/testdata/eval/fail_symbolic.carbon
T
Richard Smith 439a644960 Propagate the phase of a type from its constituent types. (#3645)
To avoid bouncing through `constant_values()` to determine whether a
type is symbolic or template, store the `ConstantId` on the `TypeInfo`
not just the `InstId`.

In addition to propagating the symbolic / template phase, this also
propagates whether a type contains an error, resulting in our no longer
producing types such as `<error>*` -- these now evaluate to simply
`<error>`. While this makes our types less precise after an error, it
also removes some follow-on diagnostics, so it seems to be an
improvement on the whole.
2024-01-25 01:00:37 +00:00

31 lines
1.0 KiB
Plaintext

// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// AUTOUPDATE
// TODO: This should work.
fn G(N:! i32) {
// CHECK:STDERR: fail_symbolic.carbon:[[@LINE+3]]:16: ERROR: Semantics TODO: `symbolic array bound`.
// CHECK:STDERR: var k: [i32; N];
// CHECK:STDERR: ^
var k: [i32; N];
}
// CHECK:STDOUT: --- fail_symbolic.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace {.G = %G} [template]
// CHECK:STDOUT: %G: <function> = fn_decl @G [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @G(%N: i32) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %N.ref: i32 = name_ref N, %N [symbolic = %N]
// CHECK:STDOUT: %.loc12: type = array_type %N.ref, i32 [template = <error>]
// CHECK:STDOUT: %k.var: ref <error> = var k
// CHECK:STDOUT: %k: ref <error> = bind_name k, %k.var
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT: