From 567b9bb5a41ba89763831ce67587000aba358542 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Wed, 26 May 2021 14:46:32 -0700 Subject: [PATCH] Reverse 'type: identifier' to 'identifier: type' in executable semantics. --- executable_semantics/syntax/parser.ypp | 8 ++++---- .../testdata/assignment_copy1.carbon | 4 ++-- .../testdata/assignment_copy2.carbon | 4 ++-- executable_semantics/testdata/block1.carbon | 4 ++-- executable_semantics/testdata/block2.carbon | 2 +- executable_semantics/testdata/break1.carbon | 2 +- executable_semantics/testdata/choice1.carbon | 14 +++++++------- executable_semantics/testdata/continue1.carbon | 2 +- .../testdata/experimental_continuation1.carbon | 2 +- .../testdata/experimental_continuation2.carbon | 2 +- .../testdata/experimental_continuation3.carbon | 2 +- .../testdata/experimental_continuation4.carbon | 4 ++-- .../testdata/experimental_continuation5.carbon | 4 ++-- .../testdata/experimental_continuation6.carbon | 8 ++++---- .../testdata/experimental_continuation7.carbon | 6 +++--- .../testdata/experimental_continuation8.carbon | 6 +++--- .../testdata/experimental_continuation9.carbon | 6 +++--- executable_semantics/testdata/fun1.carbon | 2 +- executable_semantics/testdata/fun2.carbon | 4 ++-- executable_semantics/testdata/fun3.carbon | 2 +- executable_semantics/testdata/fun5.carbon | 2 +- .../testdata/fun6_fail_type.carbon | 4 ++-- .../testdata/fun_named_params.carbon | 2 +- .../testdata/fun_named_params2.carbon | 2 +- executable_semantics/testdata/fun_recur.carbon | 2 +- executable_semantics/testdata/funptr1.carbon | 4 ++-- .../testdata/global_variable1.carbon | 2 +- .../testdata/global_variable2.carbon | 2 +- .../testdata/global_variable3.carbon | 2 +- .../testdata/global_variable4.carbon | 2 +- .../testdata/global_variable5.carbon | 4 ++-- .../testdata/global_variable6.carbon | 4 ++-- .../testdata/global_variable7.carbon | 2 +- .../testdata/global_variable8.carbon | 4 ++-- executable_semantics/testdata/match_any_int.carbon | 4 ++-- executable_semantics/testdata/match_int.carbon | 2 +- .../testdata/match_int_default.carbon | 2 +- executable_semantics/testdata/match_type.carbon | 8 ++++---- executable_semantics/testdata/next.carbon | 2 +- executable_semantics/testdata/pattern_init.carbon | 2 +- .../testdata/pattern_variable_fail.carbon | 2 +- executable_semantics/testdata/record1.carbon | 2 +- executable_semantics/testdata/struct1.carbon | 6 +++--- executable_semantics/testdata/struct2.carbon | 8 ++++---- executable_semantics/testdata/struct3.carbon | 4 ++-- executable_semantics/testdata/tuple1.carbon | 4 ++-- executable_semantics/testdata/tuple2.carbon | 4 ++-- executable_semantics/testdata/tuple3.carbon | 2 +- executable_semantics/testdata/tuple4.carbon | 2 +- executable_semantics/testdata/tuple5.carbon | 2 +- executable_semantics/testdata/tuple_assign.carbon | 4 ++-- .../testdata/tuple_equality.carbon | 4 ++-- .../testdata/tuple_equality2.carbon | 4 ++-- .../testdata/tuple_equality3.carbon | 4 ++-- executable_semantics/testdata/tuple_match.carbon | 4 ++-- executable_semantics/testdata/tuple_match2.carbon | 4 ++-- executable_semantics/testdata/tuple_match3.carbon | 4 ++-- executable_semantics/testdata/type_compute.carbon | 4 ++-- executable_semantics/testdata/type_compute2.carbon | 2 +- executable_semantics/testdata/type_compute3.carbon | 4 ++-- executable_semantics/testdata/while1.carbon | 2 +- 61 files changed, 111 insertions(+), 111 deletions(-) diff --git a/executable_semantics/syntax/parser.ypp b/executable_semantics/syntax/parser.ypp index 2ed74be3cb88..eb998e2bb126 100644 --- a/executable_semantics/syntax/parser.ypp +++ b/executable_semantics/syntax/parser.ypp @@ -189,8 +189,8 @@ expression: { $$ = Carbon::Expression::MakeGetField(yylineno, $1, $2); } | expression "[" expression "]" { $$ = Carbon::Expression::MakeIndex(yylineno, $1, $3); } -| expression ":" identifier - { $$ = Carbon::Expression::MakeVarPat(yylineno, $3, $1); } +| identifier ":" expression + { $$ = Carbon::Expression::MakeVarPat(yylineno, $1, $3); } | integer_literal { $$ = Carbon::Expression::MakeInt(yylineno, $1); } | TRUE @@ -340,8 +340,8 @@ function_declaration: FN identifier tuple return_type ";" { $$ = MakeFunDef(yylineno, $2, $4, $3, 0); } ; -variable_declaration: expression ":" identifier - { $$ = MakeField(yylineno, $3, $1); } +variable_declaration: identifier ":" expression + { $$ = MakeField(yylineno, $1, $3); } ; member: VAR variable_declaration ";" { $$ = $2; } diff --git a/executable_semantics/testdata/assignment_copy1.carbon b/executable_semantics/testdata/assignment_copy1.carbon index a6311cb5d1d9..d3f69431ad25 100644 --- a/executable_semantics/testdata/assignment_copy1.carbon +++ b/executable_semantics/testdata/assignment_copy1.carbon @@ -5,9 +5,9 @@ // Test that assignment performs a copy and does not create an alias. fn main() -> Int { - var Int: x = -1; + var x: Int = -1; { - var Int: y = 0; + var y: Int = 0; x = y; // y dies here } diff --git a/executable_semantics/testdata/assignment_copy2.carbon b/executable_semantics/testdata/assignment_copy2.carbon index c991b955511b..b87125101b8f 100644 --- a/executable_semantics/testdata/assignment_copy2.carbon +++ b/executable_semantics/testdata/assignment_copy2.carbon @@ -5,8 +5,8 @@ // Test that assignment performs a copy and does not create an alias. fn main() -> Int { - var Int: x = 0; - var Int: y = x; + var x: Int = 0; + var y: Int = x; x = 1; return y; } diff --git a/executable_semantics/testdata/block1.carbon b/executable_semantics/testdata/block1.carbon index 7c6005123971..40e9ae99ffe1 100644 --- a/executable_semantics/testdata/block1.carbon +++ b/executable_semantics/testdata/block1.carbon @@ -3,9 +3,9 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception fn main() -> Int { - var Int: x = 0; + var x: Int = 0; { - var Int: x = 1; + var x: Int = 1; } return x; } diff --git a/executable_semantics/testdata/block2.carbon b/executable_semantics/testdata/block2.carbon index e985e9070254..4f0b10bf0f7d 100644 --- a/executable_semantics/testdata/block2.carbon +++ b/executable_semantics/testdata/block2.carbon @@ -3,7 +3,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception fn main() -> Int { - var Int: x = 0; + var x: Int = 0; { // empty block } diff --git a/executable_semantics/testdata/break1.carbon b/executable_semantics/testdata/break1.carbon index 126336e210a8..e0b29a2415c6 100644 --- a/executable_semantics/testdata/break1.carbon +++ b/executable_semantics/testdata/break1.carbon @@ -3,7 +3,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception fn main() -> Int { - var Int: x = 2; + var x: Int = 2; while (true) { if (x == 0) break; diff --git a/executable_semantics/testdata/choice1.carbon b/executable_semantics/testdata/choice1.carbon index 859dd9312733..4518955ba42c 100644 --- a/executable_semantics/testdata/choice1.carbon +++ b/executable_semantics/testdata/choice1.carbon @@ -9,23 +9,23 @@ choice Ints { } fn main() -> Int { - var auto: x = Ints.None(); - var auto: y = Ints.One(42); - var auto: n = 0; + var x: auto = Ints.None(); + var y: auto = Ints.One(42); + var n: auto = 0; match (y) { case Ints.None => n = n + 2; - case Ints.One(auto: x) => + case Ints.One(x: auto) => n = x + 1 - 42; - case Ints.Two(auto: a, auto: b) => + case Ints.Two(a: auto, b: auto) => n = 2; } match (x) { - case Ints.One(auto: x) => + case Ints.One(x: auto) => n = x + 2; case Ints.None() => n = n - 1; - case Ints.Two(auto: x, auto: y) => + case Ints.Two(x: auto, y: auto) => n = 5; } return n; diff --git a/executable_semantics/testdata/continue1.carbon b/executable_semantics/testdata/continue1.carbon index 7eefc430a27b..317ddbc6df71 100644 --- a/executable_semantics/testdata/continue1.carbon +++ b/executable_semantics/testdata/continue1.carbon @@ -3,7 +3,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception fn main() -> Int { - var auto: x = 2; + var x: auto = 2; while (not (x == 0)) { x = x - 1; continue; diff --git a/executable_semantics/testdata/experimental_continuation1.carbon b/executable_semantics/testdata/experimental_continuation1.carbon index bb1753a3ed2a..09c20178b60b 100644 --- a/executable_semantics/testdata/experimental_continuation1.carbon +++ b/executable_semantics/testdata/experimental_continuation1.carbon @@ -5,7 +5,7 @@ // Test that creating a continuation doesn't do anything. fn main() -> Int { - var Int: x = 0; + var x: Int = 0; __continuation k { x = x + 1; } diff --git a/executable_semantics/testdata/experimental_continuation2.carbon b/executable_semantics/testdata/experimental_continuation2.carbon index e67ad641c003..d8f6baf6c5bd 100644 --- a/executable_semantics/testdata/experimental_continuation2.carbon +++ b/executable_semantics/testdata/experimental_continuation2.carbon @@ -5,7 +5,7 @@ // Test creating and running a continuation. fn main() -> Int { - var Int: x = 0; + var x: Int = 0; __continuation k { x = x + 1; } diff --git a/executable_semantics/testdata/experimental_continuation3.carbon b/executable_semantics/testdata/experimental_continuation3.carbon index 5dbf98af058a..afcb180a7a1a 100644 --- a/executable_semantics/testdata/experimental_continuation3.carbon +++ b/executable_semantics/testdata/experimental_continuation3.carbon @@ -6,7 +6,7 @@ // `__run`. fn main() -> Int { - var Int: x = 0; + var x: Int = 0; __continuation k { x = x + 1; __await; diff --git a/executable_semantics/testdata/experimental_continuation4.carbon b/executable_semantics/testdata/experimental_continuation4.carbon index 32fffb80dded..f03df692a62c 100644 --- a/executable_semantics/testdata/experimental_continuation4.carbon +++ b/executable_semantics/testdata/experimental_continuation4.carbon @@ -6,13 +6,13 @@ // continuation as `k1`. fn main() -> Int { - var Int: x = 0; + var x: Int = 0; __continuation k1 { x = x + 1; __await; x = x + 2; } - var __Continuation: k2 = k1; + var k2: __Continuation = k1; __run k1; __run k2; return x; diff --git a/executable_semantics/testdata/experimental_continuation5.carbon b/executable_semantics/testdata/experimental_continuation5.carbon index ceb905d3796b..efdb38320224 100644 --- a/executable_semantics/testdata/experimental_continuation5.carbon +++ b/executable_semantics/testdata/experimental_continuation5.carbon @@ -5,9 +5,9 @@ // Test access to block-scoped variables upon resuming a continuation. fn main() -> Int { - var Int: y = 0; + var y: Int = 0; __continuation k { - var Int: x = 0; + var x: Int = 0; x = x + 1; __await; x = x + 2; diff --git a/executable_semantics/testdata/experimental_continuation6.carbon b/executable_semantics/testdata/experimental_continuation6.carbon index 77299a799843..65f9cd07deb5 100644 --- a/executable_semantics/testdata/experimental_continuation6.carbon +++ b/executable_semantics/testdata/experimental_continuation6.carbon @@ -4,9 +4,9 @@ // Test recursive functions inside continuations. -var Int: current = 0; +var current: Int = 0; -fn CountUpTo(Int: x) -> Int { +fn CountUpTo(x: Int) -> Int { if (x == 0) { current = 0; __await; @@ -22,8 +22,8 @@ fn main() -> Int { __continuation k { CountUpTo(5); } - var Int: sum = 0; - var Int: count = 5; + var sum: Int = 0; + var count: Int = 5; while (not (count == 0)) { __run k; sum = sum + current; diff --git a/executable_semantics/testdata/experimental_continuation7.carbon b/executable_semantics/testdata/experimental_continuation7.carbon index 90c0aae2b4e8..597b2ce004cf 100644 --- a/executable_semantics/testdata/experimental_continuation7.carbon +++ b/executable_semantics/testdata/experimental_continuation7.carbon @@ -6,18 +6,18 @@ // on the stack such as the variable `x`. In this example the copy // happens after the variable `x` is created. -var Int: y = 0; +var y: Int = 0; fn main() -> Int { __continuation k1 { - var Int: x = 0; + var x: Int = 0; x = x + 1; __await; x = x + 2; y = x; } __run k1; - var __Continuation: k2 = k1; + var k2: __Continuation = k1; __run k2; return y; } diff --git a/executable_semantics/testdata/experimental_continuation8.carbon b/executable_semantics/testdata/experimental_continuation8.carbon index fcad4d8278a8..6cb879a83c93 100644 --- a/executable_semantics/testdata/experimental_continuation8.carbon +++ b/executable_semantics/testdata/experimental_continuation8.carbon @@ -7,16 +7,16 @@ // happens before the variable `x` is created, so each continuation // creates a different `x`. -var Int: y = 0; +var y: Int = 0; fn main() -> Int { __continuation k1 { - var Int: x = 0; + var x: Int = 0; x = x + 1; __await; y = x; } - var __Continuation: k2 = k1; + var k2: __Continuation = k1; __run k1; __run k2; __run k1; diff --git a/executable_semantics/testdata/experimental_continuation9.carbon b/executable_semantics/testdata/experimental_continuation9.carbon index 3a6639cd10c1..be705ef4240d 100644 --- a/executable_semantics/testdata/experimental_continuation9.carbon +++ b/executable_semantics/testdata/experimental_continuation9.carbon @@ -7,15 +7,15 @@ // is dangerous and can happen inside continuations. fn capture() -> __Continuation { - var Int: x = 1; + var x: Int = 1; __continuation k { - var Int: y = x; + var y: Int = x; } return k; } fn main() -> Int { - var __Continuation: k = capture(); + var k: __Continuation = capture(); __run k; // error, lifetime of x is over return 0; } diff --git a/executable_semantics/testdata/fun1.carbon b/executable_semantics/testdata/fun1.carbon index f7ccc5ba83cd..6016c2d336ab 100644 --- a/executable_semantics/testdata/fun1.carbon +++ b/executable_semantics/testdata/fun1.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn f(Int: x) -> Int { +fn f(x: Int) -> Int { return x - 1; } diff --git a/executable_semantics/testdata/fun2.carbon b/executable_semantics/testdata/fun2.carbon index 8ea4f49fe4a0..a2980f353280 100644 --- a/executable_semantics/testdata/fun2.carbon +++ b/executable_semantics/testdata/fun2.carbon @@ -6,12 +6,12 @@ // This makes sure that when the value in `x` dies, // it does not cause the value in `a` to also die. -fn f(Int: x) -> Int { +fn f(x: Int) -> Int { return 0; } fn main() -> Int { - var Int: a = 0; var Int: b = 1; + var a: Int = 0; var b: Int = 1; f(a); b = a; return b; diff --git a/executable_semantics/testdata/fun3.carbon b/executable_semantics/testdata/fun3.carbon index 8cb0d9b5a34e..200570bb6bab 100644 --- a/executable_semantics/testdata/fun3.carbon +++ b/executable_semantics/testdata/fun3.carbon @@ -3,7 +3,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // Test multiple arguments -fn f(Int: x, Int: y) -> Int { +fn f(x: Int, y: Int) -> Int { return x + y; } diff --git a/executable_semantics/testdata/fun5.carbon b/executable_semantics/testdata/fun5.carbon index 85c525728ebb..ad6bc85e870a 100644 --- a/executable_semantics/testdata/fun5.carbon +++ b/executable_semantics/testdata/fun5.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn add(Int: x, Int: y) => x + y; +fn add(x: Int, y: Int) => x + y; fn main() -> Int { return add(1, 2) - 3; diff --git a/executable_semantics/testdata/fun6_fail_type.carbon b/executable_semantics/testdata/fun6_fail_type.carbon index b10a2c1537f0..c2de7341cbbc 100644 --- a/executable_semantics/testdata/fun6_fail_type.carbon +++ b/executable_semantics/testdata/fun6_fail_type.carbon @@ -2,10 +2,10 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn f(Int: x, Int: y) -> Int { return x + y; } +fn f(x: Int, y: Int) -> Int { return x + y; } fn main() -> Int { - var (Int, Int): xy = (1, 2); + var xy: (Int, Int) = (1, 2); // should fail to type-check return f(xy); } diff --git a/executable_semantics/testdata/fun_named_params.carbon b/executable_semantics/testdata/fun_named_params.carbon index 727741385536..bb5d158a7267 100644 --- a/executable_semantics/testdata/fun_named_params.carbon +++ b/executable_semantics/testdata/fun_named_params.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn f(Int: x, .d = Int: y) => x + y; +fn f(x: Int, .d = y: Int) => x + y; fn main() -> Int { return f(1, .d = 2) - 3; diff --git a/executable_semantics/testdata/fun_named_params2.carbon b/executable_semantics/testdata/fun_named_params2.carbon index 7aba92ccf5c1..61b9952a3542 100644 --- a/executable_semantics/testdata/fun_named_params2.carbon +++ b/executable_semantics/testdata/fun_named_params2.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn f(Int: x, .d = Int: y, Int: z, .e = Int: a) => (x + y) - (z + a); +fn f(x: Int, .d = y: Int, z: Int, .e = a: Int) => (x + y) - (z + a); fn main() -> Int { return 0; diff --git a/executable_semantics/testdata/fun_recur.carbon b/executable_semantics/testdata/fun_recur.carbon index b53060275b2f..b93d46813fc6 100644 --- a/executable_semantics/testdata/fun_recur.carbon +++ b/executable_semantics/testdata/fun_recur.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn f(Int: x) -> Int { +fn f(x: Int) -> Int { if (x == 0) return x; else diff --git a/executable_semantics/testdata/funptr1.carbon b/executable_semantics/testdata/funptr1.carbon index 114ace63fb3d..2173e0b6ff73 100644 --- a/executable_semantics/testdata/funptr1.carbon +++ b/executable_semantics/testdata/funptr1.carbon @@ -2,11 +2,11 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn add1(Int: x) -> Int { +fn add1(x: Int) -> Int { return x + 1; } fn main() -> Int { - var fnty(Int)->Int: f = add1; + var f: fnty(Int)->Int = add1; return f(-1); } diff --git a/executable_semantics/testdata/global_variable1.carbon b/executable_semantics/testdata/global_variable1.carbon index 3ad1fdd5409e..ee13c7c9bd81 100644 --- a/executable_semantics/testdata/global_variable1.carbon +++ b/executable_semantics/testdata/global_variable1.carbon @@ -4,7 +4,7 @@ // Test global variable initialization and read. -var Int: zero = 0; +var zero: Int = 0; fn main() -> Int { return zero; diff --git a/executable_semantics/testdata/global_variable2.carbon b/executable_semantics/testdata/global_variable2.carbon index 166d6d9dc47b..22da34ad97fa 100644 --- a/executable_semantics/testdata/global_variable2.carbon +++ b/executable_semantics/testdata/global_variable2.carbon @@ -5,7 +5,7 @@ // Test that mutations to a global variable in one function is visible // in another function. -var Int: flag = 1; +var flag: Int = 1; fn flipFlag() -> () { flag = 0; diff --git a/executable_semantics/testdata/global_variable3.carbon b/executable_semantics/testdata/global_variable3.carbon index 1c5f99a89dfb..0bff693af229 100644 --- a/executable_semantics/testdata/global_variable3.carbon +++ b/executable_semantics/testdata/global_variable3.carbon @@ -4,7 +4,7 @@ // Test type checking of global variable. Error expected. -var Int: flag = true; +var flag: Int = true; fn main() -> Int { return 0; diff --git a/executable_semantics/testdata/global_variable4.carbon b/executable_semantics/testdata/global_variable4.carbon index 762d4971e318..fcf6d61011f5 100644 --- a/executable_semantics/testdata/global_variable4.carbon +++ b/executable_semantics/testdata/global_variable4.carbon @@ -4,7 +4,7 @@ // Test mutation of a global variable. -var Int: zero = 1; +var zero: Int = 1; fn main() -> Int { zero = 0; diff --git a/executable_semantics/testdata/global_variable5.carbon b/executable_semantics/testdata/global_variable5.carbon index e2b86f83cd2e..f4e073a3f6cb 100644 --- a/executable_semantics/testdata/global_variable5.carbon +++ b/executable_semantics/testdata/global_variable5.carbon @@ -4,9 +4,9 @@ // Test overshadowing of global variable. -var Int: x = 1; +var x: Int = 1; -fn identity(Int: x) { +fn identity(x: Int) { return x; } diff --git a/executable_semantics/testdata/global_variable6.carbon b/executable_semantics/testdata/global_variable6.carbon index 3a48b6976873..e60522229937 100644 --- a/executable_semantics/testdata/global_variable6.carbon +++ b/executable_semantics/testdata/global_variable6.carbon @@ -4,9 +4,9 @@ // Test a global variable depending on another global. -var Int: x = 0; +var x: Int = 0; -var Int: y = x; +var y: Int = x; fn main() -> Int { return y; diff --git a/executable_semantics/testdata/global_variable7.carbon b/executable_semantics/testdata/global_variable7.carbon index a6bb8eeb341e..4a5ee1135371 100644 --- a/executable_semantics/testdata/global_variable7.carbon +++ b/executable_semantics/testdata/global_variable7.carbon @@ -8,7 +8,7 @@ fn f() -> Int { return 0; } -var Int: y = f(); +var y: Int = f(); fn main() -> Int { return y; diff --git a/executable_semantics/testdata/global_variable8.carbon b/executable_semantics/testdata/global_variable8.carbon index 41bf398067c5..81587984e866 100644 --- a/executable_semantics/testdata/global_variable8.carbon +++ b/executable_semantics/testdata/global_variable8.carbon @@ -5,9 +5,9 @@ // Test that a global variable may not depend on a later global. // Error expected. -var Int: x = y; +var x: Int = y; -var Int: y = 0; +var y: Int = 0; fn main() -> Int { return x; diff --git a/executable_semantics/testdata/match_any_int.carbon b/executable_semantics/testdata/match_any_int.carbon index 7de6e3017bc5..2bed2e821438 100644 --- a/executable_semantics/testdata/match_any_int.carbon +++ b/executable_semantics/testdata/match_any_int.carbon @@ -3,9 +3,9 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception fn main() -> Int { - var auto: t = 5; + var t: auto = 5; match (t) { - case Int: x => + case x: Int => return x - 5; } } diff --git a/executable_semantics/testdata/match_int.carbon b/executable_semantics/testdata/match_int.carbon index 6e809eb27a9a..1a96c676b993 100644 --- a/executable_semantics/testdata/match_int.carbon +++ b/executable_semantics/testdata/match_int.carbon @@ -3,7 +3,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception fn main() -> Int { - var auto: t = 5; + var t: auto = 5; match (t) { case 5 => return 0; diff --git a/executable_semantics/testdata/match_int_default.carbon b/executable_semantics/testdata/match_int_default.carbon index 62f61775940a..af0a9e1bf100 100644 --- a/executable_semantics/testdata/match_int_default.carbon +++ b/executable_semantics/testdata/match_int_default.carbon @@ -3,7 +3,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception fn main() -> Int { - var auto: t = 5; + var t: auto = 5; match (t) { case 3 => return -1; diff --git a/executable_semantics/testdata/match_type.carbon b/executable_semantics/testdata/match_type.carbon index 324d81d3013d..6f05f65669b1 100644 --- a/executable_semantics/testdata/match_type.carbon +++ b/executable_semantics/testdata/match_type.carbon @@ -3,14 +3,14 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception fn main() -> Int { - var auto: t = fnty (Int,Int); - var Int: x = 0; + var t: auto = fnty (Int,Int); + var x: Int = 0; match (t) { - case Type: z => + case z: Type => x = x + 1; } match (t) { - case fnty(Type: a,Type: b) => + case fnty(a: Type,b: Type) => x = x - 1; } return x; diff --git a/executable_semantics/testdata/next.carbon b/executable_semantics/testdata/next.carbon index c1324486b8f8..865899e86ee0 100644 --- a/executable_semantics/testdata/next.carbon +++ b/executable_semantics/testdata/next.carbon @@ -4,6 +4,6 @@ fn main () -> Int { - var Int: x = 0; + var x: Int = 0; return x; } diff --git a/executable_semantics/testdata/pattern_init.carbon b/executable_semantics/testdata/pattern_init.carbon index 7fa0b9cd3526..c51f4e831237 100644 --- a/executable_semantics/testdata/pattern_init.carbon +++ b/executable_semantics/testdata/pattern_init.carbon @@ -3,6 +3,6 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception fn main() -> Int { - var (auto: x, auto: y) = (2, 3); + var (x: auto, y: auto) = (2, 3); return y - x - 1; } diff --git a/executable_semantics/testdata/pattern_variable_fail.carbon b/executable_semantics/testdata/pattern_variable_fail.carbon index 938380adc9d7..35acad1e77de 100644 --- a/executable_semantics/testdata/pattern_variable_fail.carbon +++ b/executable_semantics/testdata/pattern_variable_fail.carbon @@ -4,6 +4,6 @@ fn main() -> Int { // error - Int : x; + x : Int; return 1; } diff --git a/executable_semantics/testdata/record1.carbon b/executable_semantics/testdata/record1.carbon index 9894837a9faa..3d505c65edaf 100644 --- a/executable_semantics/testdata/record1.carbon +++ b/executable_semantics/testdata/record1.carbon @@ -3,7 +3,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception fn main() -> Int { - var (.x = Int, .y = Int): t2 = (.x = 2, .y = 5); + var t2: (.x = Int, .y = Int) = (.x = 2, .y = 5); t2.y = 3; return t2.y - t2.x - 1; // 3 - 2 - 1 } diff --git a/executable_semantics/testdata/struct1.carbon b/executable_semantics/testdata/struct1.carbon index 7950f53ef191..142707ef0d87 100644 --- a/executable_semantics/testdata/struct1.carbon +++ b/executable_semantics/testdata/struct1.carbon @@ -3,11 +3,11 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception struct Point { - var Int: x; - var Int: y; + var x: Int; + var y: Int; } fn main() -> Int { - var auto: p = Point(.x = 1, .y = 2); + var p: auto = Point(.x = 1, .y = 2); return p.y - p.x - 1; } diff --git a/executable_semantics/testdata/struct2.carbon b/executable_semantics/testdata/struct2.carbon index ee43764a5909..dd195aac8227 100644 --- a/executable_semantics/testdata/struct2.carbon +++ b/executable_semantics/testdata/struct2.carbon @@ -3,13 +3,13 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception struct Point { - var Int: x; - var Int: y; + var x: Int; + var y: Int; } fn main() -> Int { - var auto: p1 = Point(.x = 1, .y = 2); - var auto: p2 = p1; + var p1: auto = Point(.x = 1, .y = 2); + var p2: auto = p1; p2.x = 3; return p1.x - 1; } diff --git a/executable_semantics/testdata/struct3.carbon b/executable_semantics/testdata/struct3.carbon index 3b425545df37..ec6f819ac074 100644 --- a/executable_semantics/testdata/struct3.carbon +++ b/executable_semantics/testdata/struct3.carbon @@ -3,8 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception struct Point { - var Int: x; - var Int: y; + var x: Int; + var y: Int; } fn main() -> Int { diff --git a/executable_semantics/testdata/tuple1.carbon b/executable_semantics/testdata/tuple1.carbon index c6b7a382f0b7..a3912a14b8d3 100644 --- a/executable_semantics/testdata/tuple1.carbon +++ b/executable_semantics/testdata/tuple1.carbon @@ -3,8 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception fn main() -> Int { - var Int: x = (1); - var (Int,Int): t2 = (5, 2); + var x: Int = (1); + var t2: (Int,Int) = (5, 2); t2[0] = 3; return t2[0] - t2[1] - x; } diff --git a/executable_semantics/testdata/tuple2.carbon b/executable_semantics/testdata/tuple2.carbon index 42040de20aad..d906888a04f5 100644 --- a/executable_semantics/testdata/tuple2.carbon +++ b/executable_semantics/testdata/tuple2.carbon @@ -3,7 +3,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception fn main() -> Int { - var (Int,): t1 = (5,); - var (Int, Int): t2 = (2, 3,); + var t1: (Int,) = (5,); + var t2: (Int, Int) = (2, 3,); return t1[0] - t2[0] - t2[1]; } diff --git a/executable_semantics/testdata/tuple3.carbon b/executable_semantics/testdata/tuple3.carbon index adae5da59ff5..e43ac4e0600f 100644 --- a/executable_semantics/testdata/tuple3.carbon +++ b/executable_semantics/testdata/tuple3.carbon @@ -3,6 +3,6 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception fn main() -> Int { - var (Int, .x = Int): t = (3, .x = 2); + var t: (Int, .x = Int) = (3, .x = 2); return t.x + 1 - t[0]; } diff --git a/executable_semantics/testdata/tuple4.carbon b/executable_semantics/testdata/tuple4.carbon index 2d4bd3d38830..f02dbc81a6e4 100644 --- a/executable_semantics/testdata/tuple4.carbon +++ b/executable_semantics/testdata/tuple4.carbon @@ -3,6 +3,6 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception fn main() -> Int { - var auto: t = (.x = 2, 3); + var t: auto = (.x = 2, 3); return 0; } diff --git a/executable_semantics/testdata/tuple5.carbon b/executable_semantics/testdata/tuple5.carbon index c36e695db741..b89be6954937 100644 --- a/executable_semantics/testdata/tuple5.carbon +++ b/executable_semantics/testdata/tuple5.carbon @@ -5,6 +5,6 @@ // Test the that field order matters for tuples. fn main() -> Int { - var (.x = Int, .y = Int): t = (.y = 2, .x = 3); + var t: (.x = Int, .y = Int) = (.y = 2, .x = 3); return 0; } diff --git a/executable_semantics/testdata/tuple_assign.carbon b/executable_semantics/testdata/tuple_assign.carbon index 392babb1c4a1..94f5f6f2d7d2 100644 --- a/executable_semantics/testdata/tuple_assign.carbon +++ b/executable_semantics/testdata/tuple_assign.carbon @@ -3,8 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception fn main() -> Int { - var auto: x = 0; - var auto: y = 1; + var x: auto = 0; + var y: auto = 1; (x, y) = (5, -5); return x + y; } diff --git a/executable_semantics/testdata/tuple_equality.carbon b/executable_semantics/testdata/tuple_equality.carbon index c8e421ed5c0c..de3bbe321bf8 100644 --- a/executable_semantics/testdata/tuple_equality.carbon +++ b/executable_semantics/testdata/tuple_equality.carbon @@ -3,8 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception fn main() -> Int { - var (Int,Int): t1 = (5, 2); - var (Int,Int): t2 = (5, 2); + var t1: (Int,Int) = (5, 2); + var t2: (Int,Int) = (5, 2); if (t1 == t2) { return 0; } else { diff --git a/executable_semantics/testdata/tuple_equality2.carbon b/executable_semantics/testdata/tuple_equality2.carbon index 88059622ef3e..90649bfa88e8 100644 --- a/executable_semantics/testdata/tuple_equality2.carbon +++ b/executable_semantics/testdata/tuple_equality2.carbon @@ -3,8 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception fn main() -> Int { - var (Int,Int): t1 = (5, 2); - var (Int,Int): t2 = (5, 4); + var t1: (Int,Int) = (5, 2); + var t2: (Int,Int) = (5, 4); if (t1 == t2) { return 1; } else { diff --git a/executable_semantics/testdata/tuple_equality3.carbon b/executable_semantics/testdata/tuple_equality3.carbon index 185f02e0307e..d5b71a4233c9 100644 --- a/executable_semantics/testdata/tuple_equality3.carbon +++ b/executable_semantics/testdata/tuple_equality3.carbon @@ -3,8 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception fn main() -> Int { - var (Int,Int): t1 = (5, 2); - var (Int,): t2 = (5,); + var t1: (Int,Int) = (5, 2); + var t2: (Int,) = (5,); if (t1 == t2) { return 1; } else { diff --git a/executable_semantics/testdata/tuple_match.carbon b/executable_semantics/testdata/tuple_match.carbon index bc98c3ee2e89..b8073fc102cd 100644 --- a/executable_semantics/testdata/tuple_match.carbon +++ b/executable_semantics/testdata/tuple_match.carbon @@ -3,9 +3,9 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception fn main() -> Int { - var auto: t = (5, 2); + var t: auto = (5, 2); match (t) { - case (auto: a, auto: b) => + case (a: auto, b: auto) => return a + b - 7; } } diff --git a/executable_semantics/testdata/tuple_match2.carbon b/executable_semantics/testdata/tuple_match2.carbon index 3af74a674632..53c6dbc3e218 100644 --- a/executable_semantics/testdata/tuple_match2.carbon +++ b/executable_semantics/testdata/tuple_match2.carbon @@ -5,9 +5,9 @@ // Test matching with a mixture of positional and named fields. fn main() -> Int { - var auto: t = (2, .x = 5); + var t: auto = (2, .x = 5); match (t) { - case (auto: a, .x = auto: b) => + case (a: auto, .x = b: auto) => return a - b + 3; } } diff --git a/executable_semantics/testdata/tuple_match3.carbon b/executable_semantics/testdata/tuple_match3.carbon index 067a1baebee7..e0572188f8b0 100644 --- a/executable_semantics/testdata/tuple_match3.carbon +++ b/executable_semantics/testdata/tuple_match3.carbon @@ -5,9 +5,9 @@ // Test matching of a tuple inside a tuple. fn main() -> Int { - var auto: t = ((1,2),(3,4)); + var t: auto = ((1,2),(3,4)); match (t) { - case ((auto: a, auto: b), auto: c) => + case ((a: auto, b: auto), c: auto) => return a - b + c[0] - c[1] + 2; } } diff --git a/executable_semantics/testdata/type_compute.carbon b/executable_semantics/testdata/type_compute.carbon index fa4f9bf68cfa..67a57298b512 100644 --- a/executable_semantics/testdata/type_compute.carbon +++ b/executable_semantics/testdata/type_compute.carbon @@ -2,11 +2,11 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn Id(Type: t) => t; +fn Id(t: Type) => t; // Test non-trivial type expression in variable declaration statement. fn main() -> Int { - var Id(Int): x = 0; + var x: Id(Int) = 0; return x; } diff --git a/executable_semantics/testdata/type_compute2.carbon b/executable_semantics/testdata/type_compute2.carbon index ff50e2cadcbc..5898154b4bdf 100644 --- a/executable_semantics/testdata/type_compute2.carbon +++ b/executable_semantics/testdata/type_compute2.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn Id(Type: t) => t; +fn Id(t: Type) => t; // Test non-trivial type expression in return type. diff --git a/executable_semantics/testdata/type_compute3.carbon b/executable_semantics/testdata/type_compute3.carbon index 9135f477c5d8..7b6fdf50cd8d 100644 --- a/executable_semantics/testdata/type_compute3.carbon +++ b/executable_semantics/testdata/type_compute3.carbon @@ -2,11 +2,11 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn Id(Type: t) => t; +fn Id(t: Type) => t; // Test non-trivial type expression in parameter type. -fn f(Id(Int): x) -> Int { +fn f(x: Id(Int)) -> Int { return x; } diff --git a/executable_semantics/testdata/while1.carbon b/executable_semantics/testdata/while1.carbon index ed80d1db47c4..6b48a8a78e60 100644 --- a/executable_semantics/testdata/while1.carbon +++ b/executable_semantics/testdata/while1.carbon @@ -3,7 +3,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception fn main() -> Int { - var auto: x = 2; + var x: auto = 2; while (not (x == 0)) x = x - 1; return x;