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.
This commit is contained in:
Jon Ross-Perkins
2022-11-17 13:36:40 -08:00
committed by GitHub
parent c9a1e351ba
commit 4c8fdf5124
23 changed files with 298 additions and 55 deletions
+4 -2
View File
@@ -6,8 +6,10 @@
// 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_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";