mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Recursive call of TypeCheckPattern ignored 'expected' parameter. Closes #2777
This commit is contained in:
@@ -4152,7 +4152,7 @@ auto TypeChecker::TypeCheckPattern(
|
||||
return ProgramError(binding.type().source_loc())
|
||||
<< "the type of a binding pattern cannot contain bindings";
|
||||
}
|
||||
CARBON_RETURN_IF_ERROR(TypeCheckPattern(&binding.type(), std::nullopt,
|
||||
CARBON_RETURN_IF_ERROR(TypeCheckPattern(&binding.type(), expected,
|
||||
impl_scope,
|
||||
enclosing_expression_category));
|
||||
Nonnull<const Value*> type = &binding.type().value();
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// 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: %{not} %{explorer-run}
|
||||
// RUN: %{not} %{explorer-run-trace}
|
||||
|
||||
package ExplorerTest api;
|
||||
|
||||
fn Main() -> i32 {
|
||||
// CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/tuple/fail_length_mismatch_with_auto.carbon:[[@LINE+1]]: tuples of different length
|
||||
var a: (auto,) = (1, 2);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// 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: %{not} %{explorer-run}
|
||||
// RUN: %{not} %{explorer-run-trace}
|
||||
|
||||
package ExplorerTest api;
|
||||
|
||||
fn Main() -> i32 {
|
||||
// CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/tuple/fail_unexpected_tuple.carbon:[[@LINE+1]]: didn't expect a tuple
|
||||
var a: (auto,) = 1;
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user