Add TODOs for implicit params to class and interface. (#3596)

Without these, the code crashes.
This commit is contained in:
Jon Ross-Perkins
2024-01-12 22:40:11 +00:00
committed by GitHub
parent 44fdcc3db8
commit e305c896a1
4 changed files with 53 additions and 0 deletions
+3
View File
@@ -26,6 +26,9 @@ static auto BuildClassDecl(Context& context, Parse::AnyClassDeclId parse_node)
if (context.node_stack().PopIf<Parse::NodeKind::TuplePattern>()) {
context.TODO(parse_node, "generic class");
}
if (context.node_stack().PopIf<Parse::NodeKind::ImplicitParamList>()) {
context.TODO(parse_node, "generic class");
}
auto name_context = context.decl_name_stack().FinishName();
context.node_stack()
+3
View File
@@ -27,6 +27,9 @@ static auto BuildInterfaceDecl(Context& context,
if (context.node_stack().PopIf<Parse::NodeKind::TuplePattern>()) {
context.TODO(parse_node, "generic interface");
}
if (context.node_stack().PopIf<Parse::NodeKind::ImplicitParamList>()) {
context.TODO(parse_node, "generic interface");
}
auto name_context = context.decl_name_stack().FinishName();
context.node_stack()
+24
View File
@@ -0,0 +1,24 @@
// 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
// CHECK:STDERR: fail_todo_generic.carbon:[[@LINE+6]]:1: ERROR: Semantics TODO: `generic class`.
// CHECK:STDERR: class C[]();
// CHECK:STDERR: ^~~~~~~~~~~~
// CHECK:STDERR: fail_todo_generic.carbon:[[@LINE+3]]:1: ERROR: Semantics TODO: `generic class`.
// CHECK:STDERR: class C[]();
// CHECK:STDERR: ^~~~~~~~~~~~
class C[]();
// CHECK:STDOUT: --- fail_todo_generic.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace package, {.C = %C.decl}
// CHECK:STDOUT: %C.decl = class_decl @C, ()
// CHECK:STDOUT: %C: type = class_type @C [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: class @C;
// CHECK:STDOUT:
@@ -0,0 +1,23 @@
// 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
// CHECK:STDERR: fail_todo_generic.carbon:[[@LINE+6]]:1: ERROR: Semantics TODO: `generic interface`.
// CHECK:STDERR: interface I[]();
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
// CHECK:STDERR: fail_todo_generic.carbon:[[@LINE+3]]:1: ERROR: Semantics TODO: `generic interface`.
// CHECK:STDERR: interface I[]();
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
interface I[]();
// CHECK:STDOUT: --- fail_todo_generic.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace package, {.I = %I.decl}
// CHECK:STDOUT: %I.decl = interface_decl @I, ()
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: interface @I;
// CHECK:STDOUT: