Files
carbon-lang/toolchain/driver/testdata/dump_shared_values.carbon
T
Jon Ross-Perkins 74c3c665fa Refactor SemIR YAML printing to use dashed lists. (#3330)
This standardizes on having ValueStore and related structures provide
printing, removing the handlers in file.cpp.

The `[]` is provided for empty sequences versus if there was simply
nothing, in which case it would be a sequence when non-empty, and a null
value when empty. Consistently (and explicitly) providing sequences
feels easier to understand.

The changes to the output yaml are overall more terse. My hope is that
this is an improvement for most readers.

Also fixes printing of APInt, defaulting to unsigned for consistency
with Carbon's use.
2023-10-25 16:32:24 +00:00

41 lines
1.2 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
//
// ARGS: compile --phase=lex --dump-shared-values %s
//
// AUTOUPDATE
// The value 8 is significant because it can show as negative due to APInt.
var int1: i32 = 1;
var int2: i32 = 8;
var real1: f64 = 1.0;
var real2: f64 = 0.8e8;
var real3: f64 = 0.8e9;
var str1: String = "abc";
var str2: String = "ab'\"c";
// CHECK:STDOUT: shared_values:
// CHECK:STDOUT: - integers:
// CHECK:STDOUT: - 32
// CHECK:STDOUT: - 1
// CHECK:STDOUT: - 32
// CHECK:STDOUT: - 8
// CHECK:STDOUT: - 64
// CHECK:STDOUT: - 64
// CHECK:STDOUT: - 64
// CHECK:STDOUT: reals:
// CHECK:STDOUT: - 10*10^-1
// CHECK:STDOUT: - 8*10^7
// CHECK:STDOUT: - 8*10^8
// CHECK:STDOUT: strings:
// CHECK:STDOUT: - "int1"
// CHECK:STDOUT: - "int2"
// CHECK:STDOUT: - "real1"
// CHECK:STDOUT: - "real2"
// CHECK:STDOUT: - "real3"
// CHECK:STDOUT: - "str1"
// CHECK:STDOUT: - "abc"
// CHECK:STDOUT: - "str2"
// CHECK:STDOUT: - "ab'\"c"