mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-16 01:48:12 +00:00
Add tests for generic terse function declarations. (#8051)
We have test coverage for both features in isolation, but it seems worthwhile having coverage for the combination of the two.
This commit is contained in:
1 parent
0421bf3b43
commit
6d51427790
4 files changed
+227
-153
No files matched your search
+7
-7
@@ -155,6 +155,13 @@ alias terse_id_fn = fn (x: i32) => x;
|
||||
fn TestAsGenericArgument() {
|
||||
PassToGeneric(id_fn);
|
||||
PassToGeneric(terse_id_fn);
|
||||
|
||||
alias generic_terse_id = fn [T: Core.Copy](x: T) => x;
|
||||
let g1: i32 = generic_terse_id(42 as i32);
|
||||
let g2: bool = generic_terse_id(true);
|
||||
alias generic_terse_pair = fn [T: Core.Copy, U: Core.Copy](x: T, y: U) => (x, y);
|
||||
let unused gp: (i32, bool) = generic_terse_pair(g1, g2);
|
||||
let unused g3: i32 = (fn [T: Core.Copy](x: T) => x)(10 as i32);
|
||||
}
|
||||
|
||||
// --- as_template_argument.carbon
|
||||
@@ -338,13 +345,6 @@ fn F() {
|
||||
(fn => 0);
|
||||
}
|
||||
|
||||
// --- dependent_terse_return.carbon
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
fn F() {
|
||||
(fn [T: Core.Copy](x: T) => x);
|
||||
}
|
||||
|
||||
// CHECK:STDOUT: --- empty.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
|
||||
Reference in new issue
Block a user