mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-15 21:18:09 +00:00
This reverts commit 65a3c2b36a.
It was merged by accident with a dependent change. Will re-land
independently.
53 lines
1008 B
Plaintext
53 lines
1008 B
Plaintext
// 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 F;
|
|
fn F1();
|
|
fn Func(a: i32, b: A);
|
|
fn Generic[T: type, U: I](a: T, b: U) -> U;
|
|
fn Lambda(a: i32) -> i32 => return a + 5;
|
|
fn
|
|
|
|
MultiLine[
|
|
A: type,
|
|
B: C1,
|
|
C: C2
|
|
](a: A(B, C),
|
|
b: B,
|
|
c: i32);
|
|
fn Invalid#+?Name();
|
|
x.(I.F)();
|
|
|
|
a: A;
|
|
a: A = (b as A);
|
|
a: i32;
|
|
a: array(A, 5);
|
|
generic a: type;
|
|
generic a: T = b;
|
|
a: A in some_list;
|
|
var a: T;
|
|
let b: T;
|
|
binding: T;
|
|
generic binding: T;
|
|
var
|
|
multiline: T;
|
|
|
|
fn F(ref a: A, const ref b: B);
|
|
fn F() -> T;
|
|
fn F() -> T.U { return val; }
|
|
fn F() -> i32 => return val;
|
|
|
|
// --- lambdas and positional parameters
|
|
|
|
var explicit: auto = fn (x: i32) -> i32 { return x + 1; };
|
|
var expression: auto = fn (x: i32) => x + 1;
|
|
var positional: auto = fn { Print($0, $1, $42); };
|
|
|
|
// --- raw identifiers
|
|
|
|
r#class
|
|
r#if
|
|
r#i32
|
|
var r#var: i32 = r#class;
|