mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 06:34:41 +01:00
added a test for definition-side checking with expected failure (#673)
This commit is contained in:
@@ -42,6 +42,7 @@ EXAMPLES = [
|
||||
"generic_function_apply",
|
||||
"generic_function_fail1",
|
||||
"generic_function_fail2",
|
||||
"generic_function_fail3",
|
||||
"generic_function_swap",
|
||||
"generic_function_tuple_map",
|
||||
"global_variable1",
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
// 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
|
||||
|
||||
fn id[T:! Type](x: T) -> T {
|
||||
return x + 0;
|
||||
}
|
||||
|
||||
fn main() -> Int {
|
||||
return id(0);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
ERROR: 6: type error in addition(1)
|
||||
expected: Int
|
||||
actual: T
|
||||
EXIT CODE: 255
|
||||
Reference in New Issue
Block a user