Update basics tests for ranges, splits, and min_prelude (#5509)

Updating tests in the style of
https://github.com/carbon-language/carbon-lang/pull/5455.

- Moving `Run`-specific tests into their own directory, with a README to
explain why it's unusual.
  - Note, I suspect we'll also get more over time (e.g., with arguments)
- This makes a little more use of `if-present` just because there are
more tests that want to print their full output.
- I'm combining the two empty-ish tests, thought I do still want the
*really* empty one to be fully empty (i.e., no tokens provided by the
file).
- Dropping multifile.carbon because it doesn't seem like an interesting
test to keep.
This commit is contained in:
Jon Ross-Perkins
2025-05-23 17:50:02 +00:00
committed by GitHub
parent 5aea18f949
commit cea9954e28
22 changed files with 423 additions and 949 deletions
-127
View File
@@ -1,127 +0,0 @@
// 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
// TIP: To test this file alone, run:
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/builtin_types.carbon
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/builtin_types.carbon
var test_i32: i32 = 0;
var test_f64: f64 = 0.1;
let test_str: String = "Test";
var test_type: type = i32;
// CHECK:STDOUT: --- builtin_types.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
// CHECK:STDOUT: %int_0.5c6: Core.IntLiteral = int_value 0 [concrete]
// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
// CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
// CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
// CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
// CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
// CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
// CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
// CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
// CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
// CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_0.5c6, %Convert.956 [concrete]
// CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
// CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_0.5c6, %Convert.specific_fn [concrete]
// CHECK:STDOUT: %int_0.6a9: %i32 = int_value 0 [concrete]
// CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [concrete]
// CHECK:STDOUT: %Float.type: type = fn_type @Float [concrete]
// CHECK:STDOUT: %Float: %Float.type = struct_value () [concrete]
// CHECK:STDOUT: %pattern_type.3de: type = pattern_type f64 [concrete]
// CHECK:STDOUT: %float: f64 = float_literal 0.10000000000000001 [concrete]
// CHECK:STDOUT: %pattern_type.b05: type = pattern_type String [concrete]
// CHECK:STDOUT: %str: String = string_literal "Test" [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
// CHECK:STDOUT: .Int = %Core.Int
// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
// CHECK:STDOUT: .Float = %Core.Float
// CHECK:STDOUT: import Core//prelude
// CHECK:STDOUT: import Core//prelude/...
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)]
// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
// CHECK:STDOUT: %Core.Float: %Float.type = import_ref Core//prelude/types, Float, loaded [concrete = constants.%Float]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
// CHECK:STDOUT: .Core = imports.%Core
// CHECK:STDOUT: .test_i32 = %test_i32
// CHECK:STDOUT: .test_f64 = %test_f64
// CHECK:STDOUT: .test_str = %test_str
// CHECK:STDOUT: .test_type = %test_type
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %test_i32.patt: %pattern_type.7ce = binding_pattern test_i32 [concrete]
// CHECK:STDOUT: %test_i32.var_patt: %pattern_type.7ce = var_pattern %test_i32.patt [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %test_i32.var: ref %i32 = var %test_i32.var_patt [concrete]
// CHECK:STDOUT: %.loc11: type = splice_block %i32 [concrete = constants.%i32] {
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
// CHECK:STDOUT: }
// CHECK:STDOUT: %test_i32: ref %i32 = bind_name test_i32, %test_i32.var
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %test_f64.patt: %pattern_type.3de = binding_pattern test_f64 [concrete]
// CHECK:STDOUT: %test_f64.var_patt: %pattern_type.3de = var_pattern %test_f64.patt [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %test_f64.var: ref f64 = var %test_f64.var_patt [concrete]
// CHECK:STDOUT: %.loc12_15.1: type = splice_block %.loc12_15.3 [concrete = f64] {
// CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [concrete = constants.%int_64]
// CHECK:STDOUT: %float.make_type: init type = call constants.%Float(%int_64) [concrete = f64]
// CHECK:STDOUT: %.loc12_15.2: type = value_of_initializer %float.make_type [concrete = f64]
// CHECK:STDOUT: %.loc12_15.3: type = converted %float.make_type, %.loc12_15.2 [concrete = f64]
// CHECK:STDOUT: }
// CHECK:STDOUT: %test_f64: ref f64 = bind_name test_f64, %test_f64.var
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %test_str.patt: %pattern_type.b05 = binding_pattern test_str [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %test_str: String = bind_name test_str, @__global_init.%str
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %test_type.patt: %pattern_type.98f = binding_pattern test_type [concrete]
// CHECK:STDOUT: %test_type.var_patt: %pattern_type.98f = var_pattern %test_type.patt [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %test_type.var: ref type = var %test_type.var_patt [concrete]
// CHECK:STDOUT: %test_type: ref type = bind_name test_type, %test_type.var
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @__global_init() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
// CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
// CHECK:STDOUT: %bound_method.loc11_1.1: <bound method> = bound_method %int_0, %impl.elem0 [concrete = constants.%Convert.bound]
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
// CHECK:STDOUT: %bound_method.loc11_1.2: <bound method> = bound_method %int_0, %specific_fn [concrete = constants.%bound_method]
// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc11_1.2(%int_0) [concrete = constants.%int_0.6a9]
// CHECK:STDOUT: %.loc11: init %i32 = converted %int_0, %int.convert_checked [concrete = constants.%int_0.6a9]
// CHECK:STDOUT: assign file.%test_i32.var, %.loc11
// CHECK:STDOUT: %float: f64 = float_literal 0.10000000000000001 [concrete = constants.%float]
// CHECK:STDOUT: assign file.%test_f64.var, %float
// CHECK:STDOUT: %str: String = string_literal "Test" [concrete = constants.%str]
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
// CHECK:STDOUT: assign file.%test_type.var, %i32
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT:
-62
View File
@@ -1,62 +0,0 @@
// 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
// TIP: To test this file alone, run:
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/fail_bad_run.carbon
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/fail_bad_run.carbon
// CHECK:STDERR: fail_bad_run.carbon:[[@LINE+8]]:1: error: invalid signature for `Main.Run` function; expected `fn ()` or `fn () -> i32` [InvalidMainRunSignature]
// CHECK:STDERR: fn Run() -> String {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
// CHECK:STDERR: fail_bad_run.carbon:[[@LINE+4]]:21: error: missing `return` at end of function with declared return type [MissingReturnStatement]
// CHECK:STDERR: fn Run() -> String {}
// CHECK:STDERR: ^
// CHECK:STDERR:
fn Run() -> String {}
// CHECK:STDOUT: --- fail_bad_run.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %pattern_type.b05: type = pattern_type String [concrete]
// CHECK:STDOUT: %Run.type: type = fn_type @Run [concrete]
// CHECK:STDOUT: %Run: %Run.type = struct_value () [concrete]
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
// CHECK:STDOUT: .Int = %Core.Int
// CHECK:STDOUT: import Core//prelude
// CHECK:STDOUT: import Core//prelude/...
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
// CHECK:STDOUT: .Core = imports.%Core
// CHECK:STDOUT: .Run = %Run.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %Run.decl: %Run.type = fn_decl @Run [concrete = constants.%Run] {
// CHECK:STDOUT: %return.patt: %pattern_type.b05 = return_slot_pattern [concrete]
// CHECK:STDOUT: %return.param_patt: %pattern_type.b05 = out_param_pattern %return.patt, call_param0 [concrete]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %return.param: ref String = out_param call_param0
// CHECK:STDOUT: %return: ref String = return_slot %return.param
// CHECK:STDOUT: }
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Run() -> %return.param: String {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: }
// CHECK:STDOUT:
-61
View File
@@ -1,61 +0,0 @@
// 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
// TIP: To test this file alone, run:
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/fail_bad_run_2.carbon
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/fail_bad_run_2.carbon
// CHECK:STDERR: fail_bad_run_2.carbon:[[@LINE+4]]:1: error: invalid signature for `Main.Run` function; expected `fn ()` or `fn () -> i32` [InvalidMainRunSignature]
// CHECK:STDERR: fn Run(n: i32) {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
// CHECK:STDERR:
fn Run(n: i32) {}
// CHECK:STDOUT: --- fail_bad_run_2.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
// CHECK:STDOUT: %Run.type: type = fn_type @Run [concrete]
// CHECK:STDOUT: %Run: %Run.type = struct_value () [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
// CHECK:STDOUT: .Int = %Core.Int
// CHECK:STDOUT: import Core//prelude
// CHECK:STDOUT: import Core//prelude/...
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
// CHECK:STDOUT: .Core = imports.%Core
// CHECK:STDOUT: .Run = %Run.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %Run.decl: %Run.type = fn_decl @Run [concrete = constants.%Run] {
// CHECK:STDOUT: %n.patt: %pattern_type.7ce = binding_pattern n [concrete]
// CHECK:STDOUT: %n.param_patt: %pattern_type.7ce = value_param_pattern %n.patt, call_param0 [concrete]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %n.param: %i32 = value_param call_param0
// CHECK:STDOUT: %.loc15: type = splice_block %i32 [concrete = constants.%i32] {
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
// CHECK:STDOUT: }
// CHECK:STDOUT: %n: %i32 = bind_name n, %n.param
// CHECK:STDOUT: }
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Run(%n.param: %i32) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -1,59 +0,0 @@
// 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
// TIP: To test this file alone, run:
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/fail_non_type_as_type.carbon
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/fail_non_type_as_type.carbon
// CHECK:STDERR: fail_non_type_as_type.carbon:[[@LINE+7]]:1: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet]
// CHECK:STDERR: var x: type = 42;
// CHECK:STDERR: ^~~~~~~~~~~
// CHECK:STDERR: fail_non_type_as_type.carbon:[[@LINE+4]]:1: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote]
// CHECK:STDERR: var x: type = 42;
// CHECK:STDERR: ^~~~~~~~~~~
// CHECK:STDERR:
var x: type = 42;
// CHECK:STDOUT: --- fail_non_type_as_type.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
// CHECK:STDOUT: %int_42: Core.IntLiteral = int_value 42 [concrete]
// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
// CHECK:STDOUT: import Core//prelude
// CHECK:STDOUT: import Core//prelude/...
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
// CHECK:STDOUT: .Core = imports.%Core
// CHECK:STDOUT: .x = %x
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %x.patt: %pattern_type.98f = binding_pattern x [concrete]
// CHECK:STDOUT: %x.var_patt: %pattern_type.98f = var_pattern %x.patt [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %x.var: ref type = var %x.var_patt [concrete]
// CHECK:STDOUT: %x: ref type = bind_name x, %x.var
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @__global_init() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %int_42: Core.IntLiteral = int_value 42 [concrete = constants.%int_42]
// CHECK:STDOUT: %.loc18: type = converted %int_42, <error> [concrete = <error>]
// CHECK:STDOUT: assign file.%x.var, <error>
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -1,175 +0,0 @@
// 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
// TIP: To test this file alone, run:
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/fail_numeric_literal_overflow.carbon
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/fail_numeric_literal_overflow.carbon
// CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+4]]:14: error: integer value 39999999999999999993 too large for type `i32` [IntTooLargeForType]
// CHECK:STDERR: let a: i32 = 39999999999999999993;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
let a: i32 = 39999999999999999993;
// CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+4]]:14: error: integer value 2147483648 too large for type `i32` [IntTooLargeForType]
// CHECK:STDERR: let b: i32 = 2_147_483_648;
// CHECK:STDERR: ^~~~~~~~~~~~~
// CHECK:STDERR:
let b: i32 = 2_147_483_648;
// CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+4]]:14: error: integer value 2147483648 too large for type `i32` [IntTooLargeForType]
// CHECK:STDERR: let c: i32 = 0x8000_0000;
// CHECK:STDERR: ^~~~~~~~~~~
// CHECK:STDERR:
let c: i32 = 0x8000_0000;
// CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+4]]:14: error: real mantissa with value 399999999999999999930 does not fit in i64 [RealMantissaTooLargeForI64]
// CHECK:STDERR: let d: f64 = 39999999999999999993.0e3;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
let d: f64 = 39999999999999999993.0e3;
// CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+4]]:14: error: real exponent with value 39999999999999999992 does not fit in i64 [RealExponentTooLargeForI64]
// CHECK:STDERR: let e: f64 = 5.0e39999999999999999993;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
let e: f64 = 5.0e39999999999999999993;
// CHECK:STDOUT: --- fail_numeric_literal_overflow.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
// CHECK:STDOUT: %int_39999999999999999993.af6: Core.IntLiteral = int_value 39999999999999999993 [concrete]
// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
// CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
// CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
// CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
// CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
// CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
// CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
// CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
// CHECK:STDOUT: %Convert.bound.7ef: <bound method> = bound_method %int_39999999999999999993.af6, %Convert.956 [concrete]
// CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
// CHECK:STDOUT: %bound_method.75f: <bound method> = bound_method %int_39999999999999999993.af6, %Convert.specific_fn [concrete]
// CHECK:STDOUT: %int_39999999999999999993.dee: %i32 = int_value 39999999999999999993 [concrete]
// CHECK:STDOUT: %int_2147483648.1db: Core.IntLiteral = int_value 2147483648 [concrete]
// CHECK:STDOUT: %Convert.bound.85f: <bound method> = bound_method %int_2147483648.1db, %Convert.956 [concrete]
// CHECK:STDOUT: %bound_method.f79: <bound method> = bound_method %int_2147483648.1db, %Convert.specific_fn [concrete]
// CHECK:STDOUT: %int_2147483648.8df: %i32 = int_value 2147483648 [concrete]
// CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [concrete]
// CHECK:STDOUT: %Float.type: type = fn_type @Float [concrete]
// CHECK:STDOUT: %Float: %Float.type = struct_value () [concrete]
// CHECK:STDOUT: %pattern_type.3de: type = pattern_type f64 [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
// CHECK:STDOUT: .Int = %Core.Int
// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
// CHECK:STDOUT: .Float = %Core.Float
// CHECK:STDOUT: import Core//prelude
// CHECK:STDOUT: import Core//prelude/...
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)]
// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
// CHECK:STDOUT: %Core.Float: %Float.type = import_ref Core//prelude/types, Float, loaded [concrete = constants.%Float]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
// CHECK:STDOUT: .Core = imports.%Core
// CHECK:STDOUT: .a = %a
// CHECK:STDOUT: .b = %b
// CHECK:STDOUT: .c = %c
// CHECK:STDOUT: .d = %d
// CHECK:STDOUT: .e = %e
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %a.patt: %pattern_type.7ce = binding_pattern a [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %.loc15_8: type = splice_block %i32.loc15 [concrete = constants.%i32] {
// CHECK:STDOUT: %int_32.loc15: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
// CHECK:STDOUT: %i32.loc15: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
// CHECK:STDOUT: }
// CHECK:STDOUT: %impl.elem0.loc15: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
// CHECK:STDOUT: %bound_method.loc15_14.1: <bound method> = bound_method @__global_init.%int_39999999999999999993, %impl.elem0.loc15 [concrete = constants.%Convert.bound.7ef]
// CHECK:STDOUT: %specific_fn.loc15: <specific function> = specific_function %impl.elem0.loc15, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
// CHECK:STDOUT: %bound_method.loc15_14.2: <bound method> = bound_method @__global_init.%int_39999999999999999993, %specific_fn.loc15 [concrete = constants.%bound_method.75f]
// CHECK:STDOUT: %int.convert_checked.loc15: init %i32 = call %bound_method.loc15_14.2(@__global_init.%int_39999999999999999993) [concrete = constants.%int_39999999999999999993.dee]
// CHECK:STDOUT: %.loc15_14.1: %i32 = value_of_initializer %int.convert_checked.loc15 [concrete = constants.%int_39999999999999999993.dee]
// CHECK:STDOUT: %.loc15_14.2: %i32 = converted @__global_init.%int_39999999999999999993, %.loc15_14.1 [concrete = constants.%int_39999999999999999993.dee]
// CHECK:STDOUT: %a: %i32 = bind_name a, %.loc15_14.2
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %b.patt: %pattern_type.7ce = binding_pattern b [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %.loc21_8: type = splice_block %i32.loc21 [concrete = constants.%i32] {
// CHECK:STDOUT: %int_32.loc21: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
// CHECK:STDOUT: %i32.loc21: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
// CHECK:STDOUT: }
// CHECK:STDOUT: %impl.elem0.loc21: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
// CHECK:STDOUT: %bound_method.loc21_14.1: <bound method> = bound_method @__global_init.%int_2147483648.loc21, %impl.elem0.loc21 [concrete = constants.%Convert.bound.85f]
// CHECK:STDOUT: %specific_fn.loc21: <specific function> = specific_function %impl.elem0.loc21, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
// CHECK:STDOUT: %bound_method.loc21_14.2: <bound method> = bound_method @__global_init.%int_2147483648.loc21, %specific_fn.loc21 [concrete = constants.%bound_method.f79]
// CHECK:STDOUT: %int.convert_checked.loc21: init %i32 = call %bound_method.loc21_14.2(@__global_init.%int_2147483648.loc21) [concrete = constants.%int_2147483648.8df]
// CHECK:STDOUT: %.loc21_14.1: %i32 = value_of_initializer %int.convert_checked.loc21 [concrete = constants.%int_2147483648.8df]
// CHECK:STDOUT: %.loc21_14.2: %i32 = converted @__global_init.%int_2147483648.loc21, %.loc21_14.1 [concrete = constants.%int_2147483648.8df]
// CHECK:STDOUT: %b: %i32 = bind_name b, %.loc21_14.2
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %c.patt: %pattern_type.7ce = binding_pattern c [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %.loc27_8: type = splice_block %i32.loc27 [concrete = constants.%i32] {
// CHECK:STDOUT: %int_32.loc27: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
// CHECK:STDOUT: %i32.loc27: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
// CHECK:STDOUT: }
// CHECK:STDOUT: %impl.elem0.loc27: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
// CHECK:STDOUT: %bound_method.loc27_14.1: <bound method> = bound_method @__global_init.%int_2147483648.loc27, %impl.elem0.loc27 [concrete = constants.%Convert.bound.85f]
// CHECK:STDOUT: %specific_fn.loc27: <specific function> = specific_function %impl.elem0.loc27, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
// CHECK:STDOUT: %bound_method.loc27_14.2: <bound method> = bound_method @__global_init.%int_2147483648.loc27, %specific_fn.loc27 [concrete = constants.%bound_method.f79]
// CHECK:STDOUT: %int.convert_checked.loc27: init %i32 = call %bound_method.loc27_14.2(@__global_init.%int_2147483648.loc27) [concrete = constants.%int_2147483648.8df]
// CHECK:STDOUT: %.loc27_14.1: %i32 = value_of_initializer %int.convert_checked.loc27 [concrete = constants.%int_2147483648.8df]
// CHECK:STDOUT: %.loc27_14.2: %i32 = converted @__global_init.%int_2147483648.loc27, %.loc27_14.1 [concrete = constants.%int_2147483648.8df]
// CHECK:STDOUT: %c: %i32 = bind_name c, %.loc27_14.2
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %d.patt: %pattern_type.3de = binding_pattern d [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %.loc33_8.1: type = splice_block %.loc33_8.3 [concrete = f64] {
// CHECK:STDOUT: %int_64.loc33: Core.IntLiteral = int_value 64 [concrete = constants.%int_64]
// CHECK:STDOUT: %float.make_type.loc33: init type = call constants.%Float(%int_64.loc33) [concrete = f64]
// CHECK:STDOUT: %.loc33_8.2: type = value_of_initializer %float.make_type.loc33 [concrete = f64]
// CHECK:STDOUT: %.loc33_8.3: type = converted %float.make_type.loc33, %.loc33_8.2 [concrete = f64]
// CHECK:STDOUT: }
// CHECK:STDOUT: %d: f64 = bind_name d, <error>
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %e.patt: %pattern_type.3de = binding_pattern e [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %.loc39_8.1: type = splice_block %.loc39_8.3 [concrete = f64] {
// CHECK:STDOUT: %int_64.loc39: Core.IntLiteral = int_value 64 [concrete = constants.%int_64]
// CHECK:STDOUT: %float.make_type.loc39: init type = call constants.%Float(%int_64.loc39) [concrete = f64]
// CHECK:STDOUT: %.loc39_8.2: type = value_of_initializer %float.make_type.loc39 [concrete = f64]
// CHECK:STDOUT: %.loc39_8.3: type = converted %float.make_type.loc39, %.loc39_8.2 [concrete = f64]
// CHECK:STDOUT: }
// CHECK:STDOUT: %e: f64 = bind_name e, <error>
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @__global_init() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %int_39999999999999999993: Core.IntLiteral = int_value 39999999999999999993 [concrete = constants.%int_39999999999999999993.af6]
// CHECK:STDOUT: %int_2147483648.loc21: Core.IntLiteral = int_value 2147483648 [concrete = constants.%int_2147483648.1db]
// CHECK:STDOUT: %int_2147483648.loc27: Core.IntLiteral = int_value 2147483648 [concrete = constants.%int_2147483648.1db]
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT:
-76
View File
@@ -1,76 +0,0 @@
// 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
// TIP: To test this file alone, run:
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/multifile.carbon
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/multifile.carbon
// --- a.carbon
package A;
fn A() {}
// --- b.carbon
package B;
fn B() {}
// CHECK:STDOUT: --- a.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %A.type: type = fn_type @A [concrete]
// CHECK:STDOUT: %A: %A.type = struct_value () [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
// CHECK:STDOUT: import Core//prelude
// CHECK:STDOUT: import Core//prelude/...
// CHECK:STDOUT: }
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
// CHECK:STDOUT: .Core = imports.%Core
// CHECK:STDOUT: .A = %A.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [concrete = constants.%A] {} {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @A() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: --- b.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %B.type: type = fn_type @B [concrete]
// CHECK:STDOUT: %B: %B.type = struct_value () [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
// CHECK:STDOUT: import Core//prelude
// CHECK:STDOUT: import Core//prelude/...
// CHECK:STDOUT: }
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
// CHECK:STDOUT: .Core = imports.%Core
// CHECK:STDOUT: .B = %B.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %B.decl: %B.type = fn_decl @B [concrete = constants.%B] {} {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @B() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -6,12 +6,12 @@
//
// AUTOUPDATE
// TIP: To test this file alone, run:
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/builtin_insts.carbon
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/no_prelude/dump_raw_builtins.carbon
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/builtin_insts.carbon
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/no_prelude/dump_raw_builtins.carbon
// CHECK:STDOUT: ---
// CHECK:STDOUT: filename: builtin_insts.carbon
// CHECK:STDOUT: filename: dump_raw_builtins.carbon
// CHECK:STDOUT: sem_ir:
// CHECK:STDOUT: import_irs:
// CHECK:STDOUT: ir0: {decl_id: inst<none>, is_export: false}
+16
View File
@@ -2,15 +2,31 @@
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// EXTRA-ARGS: --dump-sem-ir-ranges=if-present
//
// AUTOUPDATE
// TIP: To test this file alone, run:
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/no_prelude/empty.carbon
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/no_prelude/empty.carbon
// --- empty.carbon
// --- empty_decl.carbon
library "[[@TEST_NAME]]";
;
// CHECK:STDOUT: --- empty.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: --- empty_decl.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -1,18 +0,0 @@
// 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
// TIP: To test this file alone, run:
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/no_prelude/empty_decl.carbon
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/no_prelude/empty_decl.carbon
;
// CHECK:STDOUT: --- empty_decl.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -1,39 +0,0 @@
// 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
// TIP: To test this file alone, run:
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/no_prelude/fail_name_lookup.carbon
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/no_prelude/fail_name_lookup.carbon
fn Main() {
// CHECK:STDERR: fail_name_lookup.carbon:[[@LINE+4]]:3: error: name `x` not found [NameNotFound]
// CHECK:STDERR: x;
// CHECK:STDERR: ^
// CHECK:STDERR:
x;
}
// CHECK:STDOUT: --- fail_name_lookup.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %Main.type: type = fn_type @Main [concrete]
// CHECK:STDOUT: %Main: %Main.type = struct_value () [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
// CHECK:STDOUT: .Main = %Main.decl
// CHECK:STDOUT: .x = <poisoned>
// CHECK:STDOUT: }
// CHECK:STDOUT: %Main.decl: %Main.type = fn_decl @Main [concrete = constants.%Main] {} {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Main() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %x.ref: <error> = name_ref x, <error> [concrete = <error>]
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -1,37 +0,0 @@
// 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
// TIP: To test this file alone, run:
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/no_prelude/fail_qualifier_unsupported.carbon
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/no_prelude/fail_qualifier_unsupported.carbon
// CHECK:STDERR: fail_qualifier_unsupported.carbon:[[@LINE+4]]:10: error: type `bool` does not support qualified expressions [QualifiedExprUnsupported]
// CHECK:STDERR: fn F() { true.b; }
// CHECK:STDERR: ^~~~~~
// CHECK:STDERR:
fn F() { true.b; }
// CHECK:STDOUT: --- fail_qualifier_unsupported.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
// CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
// CHECK:STDOUT: %true: bool = bool_literal true [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
// CHECK:STDOUT: .F = %F.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %true: bool = bool_literal true [concrete = constants.%true]
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -2,6 +2,8 @@
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// EXTRA-ARGS: --dump-sem-ir-ranges=if-present
//
// AUTOUPDATE
// TIP: To test this file alone, run:
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/no_prelude/multi_error.carbon
@@ -0,0 +1,63 @@
// 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
//
// EXTRA-ARGS: --dump-sem-ir-ranges=only
//
// AUTOUPDATE
// TIP: To test this file alone, run:
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/no_prelude/name_lookup.carbon
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/no_prelude/name_lookup.carbon
// --- fail_not_found.carbon
library "[[@TEST_NAME]]";
fn Main() {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_not_found.carbon:[[@LINE+4]]:3: error: name `x` not found [NameNotFound]
// CHECK:STDERR: x;
// CHECK:STDERR: ^
// CHECK:STDERR:
x;
//@dump-sem-ir-end
}
// --- fail_qualififier_unsupported.carbon
library "[[@TEST_NAME]]";
fn F() {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_qualififier_unsupported.carbon:[[@LINE+4]]:3: error: type `bool` does not support qualified expressions [QualifiedExprUnsupported]
// CHECK:STDERR: true.b;
// CHECK:STDERR: ^~~~~~
// CHECK:STDERR:
true.b;
//@dump-sem-ir-end
}
// CHECK:STDOUT: --- fail_not_found.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Main() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %x.ref: <error> = name_ref x, <error> [concrete = <error>]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: --- fail_qualififier_unsupported.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %true: bool = bool_literal true [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %true: bool = bool_literal true [concrete = constants.%true]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -2,6 +2,8 @@
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// EXTRA-ARGS: --dump-sem-ir-ranges=if-present
//
// AUTOUPDATE
// TIP: To test this file alone, run:
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/no_prelude/raw_identifier.carbon
@@ -45,12 +47,12 @@ fn C(r#if: ()) -> () {
// CHECK:STDOUT: %return.patt: %pattern_type = return_slot_pattern [concrete]
// CHECK:STDOUT: %return.param_patt: %pattern_type = out_param_pattern %return.patt, call_param1 [concrete]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc11_17.1: %empty_tuple.type = tuple_literal ()
// CHECK:STDOUT: %.loc11_17.2: type = converted %.loc11_17.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
// CHECK:STDOUT: %.loc13_17.1: %empty_tuple.type = tuple_literal ()
// CHECK:STDOUT: %.loc13_17.2: type = converted %.loc13_17.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
// CHECK:STDOUT: %n.param: %empty_tuple.type = value_param call_param0
// CHECK:STDOUT: %.loc11_10.1: type = splice_block %.loc11_10.3 [concrete = constants.%empty_tuple.type] {
// CHECK:STDOUT: %.loc11_10.2: %empty_tuple.type = tuple_literal ()
// CHECK:STDOUT: %.loc11_10.3: type = converted %.loc11_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
// CHECK:STDOUT: %.loc13_10.1: type = splice_block %.loc13_10.3 [concrete = constants.%empty_tuple.type] {
// CHECK:STDOUT: %.loc13_10.2: %empty_tuple.type = tuple_literal ()
// CHECK:STDOUT: %.loc13_10.3: type = converted %.loc13_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %n: %empty_tuple.type = bind_name n, %n.param
// CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param1
@@ -62,12 +64,12 @@ fn C(r#if: ()) -> () {
// CHECK:STDOUT: %return.patt: %pattern_type = return_slot_pattern [concrete]
// CHECK:STDOUT: %return.param_patt: %pattern_type = out_param_pattern %return.patt, call_param1 [concrete]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc15_19.1: %empty_tuple.type = tuple_literal ()
// CHECK:STDOUT: %.loc15_19.2: type = converted %.loc15_19.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
// CHECK:STDOUT: %.loc17_19.1: %empty_tuple.type = tuple_literal ()
// CHECK:STDOUT: %.loc17_19.2: type = converted %.loc17_19.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
// CHECK:STDOUT: %n.param: %empty_tuple.type = value_param call_param0
// CHECK:STDOUT: %.loc15_12.1: type = splice_block %.loc15_12.3 [concrete = constants.%empty_tuple.type] {
// CHECK:STDOUT: %.loc15_12.2: %empty_tuple.type = tuple_literal ()
// CHECK:STDOUT: %.loc15_12.3: type = converted %.loc15_12.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
// CHECK:STDOUT: %.loc17_12.1: type = splice_block %.loc17_12.3 [concrete = constants.%empty_tuple.type] {
// CHECK:STDOUT: %.loc17_12.2: %empty_tuple.type = tuple_literal ()
// CHECK:STDOUT: %.loc17_12.3: type = converted %.loc17_12.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %n: %empty_tuple.type = bind_name n, %n.param
// CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param1
@@ -79,12 +81,12 @@ fn C(r#if: ()) -> () {
// CHECK:STDOUT: %return.patt: %pattern_type = return_slot_pattern [concrete]
// CHECK:STDOUT: %return.param_patt: %pattern_type = out_param_pattern %return.patt, call_param1 [concrete]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc19_20.1: %empty_tuple.type = tuple_literal ()
// CHECK:STDOUT: %.loc19_20.2: type = converted %.loc19_20.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
// CHECK:STDOUT: %.loc21_20.1: %empty_tuple.type = tuple_literal ()
// CHECK:STDOUT: %.loc21_20.2: type = converted %.loc21_20.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
// CHECK:STDOUT: %if.param: %empty_tuple.type = value_param call_param0
// CHECK:STDOUT: %.loc19_13.1: type = splice_block %.loc19_13.3 [concrete = constants.%empty_tuple.type] {
// CHECK:STDOUT: %.loc19_13.2: %empty_tuple.type = tuple_literal ()
// CHECK:STDOUT: %.loc19_13.3: type = converted %.loc19_13.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
// CHECK:STDOUT: %.loc21_13.1: type = splice_block %.loc21_13.3 [concrete = constants.%empty_tuple.type] {
// CHECK:STDOUT: %.loc21_13.2: %empty_tuple.type = tuple_literal ()
// CHECK:STDOUT: %.loc21_13.3: type = converted %.loc21_13.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %if: %empty_tuple.type = bind_name r#if, %if.param
// CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param1
+75 -186
View File
@@ -2,237 +2,126 @@
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// EXTRA-ARGS: --dump-sem-ir-ranges=only
//
// AUTOUPDATE
// TIP: To test this file alone, run:
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/numeric_literals.carbon
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/numeric_literals.carbon
// --- literal_values.carbon
library "[[@TEST_NAME]]";
fn F() {
// 8 and 9 trigger special behavior in APInt when mishandling signed versus
// unsigned, so we pay extra attention to those.
var ints: array(i32, 6) = (
//@dump-sem-ir-begin
8,
9,
0x8,
0b1000,
2147483647,
0x7FFFFFFF,
//@dump-sem-ir-end
);
var floats: array(f64, 6) = (
//@dump-sem-ir-begin
0.9,
8.0,
80.0,
1.0e7,
1.0e8,
1.0e-8
//@dump-sem-ir-end
);
}
// CHECK:STDOUT: --- numeric_literals.carbon
// --- fail_overflow_very_large.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_overflow_very_large.carbon:[[@LINE+4]]:14: error: integer value 39999999999999999993 too large for type `i32` [IntTooLargeForType]
// CHECK:STDERR: let a: i32 = 39999999999999999993;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
let a: i32 = 39999999999999999993;
// --- fail_overflow_boundary.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_overflow_boundary.carbon:[[@LINE+4]]:14: error: integer value 2147483648 too large for type `i32` [IntTooLargeForType]
// CHECK:STDERR: let b: i32 = 2_147_483_648;
// CHECK:STDERR: ^~~~~~~~~~~~~
// CHECK:STDERR:
let b: i32 = 2_147_483_648;
// --- fail_overflow_boundary_hex.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_overflow_boundary_hex.carbon:[[@LINE+4]]:14: error: integer value 2147483648 too large for type `i32` [IntTooLargeForType]
// CHECK:STDERR: let c: i32 = 0x8000_0000;
// CHECK:STDERR: ^~~~~~~~~~~
// CHECK:STDERR:
let c: i32 = 0x8000_0000;
// --- fail_overflow_very_large_mantissa.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_overflow_very_large_mantissa.carbon:[[@LINE+4]]:14: error: real mantissa with value 399999999999999999930 does not fit in i64 [RealMantissaTooLargeForI64]
// CHECK:STDERR: let d: f64 = 39999999999999999993.0e3;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
let d: f64 = 39999999999999999993.0e3;
// --- fail_overflow_very_large_exponent.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_overflow_very_large_exponent.carbon:[[@LINE+4]]:14: error: real exponent with value 39999999999999999992 does not fit in i64 [RealExponentTooLargeForI64]
// CHECK:STDERR: let e: f64 = 5.0e39999999999999999993;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
let e: f64 = 5.0e39999999999999999993;
// CHECK:STDOUT: --- literal_values.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
// CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
// CHECK:STDOUT: %int_6: Core.IntLiteral = int_value 6 [concrete]
// CHECK:STDOUT: %array_type.d49: type = array_type %int_6, %i32 [concrete]
// CHECK:STDOUT: %pattern_type.0c8: type = pattern_type %array_type.d49 [concrete]
// CHECK:STDOUT: %int_8.b85: Core.IntLiteral = int_value 8 [concrete]
// CHECK:STDOUT: %int_9.988: Core.IntLiteral = int_value 9 [concrete]
// CHECK:STDOUT: %int_2147483647.d89: Core.IntLiteral = int_value 2147483647 [concrete]
// CHECK:STDOUT: %tuple.type.27c: type = tuple_type (Core.IntLiteral, Core.IntLiteral, Core.IntLiteral, Core.IntLiteral, Core.IntLiteral, Core.IntLiteral) [concrete]
// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete]
// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
// CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
// CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
// CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
// CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
// CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
// CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
// CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
// CHECK:STDOUT: %Convert.bound.e09: <bound method> = bound_method %int_8.b85, %Convert.956 [concrete]
// CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
// CHECK:STDOUT: %bound_method.02d: <bound method> = bound_method %int_8.b85, %Convert.specific_fn [concrete]
// CHECK:STDOUT: %int_8.98c: %i32 = int_value 8 [concrete]
// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete]
// CHECK:STDOUT: %Convert.bound.9e2: <bound method> = bound_method %int_9.988, %Convert.956 [concrete]
// CHECK:STDOUT: %bound_method.cd3: <bound method> = bound_method %int_9.988, %Convert.specific_fn [concrete]
// CHECK:STDOUT: %int_9.f88: %i32 = int_value 9 [concrete]
// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete]
// CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete]
// CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete]
// CHECK:STDOUT: %Convert.bound.f38: <bound method> = bound_method %int_2147483647.d89, %Convert.956 [concrete]
// CHECK:STDOUT: %bound_method.8e1: <bound method> = bound_method %int_2147483647.d89, %Convert.specific_fn [concrete]
// CHECK:STDOUT: %int_2147483647.a74: %i32 = int_value 2147483647 [concrete]
// CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [concrete]
// CHECK:STDOUT: %array.ae2: %array_type.d49 = tuple_value (%int_8.98c, %int_9.f88, %int_8.98c, %int_8.98c, %int_2147483647.a74, %int_2147483647.a74) [concrete]
// CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [concrete]
// CHECK:STDOUT: %Float.type: type = fn_type @Float [concrete]
// CHECK:STDOUT: %Float: %Float.type = struct_value () [concrete]
// CHECK:STDOUT: %array_type.72b: type = array_type %int_6, f64 [concrete]
// CHECK:STDOUT: %pattern_type.601: type = pattern_type %array_type.72b [concrete]
// CHECK:STDOUT: %float.952: f64 = float_literal 0.90000000000000002 [concrete]
// CHECK:STDOUT: %float.298: f64 = float_literal 8 [concrete]
// CHECK:STDOUT: %float.dcb: f64 = float_literal 80 [concrete]
// CHECK:STDOUT: %float.1d0: f64 = float_literal 1.0E+7 [concrete]
// CHECK:STDOUT: %float.9f6: f64 = float_literal 1.0E+8 [concrete]
// CHECK:STDOUT: %float.401: f64 = float_literal 1.0E-8 [concrete]
// CHECK:STDOUT: %tuple.type.635: type = tuple_type (f64, f64, f64, f64, f64, f64) [concrete]
// CHECK:STDOUT: %array.a2f: %array_type.72b = tuple_value (%float.952, %float.298, %float.dcb, %float.1d0, %float.9f6, %float.401) [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
// CHECK:STDOUT: .Int = %Core.Int
// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
// CHECK:STDOUT: .Float = %Core.Float
// CHECK:STDOUT: import Core//prelude
// CHECK:STDOUT: import Core//prelude/...
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)]
// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
// CHECK:STDOUT: %Core.Float: %Float.type = import_ref Core//prelude/types, Float, loaded [concrete = constants.%Float]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
// CHECK:STDOUT: .Core = imports.%Core
// CHECK:STDOUT: .F = %F.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %ints.patt: %pattern_type.0c8 = binding_pattern ints [concrete]
// CHECK:STDOUT: %ints.var_patt: %pattern_type.0c8 = var_pattern %ints.patt [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %ints.var: ref %array_type.d49 = var %ints.var_patt
// CHECK:STDOUT: %int_8.loc15: Core.IntLiteral = int_value 8 [concrete = constants.%int_8.b85]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %int_8.loc9: Core.IntLiteral = int_value 8 [concrete = constants.%int_8.b85]
// CHECK:STDOUT: %int_9: Core.IntLiteral = int_value 9 [concrete = constants.%int_9.988]
// CHECK:STDOUT: %int_8.loc17: Core.IntLiteral = int_value 8 [concrete = constants.%int_8.b85]
// CHECK:STDOUT: %int_8.loc18: Core.IntLiteral = int_value 8 [concrete = constants.%int_8.b85]
// CHECK:STDOUT: %int_2147483647.loc19: Core.IntLiteral = int_value 2147483647 [concrete = constants.%int_2147483647.d89]
// CHECK:STDOUT: %int_2147483647.loc20: Core.IntLiteral = int_value 2147483647 [concrete = constants.%int_2147483647.d89]
// CHECK:STDOUT: %.loc21_3.1: %tuple.type.27c = tuple_literal (%int_8.loc15, %int_9, %int_8.loc17, %int_8.loc18, %int_2147483647.loc19, %int_2147483647.loc20)
// CHECK:STDOUT: %impl.elem0.loc21_3.1: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
// CHECK:STDOUT: %bound_method.loc21_3.1: <bound method> = bound_method %int_8.loc15, %impl.elem0.loc21_3.1 [concrete = constants.%Convert.bound.e09]
// CHECK:STDOUT: %specific_fn.loc21_3.1: <specific function> = specific_function %impl.elem0.loc21_3.1, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
// CHECK:STDOUT: %bound_method.loc21_3.2: <bound method> = bound_method %int_8.loc15, %specific_fn.loc21_3.1 [concrete = constants.%bound_method.02d]
// CHECK:STDOUT: %int.convert_checked.loc21_3.1: init %i32 = call %bound_method.loc21_3.2(%int_8.loc15) [concrete = constants.%int_8.98c]
// CHECK:STDOUT: %.loc21_3.2: init %i32 = converted %int_8.loc15, %int.convert_checked.loc21_3.1 [concrete = constants.%int_8.98c]
// CHECK:STDOUT: %int_0.loc21: Core.IntLiteral = int_value 0 [concrete = constants.%int_0]
// CHECK:STDOUT: %.loc21_3.3: ref %i32 = array_index %ints.var, %int_0.loc21
// CHECK:STDOUT: %.loc21_3.4: init %i32 = initialize_from %.loc21_3.2 to %.loc21_3.3 [concrete = constants.%int_8.98c]
// CHECK:STDOUT: %impl.elem0.loc21_3.2: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
// CHECK:STDOUT: %bound_method.loc21_3.3: <bound method> = bound_method %int_9, %impl.elem0.loc21_3.2 [concrete = constants.%Convert.bound.9e2]
// CHECK:STDOUT: %specific_fn.loc21_3.2: <specific function> = specific_function %impl.elem0.loc21_3.2, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
// CHECK:STDOUT: %bound_method.loc21_3.4: <bound method> = bound_method %int_9, %specific_fn.loc21_3.2 [concrete = constants.%bound_method.cd3]
// CHECK:STDOUT: %int.convert_checked.loc21_3.2: init %i32 = call %bound_method.loc21_3.4(%int_9) [concrete = constants.%int_9.f88]
// CHECK:STDOUT: %.loc21_3.5: init %i32 = converted %int_9, %int.convert_checked.loc21_3.2 [concrete = constants.%int_9.f88]
// CHECK:STDOUT: %int_1.loc21: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %.loc21_3.6: ref %i32 = array_index %ints.var, %int_1.loc21
// CHECK:STDOUT: %.loc21_3.7: init %i32 = initialize_from %.loc21_3.5 to %.loc21_3.6 [concrete = constants.%int_9.f88]
// CHECK:STDOUT: %impl.elem0.loc21_3.3: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
// CHECK:STDOUT: %bound_method.loc21_3.5: <bound method> = bound_method %int_8.loc17, %impl.elem0.loc21_3.3 [concrete = constants.%Convert.bound.e09]
// CHECK:STDOUT: %specific_fn.loc21_3.3: <specific function> = specific_function %impl.elem0.loc21_3.3, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
// CHECK:STDOUT: %bound_method.loc21_3.6: <bound method> = bound_method %int_8.loc17, %specific_fn.loc21_3.3 [concrete = constants.%bound_method.02d]
// CHECK:STDOUT: %int.convert_checked.loc21_3.3: init %i32 = call %bound_method.loc21_3.6(%int_8.loc17) [concrete = constants.%int_8.98c]
// CHECK:STDOUT: %.loc21_3.8: init %i32 = converted %int_8.loc17, %int.convert_checked.loc21_3.3 [concrete = constants.%int_8.98c]
// CHECK:STDOUT: %int_2.loc21: Core.IntLiteral = int_value 2 [concrete = constants.%int_2]
// CHECK:STDOUT: %.loc21_3.9: ref %i32 = array_index %ints.var, %int_2.loc21
// CHECK:STDOUT: %.loc21_3.10: init %i32 = initialize_from %.loc21_3.8 to %.loc21_3.9 [concrete = constants.%int_8.98c]
// CHECK:STDOUT: %impl.elem0.loc21_3.4: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
// CHECK:STDOUT: %bound_method.loc21_3.7: <bound method> = bound_method %int_8.loc18, %impl.elem0.loc21_3.4 [concrete = constants.%Convert.bound.e09]
// CHECK:STDOUT: %specific_fn.loc21_3.4: <specific function> = specific_function %impl.elem0.loc21_3.4, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
// CHECK:STDOUT: %bound_method.loc21_3.8: <bound method> = bound_method %int_8.loc18, %specific_fn.loc21_3.4 [concrete = constants.%bound_method.02d]
// CHECK:STDOUT: %int.convert_checked.loc21_3.4: init %i32 = call %bound_method.loc21_3.8(%int_8.loc18) [concrete = constants.%int_8.98c]
// CHECK:STDOUT: %.loc21_3.11: init %i32 = converted %int_8.loc18, %int.convert_checked.loc21_3.4 [concrete = constants.%int_8.98c]
// CHECK:STDOUT: %int_3.loc21: Core.IntLiteral = int_value 3 [concrete = constants.%int_3]
// CHECK:STDOUT: %.loc21_3.12: ref %i32 = array_index %ints.var, %int_3.loc21
// CHECK:STDOUT: %.loc21_3.13: init %i32 = initialize_from %.loc21_3.11 to %.loc21_3.12 [concrete = constants.%int_8.98c]
// CHECK:STDOUT: %impl.elem0.loc21_3.5: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
// CHECK:STDOUT: %bound_method.loc21_3.9: <bound method> = bound_method %int_2147483647.loc19, %impl.elem0.loc21_3.5 [concrete = constants.%Convert.bound.f38]
// CHECK:STDOUT: %specific_fn.loc21_3.5: <specific function> = specific_function %impl.elem0.loc21_3.5, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
// CHECK:STDOUT: %bound_method.loc21_3.10: <bound method> = bound_method %int_2147483647.loc19, %specific_fn.loc21_3.5 [concrete = constants.%bound_method.8e1]
// CHECK:STDOUT: %int.convert_checked.loc21_3.5: init %i32 = call %bound_method.loc21_3.10(%int_2147483647.loc19) [concrete = constants.%int_2147483647.a74]
// CHECK:STDOUT: %.loc21_3.14: init %i32 = converted %int_2147483647.loc19, %int.convert_checked.loc21_3.5 [concrete = constants.%int_2147483647.a74]
// CHECK:STDOUT: %int_4.loc21: Core.IntLiteral = int_value 4 [concrete = constants.%int_4]
// CHECK:STDOUT: %.loc21_3.15: ref %i32 = array_index %ints.var, %int_4.loc21
// CHECK:STDOUT: %.loc21_3.16: init %i32 = initialize_from %.loc21_3.14 to %.loc21_3.15 [concrete = constants.%int_2147483647.a74]
// CHECK:STDOUT: %impl.elem0.loc21_3.6: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
// CHECK:STDOUT: %bound_method.loc21_3.11: <bound method> = bound_method %int_2147483647.loc20, %impl.elem0.loc21_3.6 [concrete = constants.%Convert.bound.f38]
// CHECK:STDOUT: %specific_fn.loc21_3.6: <specific function> = specific_function %impl.elem0.loc21_3.6, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
// CHECK:STDOUT: %bound_method.loc21_3.12: <bound method> = bound_method %int_2147483647.loc20, %specific_fn.loc21_3.6 [concrete = constants.%bound_method.8e1]
// CHECK:STDOUT: %int.convert_checked.loc21_3.6: init %i32 = call %bound_method.loc21_3.12(%int_2147483647.loc20) [concrete = constants.%int_2147483647.a74]
// CHECK:STDOUT: %.loc21_3.17: init %i32 = converted %int_2147483647.loc20, %int.convert_checked.loc21_3.6 [concrete = constants.%int_2147483647.a74]
// CHECK:STDOUT: %int_5.loc21: Core.IntLiteral = int_value 5 [concrete = constants.%int_5]
// CHECK:STDOUT: %.loc21_3.18: ref %i32 = array_index %ints.var, %int_5.loc21
// CHECK:STDOUT: %.loc21_3.19: init %i32 = initialize_from %.loc21_3.17 to %.loc21_3.18 [concrete = constants.%int_2147483647.a74]
// CHECK:STDOUT: %.loc21_3.20: init %array_type.d49 = array_init (%.loc21_3.4, %.loc21_3.7, %.loc21_3.10, %.loc21_3.13, %.loc21_3.16, %.loc21_3.19) to %ints.var [concrete = constants.%array.ae2]
// CHECK:STDOUT: %.loc14_3: init %array_type.d49 = converted %.loc21_3.1, %.loc21_3.20 [concrete = constants.%array.ae2]
// CHECK:STDOUT: assign %ints.var, %.loc14_3
// CHECK:STDOUT: %.loc14_25: type = splice_block %array_type.loc14 [concrete = constants.%array_type.d49] {
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
// CHECK:STDOUT: %int_6.loc14: Core.IntLiteral = int_value 6 [concrete = constants.%int_6]
// CHECK:STDOUT: %array_type.loc14: type = array_type %int_6.loc14, %i32 [concrete = constants.%array_type.d49]
// CHECK:STDOUT: }
// CHECK:STDOUT: %ints: ref %array_type.d49 = bind_name ints, %ints.var
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %floats.patt: %pattern_type.601 = binding_pattern floats [concrete]
// CHECK:STDOUT: %floats.var_patt: %pattern_type.601 = var_pattern %floats.patt [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %floats.var: ref %array_type.72b = var %floats.var_patt
// CHECK:STDOUT: %float.loc23: f64 = float_literal 0.90000000000000002 [concrete = constants.%float.952]
// CHECK:STDOUT: %float.loc24: f64 = float_literal 8 [concrete = constants.%float.298]
// CHECK:STDOUT: %float.loc25: f64 = float_literal 80 [concrete = constants.%float.dcb]
// CHECK:STDOUT: %float.loc26: f64 = float_literal 1.0E+7 [concrete = constants.%float.1d0]
// CHECK:STDOUT: %float.loc27: f64 = float_literal 1.0E+8 [concrete = constants.%float.9f6]
// CHECK:STDOUT: %float.loc28: f64 = float_literal 1.0E-8 [concrete = constants.%float.401]
// CHECK:STDOUT: %.loc29_3.1: %tuple.type.635 = tuple_literal (%float.loc23, %float.loc24, %float.loc25, %float.loc26, %float.loc27, %float.loc28)
// CHECK:STDOUT: %int_0.loc29: Core.IntLiteral = int_value 0 [concrete = constants.%int_0]
// CHECK:STDOUT: %.loc29_3.2: ref f64 = array_index %floats.var, %int_0.loc29
// CHECK:STDOUT: %.loc29_3.3: init f64 = initialize_from %float.loc23 to %.loc29_3.2 [concrete = constants.%float.952]
// CHECK:STDOUT: %int_1.loc29: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %.loc29_3.4: ref f64 = array_index %floats.var, %int_1.loc29
// CHECK:STDOUT: %.loc29_3.5: init f64 = initialize_from %float.loc24 to %.loc29_3.4 [concrete = constants.%float.298]
// CHECK:STDOUT: %int_2.loc29: Core.IntLiteral = int_value 2 [concrete = constants.%int_2]
// CHECK:STDOUT: %.loc29_3.6: ref f64 = array_index %floats.var, %int_2.loc29
// CHECK:STDOUT: %.loc29_3.7: init f64 = initialize_from %float.loc25 to %.loc29_3.6 [concrete = constants.%float.dcb]
// CHECK:STDOUT: %int_3.loc29: Core.IntLiteral = int_value 3 [concrete = constants.%int_3]
// CHECK:STDOUT: %.loc29_3.8: ref f64 = array_index %floats.var, %int_3.loc29
// CHECK:STDOUT: %.loc29_3.9: init f64 = initialize_from %float.loc26 to %.loc29_3.8 [concrete = constants.%float.1d0]
// CHECK:STDOUT: %int_4.loc29: Core.IntLiteral = int_value 4 [concrete = constants.%int_4]
// CHECK:STDOUT: %.loc29_3.10: ref f64 = array_index %floats.var, %int_4.loc29
// CHECK:STDOUT: %.loc29_3.11: init f64 = initialize_from %float.loc27 to %.loc29_3.10 [concrete = constants.%float.9f6]
// CHECK:STDOUT: %int_5.loc29: Core.IntLiteral = int_value 5 [concrete = constants.%int_5]
// CHECK:STDOUT: %.loc29_3.12: ref f64 = array_index %floats.var, %int_5.loc29
// CHECK:STDOUT: %.loc29_3.13: init f64 = initialize_from %float.loc28 to %.loc29_3.12 [concrete = constants.%float.401]
// CHECK:STDOUT: %.loc29_3.14: init %array_type.72b = array_init (%.loc29_3.3, %.loc29_3.5, %.loc29_3.7, %.loc29_3.9, %.loc29_3.11, %.loc29_3.13) to %floats.var [concrete = constants.%array.a2f]
// CHECK:STDOUT: %.loc22_3: init %array_type.72b = converted %.loc29_3.1, %.loc29_3.14 [concrete = constants.%array.a2f]
// CHECK:STDOUT: assign %floats.var, %.loc22_3
// CHECK:STDOUT: %.loc22_27: type = splice_block %array_type.loc22 [concrete = constants.%array_type.72b] {
// CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [concrete = constants.%int_64]
// CHECK:STDOUT: %float.make_type: init type = call constants.%Float(%int_64) [concrete = f64]
// CHECK:STDOUT: %int_6.loc22: Core.IntLiteral = int_value 6 [concrete = constants.%int_6]
// CHECK:STDOUT: %.loc22_21.1: type = value_of_initializer %float.make_type [concrete = f64]
// CHECK:STDOUT: %.loc22_21.2: type = converted %float.make_type, %.loc22_21.1 [concrete = f64]
// CHECK:STDOUT: %array_type.loc22: type = array_type %int_6.loc22, %.loc22_21.2 [concrete = constants.%array_type.72b]
// CHECK:STDOUT: }
// CHECK:STDOUT: %floats: ref %array_type.72b = bind_name floats, %floats.var
// CHECK:STDOUT: return
// CHECK:STDOUT: %int_8.loc11: Core.IntLiteral = int_value 8 [concrete = constants.%int_8.b85]
// CHECK:STDOUT: %int_8.loc12: Core.IntLiteral = int_value 8 [concrete = constants.%int_8.b85]
// CHECK:STDOUT: %int_2147483647.loc13: Core.IntLiteral = int_value 2147483647 [concrete = constants.%int_2147483647.d89]
// CHECK:STDOUT: %int_2147483647.loc14: Core.IntLiteral = int_value 2147483647 [concrete = constants.%int_2147483647.d89]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %float.loc19: f64 = float_literal 0.90000000000000002 [concrete = constants.%float.952]
// CHECK:STDOUT: %float.loc20: f64 = float_literal 8 [concrete = constants.%float.298]
// CHECK:STDOUT: %float.loc21: f64 = float_literal 80 [concrete = constants.%float.dcb]
// CHECK:STDOUT: %float.loc22: f64 = float_literal 1.0E+7 [concrete = constants.%float.1d0]
// CHECK:STDOUT: %float.loc23: f64 = float_literal 1.0E+8 [concrete = constants.%float.9f6]
// CHECK:STDOUT: %float.loc24: f64 = float_literal 1.0E-8 [concrete = constants.%float.401]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
+22 -20
View File
@@ -2,6 +2,8 @@
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// EXTRA-ARGS: --dump-sem-ir-ranges=if-present
//
// AUTOUPDATE
// TIP: To test this file alone, run:
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/parens.carbon
@@ -67,9 +69,9 @@ var b: i32 = ((2));
// CHECK:STDOUT: %a.var_patt: %pattern_type.7ce = var_pattern %a.patt [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %a.var: ref %i32 = var %a.var_patt [concrete]
// CHECK:STDOUT: %.loc11: type = splice_block %i32.loc11 [concrete = constants.%i32] {
// CHECK:STDOUT: %int_32.loc11: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
// CHECK:STDOUT: %i32.loc11: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
// CHECK:STDOUT: %.loc13: type = splice_block %i32.loc13 [concrete = constants.%i32] {
// CHECK:STDOUT: %int_32.loc13: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
// CHECK:STDOUT: %i32.loc13: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
// CHECK:STDOUT: }
// CHECK:STDOUT: %a: ref %i32 = bind_name a, %a.var
// CHECK:STDOUT: name_binding_decl {
@@ -77,9 +79,9 @@ var b: i32 = ((2));
// CHECK:STDOUT: %b.var_patt: %pattern_type.7ce = var_pattern %b.patt [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %b.var: ref %i32 = var %b.var_patt [concrete]
// CHECK:STDOUT: %.loc12: type = splice_block %i32.loc12 [concrete = constants.%i32] {
// CHECK:STDOUT: %int_32.loc12: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
// CHECK:STDOUT: %i32.loc12: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
// CHECK:STDOUT: %.loc14: type = splice_block %i32.loc14 [concrete = constants.%i32] {
// CHECK:STDOUT: %int_32.loc14: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
// CHECK:STDOUT: %i32.loc14: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
// CHECK:STDOUT: }
// CHECK:STDOUT: %b: ref %i32 = bind_name b, %b.var
// CHECK:STDOUT: }
@@ -87,21 +89,21 @@ var b: i32 = ((2));
// CHECK:STDOUT: fn @__global_init() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
// CHECK:STDOUT: %impl.elem0.loc11: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
// CHECK:STDOUT: %bound_method.loc11_1.1: <bound method> = bound_method %int_1, %impl.elem0.loc11 [concrete = constants.%Convert.bound.ab5]
// CHECK:STDOUT: %specific_fn.loc11: <specific function> = specific_function %impl.elem0.loc11, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
// CHECK:STDOUT: %bound_method.loc11_1.2: <bound method> = bound_method %int_1, %specific_fn.loc11 [concrete = constants.%bound_method.9a1]
// CHECK:STDOUT: %int.convert_checked.loc11: init %i32 = call %bound_method.loc11_1.2(%int_1) [concrete = constants.%int_1.5d2]
// CHECK:STDOUT: %.loc11: init %i32 = converted %int_1, %int.convert_checked.loc11 [concrete = constants.%int_1.5d2]
// CHECK:STDOUT: assign file.%a.var, %.loc11
// CHECK:STDOUT: %impl.elem0.loc13: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
// CHECK:STDOUT: %bound_method.loc13_1.1: <bound method> = bound_method %int_1, %impl.elem0.loc13 [concrete = constants.%Convert.bound.ab5]
// CHECK:STDOUT: %specific_fn.loc13: <specific function> = specific_function %impl.elem0.loc13, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
// CHECK:STDOUT: %bound_method.loc13_1.2: <bound method> = bound_method %int_1, %specific_fn.loc13 [concrete = constants.%bound_method.9a1]
// CHECK:STDOUT: %int.convert_checked.loc13: init %i32 = call %bound_method.loc13_1.2(%int_1) [concrete = constants.%int_1.5d2]
// CHECK:STDOUT: %.loc13: init %i32 = converted %int_1, %int.convert_checked.loc13 [concrete = constants.%int_1.5d2]
// CHECK:STDOUT: assign file.%a.var, %.loc13
// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc]
// CHECK:STDOUT: %impl.elem0.loc12: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
// CHECK:STDOUT: %bound_method.loc12_1.1: <bound method> = bound_method %int_2, %impl.elem0.loc12 [concrete = constants.%Convert.bound.ef9]
// CHECK:STDOUT: %specific_fn.loc12: <specific function> = specific_function %impl.elem0.loc12, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
// CHECK:STDOUT: %bound_method.loc12_1.2: <bound method> = bound_method %int_2, %specific_fn.loc12 [concrete = constants.%bound_method.b92]
// CHECK:STDOUT: %int.convert_checked.loc12: init %i32 = call %bound_method.loc12_1.2(%int_2) [concrete = constants.%int_2.ef8]
// CHECK:STDOUT: %.loc12: init %i32 = converted %int_2, %int.convert_checked.loc12 [concrete = constants.%int_2.ef8]
// CHECK:STDOUT: assign file.%b.var, %.loc12
// CHECK:STDOUT: %impl.elem0.loc14: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
// CHECK:STDOUT: %bound_method.loc14_1.1: <bound method> = bound_method %int_2, %impl.elem0.loc14 [concrete = constants.%Convert.bound.ef9]
// CHECK:STDOUT: %specific_fn.loc14: <specific function> = specific_function %impl.elem0.loc14, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
// CHECK:STDOUT: %bound_method.loc14_1.2: <bound method> = bound_method %int_2, %specific_fn.loc14 [concrete = constants.%bound_method.b92]
// CHECK:STDOUT: %int.convert_checked.loc14: init %i32 = call %bound_method.loc14_1.2(%int_2) [concrete = constants.%int_2.ef8]
// CHECK:STDOUT: %.loc14: init %i32 = converted %int_2, %int.convert_checked.loc14 [concrete = constants.%int_2.ef8]
// CHECK:STDOUT: assign file.%b.var, %.loc14
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT:
+163 -59
View File
@@ -2,6 +2,8 @@
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// EXTRA-ARGS: --dump-sem-ir-ranges=only
//
// AUTOUPDATE
// TIP: To test this file alone, run:
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/type_literals.carbon
@@ -11,9 +13,57 @@
// --- iN.carbon
library "[[@TEST_NAME]]";
//@dump-sem-ir-begin
var test_i8: i8;
var test_i16: i16;
var test_i32: i32;
var test_i64: i64;
//@dump-sem-ir-end
// --- uN.carbon
library "[[@TEST_NAME]]";
//@dump-sem-ir-begin
var test_u8: u8;
var test_u16: u16;
var test_u32: u32;
var test_u64: u64;
//@dump-sem-ir-end
// --- fN.carbon
library "[[@TEST_NAME]]";
//@dump-sem-ir-begin
var test_f64: f64;
//@dump-sem-ir-end
// --- fail_fN_todo_unsupported.carbon
library "[[@TEST_NAME]]";
// TODO: Some or all of these should eventually work.
// CHECK:STDERR: fail_fN_todo_unsupported.carbon:[[@LINE+4]]:15: error: semantics TODO: `Currently only f64 is allowed` [SemanticsTodo]
// CHECK:STDERR: var test_f16: f16;
// CHECK:STDERR: ^~~
// CHECK:STDERR:
var test_f16: f16;
var test_f32: f32;
var test_f128: f128;
// --- string.carbon
library "[[@TEST_NAME]]";
//@dump-sem-ir-begin
let test_str: String = "Test";
//@dump-sem-ir-end
// --- type.carbon
library "[[@TEST_NAME]]";
//@dump-sem-ir-begin
var test_type: type = i32;
//@dump-sem-ir-end
// --- fail_iN_bad_width.carbon
library "[[@TEST_NAME]]";
@@ -52,13 +102,6 @@ var test_i1000000000: i1000000000;
// CHECK:STDERR:
var test_i10000000000000000000: i10000000000000000000;
// --- uN.carbon
library "[[@TEST_NAME]]";
var test_u8: u8;
var test_u16: u16;
var test_u64: u64;
// --- fail_uN_bad_width.carbon
library "[[@TEST_NAME]]";
@@ -114,57 +157,46 @@ var test_f100: f100;
var test_f1000000000: f1000000000;
var test_f1000000000000: f1000000000000;
// --- fail_fN_todo_unsupported.carbon
// --- fail_non_type_as_type.carbon
library "[[@TEST_NAME]]";
// TODO: Some or all of these should eventually work.
// CHECK:STDERR: fail_fN_todo_unsupported.carbon:[[@LINE+4]]:15: error: semantics TODO: `Currently only f64 is allowed` [SemanticsTodo]
// CHECK:STDERR: var test_f16: f16;
// CHECK:STDERR: ^~~
// CHECK:STDERR: fail_non_type_as_type.carbon:[[@LINE+7]]:1: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet]
// CHECK:STDERR: var x: type = 42;
// CHECK:STDERR: ^~~~~~~~~~~
// CHECK:STDERR: fail_non_type_as_type.carbon:[[@LINE+4]]:1: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote]
// CHECK:STDERR: var x: type = 42;
// CHECK:STDERR: ^~~~~~~~~~~
// CHECK:STDERR:
var test_f16: f16;
var test_f32: f32;
var test_f128: f128;
var x: type = 42;
// CHECK:STDOUT: --- iN.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %int_8: Core.IntLiteral = int_value 8 [concrete]
// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
// CHECK:STDOUT: %i8: type = class_type @Int, @Int(%int_8) [concrete]
// CHECK:STDOUT: %pattern_type.e3f: type = pattern_type %i8 [concrete]
// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
// CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
// CHECK:STDOUT: %pattern_type.2f8: type = pattern_type %i16 [concrete]
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
// CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [concrete]
// CHECK:STDOUT: %i64: type = class_type @Int, @Int(%int_64) [concrete]
// CHECK:STDOUT: %pattern_type.95b: type = pattern_type %i64 [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
// CHECK:STDOUT: .Int = %Core.Int
// CHECK:STDOUT: import Core//prelude
// CHECK:STDOUT: import Core//prelude/...
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
// CHECK:STDOUT: .Core = imports.%Core
// CHECK:STDOUT: .test_i8 = %test_i8
// CHECK:STDOUT: .test_i16 = %test_i16
// CHECK:STDOUT: .test_i64 = %test_i64
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %test_i8.patt: %pattern_type.e3f = binding_pattern test_i8 [concrete]
// CHECK:STDOUT: %test_i8.var_patt: %pattern_type.e3f = var_pattern %test_i8.patt [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %test_i8.var: ref %i8 = var %test_i8.var_patt [concrete]
// CHECK:STDOUT: %.loc3: type = splice_block %i8 [concrete = constants.%i8] {
// CHECK:STDOUT: %.loc4: type = splice_block %i8 [concrete = constants.%i8] {
// CHECK:STDOUT: %int_8: Core.IntLiteral = int_value 8 [concrete = constants.%int_8]
// CHECK:STDOUT: %i8: type = class_type @Int, @Int(constants.%int_8) [concrete = constants.%i8]
// CHECK:STDOUT: }
@@ -174,67 +206,60 @@ var test_f128: f128;
// CHECK:STDOUT: %test_i16.var_patt: %pattern_type.2f8 = var_pattern %test_i16.patt [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %test_i16.var: ref %i16 = var %test_i16.var_patt [concrete]
// CHECK:STDOUT: %.loc4: type = splice_block %i16 [concrete = constants.%i16] {
// CHECK:STDOUT: %.loc5: type = splice_block %i16 [concrete = constants.%i16] {
// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
// CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
// CHECK:STDOUT: }
// CHECK:STDOUT: %test_i16: ref %i16 = bind_name test_i16, %test_i16.var
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %test_i32.patt: %pattern_type.7ce = binding_pattern test_i32 [concrete]
// CHECK:STDOUT: %test_i32.var_patt: %pattern_type.7ce = var_pattern %test_i32.patt [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %test_i32.var: ref %i32 = var %test_i32.var_patt [concrete]
// CHECK:STDOUT: %.loc6: type = splice_block %i32 [concrete = constants.%i32] {
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
// CHECK:STDOUT: }
// CHECK:STDOUT: %test_i32: ref %i32 = bind_name test_i32, %test_i32.var
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %test_i64.patt: %pattern_type.95b = binding_pattern test_i64 [concrete]
// CHECK:STDOUT: %test_i64.var_patt: %pattern_type.95b = var_pattern %test_i64.patt [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %test_i64.var: ref %i64 = var %test_i64.var_patt [concrete]
// CHECK:STDOUT: %.loc5: type = splice_block %i64 [concrete = constants.%i64] {
// CHECK:STDOUT: %.loc7: type = splice_block %i64 [concrete = constants.%i64] {
// CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [concrete = constants.%int_64]
// CHECK:STDOUT: %i64: type = class_type @Int, @Int(constants.%int_64) [concrete = constants.%i64]
// CHECK:STDOUT: }
// CHECK:STDOUT: %test_i64: ref %i64 = bind_name test_i64, %test_i64.var
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: --- fail_iN_bad_width.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: --- uN.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %int_8: Core.IntLiteral = int_value 8 [concrete]
// CHECK:STDOUT: %UInt.type: type = generic_class_type @UInt [concrete]
// CHECK:STDOUT: %UInt.generic: %UInt.type = struct_value () [concrete]
// CHECK:STDOUT: %u8: type = class_type @UInt, @UInt(%int_8) [concrete]
// CHECK:STDOUT: %pattern_type.8f3: type = pattern_type %u8 [concrete]
// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
// CHECK:STDOUT: %u16: type = class_type @UInt, @UInt(%int_16) [concrete]
// CHECK:STDOUT: %pattern_type.9db: type = pattern_type %u16 [concrete]
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(%int_32) [concrete]
// CHECK:STDOUT: %pattern_type.4a9: type = pattern_type %u32 [concrete]
// CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [concrete]
// CHECK:STDOUT: %u64: type = class_type @UInt, @UInt(%int_64) [concrete]
// CHECK:STDOUT: %pattern_type.157: type = pattern_type %u64 [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
// CHECK:STDOUT: .UInt = %Core.UInt
// CHECK:STDOUT: import Core//prelude
// CHECK:STDOUT: import Core//prelude/...
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.UInt: %UInt.type = import_ref Core//prelude/types/uint, UInt, loaded [concrete = constants.%UInt.generic]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
// CHECK:STDOUT: .Core = imports.%Core
// CHECK:STDOUT: .test_u8 = %test_u8
// CHECK:STDOUT: .test_u16 = %test_u16
// CHECK:STDOUT: .test_u64 = %test_u64
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %test_u8.patt: %pattern_type.8f3 = binding_pattern test_u8 [concrete]
// CHECK:STDOUT: %test_u8.var_patt: %pattern_type.8f3 = var_pattern %test_u8.patt [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %test_u8.var: ref %u8 = var %test_u8.var_patt [concrete]
// CHECK:STDOUT: %.loc3: type = splice_block %u8 [concrete = constants.%u8] {
// CHECK:STDOUT: %.loc4: type = splice_block %u8 [concrete = constants.%u8] {
// CHECK:STDOUT: %int_8: Core.IntLiteral = int_value 8 [concrete = constants.%int_8]
// CHECK:STDOUT: %u8: type = class_type @UInt, @UInt(constants.%int_8) [concrete = constants.%u8]
// CHECK:STDOUT: }
@@ -244,29 +269,108 @@ var test_f128: f128;
// CHECK:STDOUT: %test_u16.var_patt: %pattern_type.9db = var_pattern %test_u16.patt [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %test_u16.var: ref %u16 = var %test_u16.var_patt [concrete]
// CHECK:STDOUT: %.loc4: type = splice_block %u16 [concrete = constants.%u16] {
// CHECK:STDOUT: %.loc5: type = splice_block %u16 [concrete = constants.%u16] {
// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
// CHECK:STDOUT: %u16: type = class_type @UInt, @UInt(constants.%int_16) [concrete = constants.%u16]
// CHECK:STDOUT: }
// CHECK:STDOUT: %test_u16: ref %u16 = bind_name test_u16, %test_u16.var
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %test_u32.patt: %pattern_type.4a9 = binding_pattern test_u32 [concrete]
// CHECK:STDOUT: %test_u32.var_patt: %pattern_type.4a9 = var_pattern %test_u32.patt [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %test_u32.var: ref %u32 = var %test_u32.var_patt [concrete]
// CHECK:STDOUT: %.loc6: type = splice_block %u32 [concrete = constants.%u32] {
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(constants.%int_32) [concrete = constants.%u32]
// CHECK:STDOUT: }
// CHECK:STDOUT: %test_u32: ref %u32 = bind_name test_u32, %test_u32.var
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %test_u64.patt: %pattern_type.157 = binding_pattern test_u64 [concrete]
// CHECK:STDOUT: %test_u64.var_patt: %pattern_type.157 = var_pattern %test_u64.patt [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %test_u64.var: ref %u64 = var %test_u64.var_patt [concrete]
// CHECK:STDOUT: %.loc5: type = splice_block %u64 [concrete = constants.%u64] {
// CHECK:STDOUT: %.loc7: type = splice_block %u64 [concrete = constants.%u64] {
// CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [concrete = constants.%int_64]
// CHECK:STDOUT: %u64: type = class_type @UInt, @UInt(constants.%int_64) [concrete = constants.%u64]
// CHECK:STDOUT: }
// CHECK:STDOUT: %test_u64: ref %u64 = bind_name test_u64, %test_u64.var
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: --- fail_uN_bad_width.carbon
// CHECK:STDOUT: --- fN.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [concrete]
// CHECK:STDOUT: %Float.type: type = fn_type @Float [concrete]
// CHECK:STDOUT: %Float: %Float.type = struct_value () [concrete]
// CHECK:STDOUT: %pattern_type.3de: type = pattern_type f64 [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: --- fail_fN_bad_width.carbon
// CHECK:STDOUT: imports {
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: --- fail_fN_todo_unsupported.carbon
// CHECK:STDOUT: file {
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %test_f64.patt: %pattern_type.3de = binding_pattern test_f64 [concrete]
// CHECK:STDOUT: %test_f64.var_patt: %pattern_type.3de = var_pattern %test_f64.patt [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %test_f64.var: ref f64 = var %test_f64.var_patt [concrete]
// CHECK:STDOUT: %.loc4_15.1: type = splice_block %.loc4_15.3 [concrete = f64] {
// CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [concrete = constants.%int_64]
// CHECK:STDOUT: %float.make_type: init type = call constants.%Float(%int_64) [concrete = f64]
// CHECK:STDOUT: %.loc4_15.2: type = value_of_initializer %float.make_type [concrete = f64]
// CHECK:STDOUT: %.loc4_15.3: type = converted %float.make_type, %.loc4_15.2 [concrete = f64]
// CHECK:STDOUT: }
// CHECK:STDOUT: %test_f64: ref f64 = bind_name test_f64, %test_f64.var
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: --- string.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %pattern_type: type = pattern_type String [concrete]
// CHECK:STDOUT: %str: String = string_literal "Test" [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %test_str.patt: %pattern_type = binding_pattern test_str [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %test_str: String = bind_name test_str, @__global_init.%str
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @__global_init() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %str: String = string_literal "Test" [concrete = constants.%str]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: --- type.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %test_type.patt: %pattern_type.98f = binding_pattern test_type [concrete]
// CHECK:STDOUT: %test_type.var_patt: %pattern_type.98f = var_pattern %test_type.patt [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %test_type.var: ref type = var %test_type.var_patt [concrete]
// CHECK:STDOUT: %test_type: ref type = bind_name test_type, %test_type.var
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @__global_init() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
// CHECK:STDOUT: assign file.%test_type.var, %i32
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
+10
View File
@@ -0,0 +1,10 @@
# `Run` tests
<!--
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
-->
Tests of the `Run` entrypoint are in separate files because `Run` needs to be in
`Main//default`, and there can only be one such library per compile.
@@ -0,0 +1,17 @@
// 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
//
// EXTRA-ARGS: --dump-sem-ir-ranges=only
//
// AUTOUPDATE
// TIP: To test this file alone, run:
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/main_run/fail_mismatch_params.carbon
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/main_run/fail_mismatch_params.carbon
// CHECK:STDERR: fail_mismatch_params.carbon:[[@LINE+4]]:1: error: invalid signature for `Main.Run` function; expected `fn ()` or `fn () -> i32` [InvalidMainRunSignature]
// CHECK:STDERR: fn Run(n: i32) {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
// CHECK:STDERR:
fn Run(n: i32) {}
@@ -0,0 +1,19 @@
// 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
//
// EXTRA-ARGS: --dump-sem-ir-ranges=only
//
// AUTOUPDATE
// TIP: To test this file alone, run:
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/main_run/fail_mismatch_return.carbon
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/main_run/fail_mismatch_return.carbon
// CHECK:STDERR: fail_mismatch_return.carbon:[[@LINE+4]]:1: error: invalid signature for `Main.Run` function; expected `fn ()` or `fn () -> i32` [InvalidMainRunSignature]
// CHECK:STDERR: fn Run() -> f64 {
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
// CHECK:STDERR:
fn Run() -> f64 {
return 0.0;
}
@@ -2,15 +2,17 @@
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// EXTRA-ARGS: --dump-sem-ir-ranges=if-present
//
// AUTOUPDATE
// TIP: To test this file alone, run:
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/run.carbon
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/main_run/no_return.carbon
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/run.carbon
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/main_run/no_return.carbon
fn Run() {}
// CHECK:STDOUT: --- run.carbon
// CHECK:STDOUT: --- no_return.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %Run.type: type = fn_type @Run [concrete]
@@ -2,15 +2,17 @@
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// EXTRA-ARGS: --dump-sem-ir-ranges=if-present
//
// AUTOUPDATE
// TIP: To test this file alone, run:
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/run_i32.carbon
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/main_run/return_i32.carbon
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/run_i32.carbon
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/main_run/return_i32.carbon
fn Run() -> i32 { return 0; }
// CHECK:STDOUT: --- run_i32.carbon
// CHECK:STDOUT: --- return_i32.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
@@ -75,12 +77,12 @@ fn Run() -> i32 { return 0; }
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
// CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
// CHECK:STDOUT: %bound_method.loc11_27.1: <bound method> = bound_method %int_0, %impl.elem0 [concrete = constants.%Convert.bound]
// CHECK:STDOUT: %bound_method.loc13_27.1: <bound method> = bound_method %int_0, %impl.elem0 [concrete = constants.%Convert.bound]
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
// CHECK:STDOUT: %bound_method.loc11_27.2: <bound method> = bound_method %int_0, %specific_fn [concrete = constants.%bound_method]
// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc11_27.2(%int_0) [concrete = constants.%int_0.6a9]
// CHECK:STDOUT: %.loc11_27.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_0.6a9]
// CHECK:STDOUT: %.loc11_27.2: %i32 = converted %int_0, %.loc11_27.1 [concrete = constants.%int_0.6a9]
// CHECK:STDOUT: return %.loc11_27.2
// CHECK:STDOUT: %bound_method.loc13_27.2: <bound method> = bound_method %int_0, %specific_fn [concrete = constants.%bound_method]
// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc13_27.2(%int_0) [concrete = constants.%int_0.6a9]
// CHECK:STDOUT: %.loc13_27.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_0.6a9]
// CHECK:STDOUT: %.loc13_27.2: %i32 = converted %int_0, %.loc13_27.1 [concrete = constants.%int_0.6a9]
// CHECK:STDOUT: return %.loc13_27.2
// CHECK:STDOUT: }
// CHECK:STDOUT: