Files
carbon-lang/toolchain/semantics/testdata/function/basic.carbon
T
Jon Ross-Perkins 57090142e8 Start adding builtins to SemanticsIR (#2356)
This starts adding builtins with TypeType and IntegerLiteralType. Note, structurally that's all they are, and not directly accessible in any way.

Adds a type field to SemanticsNode. Now, IntegerLiteralType can be identified as having type=TypeType, and IntegerLiteral as type=IntegerLiteralType. The current iteration doesn't do anything for type propagation, because I wanted to avoid making this too big.

This also switches the Identifier IR to instead BindName, with some side-effects. I'd been trying to think how to provide a name for TypeType, and switching around how things worked seemed like a better approach. And while I think it's the right direction (e.g., alias should just be a BindName), I also realized I don't need to name TypeType: there's probably a keyword to refer to the builtin, so it shouldn't use regular name lookup.
2022-10-28 14:16:51 -07:00

28 lines
952 B
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: },
// 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() {}