Files
carbon-lang/toolchain/semantics/testdata/function/basic.carbon
T
Jon Ross-Perkins 4c8fdf5124 Start drafting out semantic type checking. (#2406)
This is a first pass at what semantic type checking might look like. Types propagate along nodes, we use an InvalidType object when there's an error, and once there's an InvalidType we stop doing so much type checking.

This adds some RealLiteral handling in order to get type mismatches. I'm cautious about creating some real value for SemanticsIR (since the tokenized buffer version is a bit constrained), so I'm not doing that yet. But I will probably need to in order to maintain SemanticsIR having hermetic copies of its data, without a parse tree dependency.
2022-11-17 13:36:40 -08:00

30 lines
1.0 KiB
Plaintext

// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// AUTOUPDATE
// RUN: %{carbon-run-semantics}
// CHECK:STDOUT: cross_reference_irs.size == 2,
// CHECK:STDOUT: cross_references = {
// CHECK:STDOUT: node_xref0 = xref(ir0, block0, node0);
// CHECK:STDOUT: node_xref1 = xref(ir0, block0, node1);
// CHECK:STDOUT: node_xref2 = xref(ir0, block0, node2);
// CHECK:STDOUT: node_xref3 = xref(ir0, block0, node3);
// CHECK:STDOUT: },
// CHECK:STDOUT: identifiers = {
// CHECK:STDOUT: ident0 = "Foo";
// CHECK:STDOUT: },
// CHECK:STDOUT: integer_literals = {
// CHECK:STDOUT: },
// CHECK:STDOUT: node_blocks = {
// CHECK:STDOUT: block0 = {
// CHECK:STDOUT: node0 = FunctionDeclaration();
// CHECK:STDOUT: node1 = BindName(ident0, node0);
// CHECK:STDOUT: node2 = FunctionDefinition(node0, block1);
// CHECK:STDOUT: },
// CHECK:STDOUT: block1 = {
// CHECK:STDOUT: },
// CHECK:STDOUT: }
fn Foo() {}