diff --git a/executable_semantics/ast/expression.cpp b/executable_semantics/ast/expression.cpp index 3d64f069f3218..07a728cdea262 100644 --- a/executable_semantics/ast/expression.cpp +++ b/executable_semantics/ast/expression.cpp @@ -271,7 +271,7 @@ void Expression::Print(llvm::raw_ostream& out) const { out << "Bool"; break; case ExpressionKind::IntTypeLiteral: - out << "Int"; + out << "i32"; break; case ExpressionKind::TypeTypeLiteral: out << "Type"; diff --git a/executable_semantics/interpreter/value.cpp b/executable_semantics/interpreter/value.cpp index 8afd86b1944de..3faaab09271f0 100644 --- a/executable_semantics/interpreter/value.cpp +++ b/executable_semantics/interpreter/value.cpp @@ -192,7 +192,7 @@ void Value::Print(llvm::raw_ostream& out) const { out << "Bool"; break; case Value::Kind::IntType: - out << "Int"; + out << "i32"; break; case Value::Kind::TypeType: out << "Type"; diff --git a/executable_semantics/syntax/lexer.lpp b/executable_semantics/syntax/lexer.lpp index cd9358b6b669e..1da3d96e56a03 100644 --- a/executable_semantics/syntax/lexer.lpp +++ b/executable_semantics/syntax/lexer.lpp @@ -8,6 +8,7 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include #include +#include "common/check.h" #include "executable_semantics/common/tracing_flag.h" #include "executable_semantics/syntax/parse_and_lex_context.h" #include "llvm/ADT/StringExtras.h" @@ -45,7 +46,6 @@ FALSE "false" FN "fn" FNTY "fnty" IF "if" -INT "Int" MATCH "match" NOT "not" OR "or" @@ -62,6 +62,7 @@ AWAIT "__await" UNDERSCORE "_" identifier [A-Za-z_][A-Za-z0-9_]* +sized_type_literal [iuf][1-9][0-9]* integer_literal [0-9]+ horizontal_whitespace [ \t\r] whitespace [ \t\r\n] @@ -106,7 +107,6 @@ operand_start [(A-Za-z0-9_"] {FN} { return Carbon::Parser::make_FN(context.current_token_position); } {FNTY} { return Carbon::Parser::make_FNTY(context.current_token_position); } {IF} { return Carbon::Parser::make_IF(context.current_token_position); } -{INT} { return Carbon::Parser::make_INT(context.current_token_position); } {MATCH} { return Carbon::Parser::make_MATCH(context.current_token_position); } {NOT} { return Carbon::Parser::make_NOT(context.current_token_position); } {OR} { return Carbon::Parser::make_OR(context.current_token_position); } @@ -122,6 +122,8 @@ operand_start [(A-Za-z0-9_"] {AWAIT} { return Carbon::Parser::make_AWAIT(context.current_token_position); } {UNDERSCORE} { return Carbon::Parser::make_UNDERSCORE(context.current_token_position); } +{sized_type_literal} { return Carbon::Parser::make_sized_type_literal(yytext, context.current_token_position); } + "=" return Carbon::Parser::make_EQUAL(context.current_token_position); "-" return Carbon::Parser::make_MINUS(context.current_token_position); "+" return Carbon::Parser::make_PLUS(context.current_token_position); @@ -183,8 +185,9 @@ operator and its operand, leading to three more cases: {integer_literal} { BEGIN(AFTER_OPERAND); - auto r = atof(yytext); - return Carbon::Parser::make_integer_literal(r, context.current_token_position); + int val; + CHECK(llvm::to_integer(yytext, val)); + return Carbon::Parser::make_integer_literal(val, context.current_token_position); } {ONE_LINE_COMMENT} { diff --git a/executable_semantics/syntax/parser.ypp b/executable_semantics/syntax/parser.ypp index 440eaf8a7f1b2..ac8d32c26bafb 100644 --- a/executable_semantics/syntax/parser.ypp +++ b/executable_semantics/syntax/parser.ypp @@ -55,8 +55,10 @@ #include #include +#include "common/check.h" #include "executable_semantics/syntax/syntax_helpers.h" #include "executable_semantics/syntax/parse_and_lex_context.h" +#include "llvm/ADT/StringExtras.h" } // %code top %code requires { @@ -88,6 +90,7 @@ void Carbon::Parser::error(const location_type&, const std::string& message) { %token integer_literal %token identifier +%token sized_type_literal %type designator %type declaration %type function_declaration @@ -129,7 +132,6 @@ void Carbon::Parser::error(const location_type&, const std::string& message) { %token AND %token OR %token NOT -%token INT %token BOOL %token TYPE %token FN @@ -221,8 +223,13 @@ expression: { $$ = Expression::MakeBoolLiteral(yylineno, true); } | FALSE { $$ = Expression::MakeBoolLiteral(yylineno, false); } -| INT - { $$ = Expression::MakeIntTypeLiteral(yylineno); } +| sized_type_literal + { + int val; + CHECK(llvm::to_integer(llvm::StringRef($1).substr(1), val)); + CHECK($1[0] == 'i' && val == 32) << "Only i32 is supported for now: " << $1; + $$ = Expression::MakeIntTypeLiteral(yylineno); + } | BOOL { $$ = Expression::MakeBoolTypeLiteral(yylineno); } | TYPE diff --git a/executable_semantics/testdata/assignment_copy1.carbon b/executable_semantics/testdata/assignment_copy1.carbon index d3f69431ad25a..5b8e663d0bc7b 100644 --- a/executable_semantics/testdata/assignment_copy1.carbon +++ b/executable_semantics/testdata/assignment_copy1.carbon @@ -4,10 +4,10 @@ // Test that assignment performs a copy and does not create an alias. -fn main() -> Int { - var x: Int = -1; +fn main() -> i32 { + var x: i32 = -1; { - var y: Int = 0; + var y: i32 = 0; x = y; // y dies here } diff --git a/executable_semantics/testdata/assignment_copy2.carbon b/executable_semantics/testdata/assignment_copy2.carbon index b87125101b8fc..6507d38a47187 100644 --- a/executable_semantics/testdata/assignment_copy2.carbon +++ b/executable_semantics/testdata/assignment_copy2.carbon @@ -4,9 +4,9 @@ // Test that assignment performs a copy and does not create an alias. -fn main() -> Int { - var x: Int = 0; - var y: Int = x; +fn main() -> i32 { + var x: i32 = 0; + var y: i32 = x; x = 1; return y; } diff --git a/executable_semantics/testdata/block1.carbon b/executable_semantics/testdata/block1.carbon index 40e9ae99ffe17..83cd1cfb24b34 100644 --- a/executable_semantics/testdata/block1.carbon +++ b/executable_semantics/testdata/block1.carbon @@ -2,10 +2,10 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn main() -> Int { - var x: Int = 0; +fn main() -> i32 { + var x: i32 = 0; { - var x: Int = 1; + var x: i32 = 1; } return x; } diff --git a/executable_semantics/testdata/block2.carbon b/executable_semantics/testdata/block2.carbon index 4f0b10bf0f7d8..4e8f3c1819981 100644 --- a/executable_semantics/testdata/block2.carbon +++ b/executable_semantics/testdata/block2.carbon @@ -2,8 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn main() -> Int { - var x: Int = 0; +fn main() -> i32 { + var x: i32 = 0; { // empty block } diff --git a/executable_semantics/testdata/break1.carbon b/executable_semantics/testdata/break1.carbon index 16db5182c3d0a..fbb844887bd4e 100644 --- a/executable_semantics/testdata/break1.carbon +++ b/executable_semantics/testdata/break1.carbon @@ -2,8 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn main() -> Int { - var x: Int = 2; +fn main() -> i32 { + var x: i32 = 2; while (true) { if (x == 0) { break; diff --git a/executable_semantics/testdata/choice1.carbon b/executable_semantics/testdata/choice1.carbon index 4518955ba42c6..0ea54952e6d0c 100644 --- a/executable_semantics/testdata/choice1.carbon +++ b/executable_semantics/testdata/choice1.carbon @@ -4,11 +4,11 @@ choice Ints { None, - One(Int), - Two(Int,Int) + One(i32), + Two(i32,i32) } -fn main() -> Int { +fn main() -> i32 { var x: auto = Ints.None(); var y: auto = Ints.One(42); var n: auto = 0; @@ -34,6 +34,6 @@ fn main() -> Int { // Test some alternate syntaxes choice MoreInts { None(), - One(Int), - Two(Int,Int), + One(i32), + Two(i32,i32), } diff --git a/executable_semantics/testdata/continue1.carbon b/executable_semantics/testdata/continue1.carbon index 317ddbc6df719..bca3143537b6e 100644 --- a/executable_semantics/testdata/continue1.carbon +++ b/executable_semantics/testdata/continue1.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn main() -> Int { +fn main() -> i32 { var x: auto = 2; while (not (x == 0)) { x = x - 1; diff --git a/executable_semantics/testdata/experimental_continuation1.carbon b/executable_semantics/testdata/experimental_continuation1.carbon index 09c20178b60bb..003467591f6a6 100644 --- a/executable_semantics/testdata/experimental_continuation1.carbon +++ b/executable_semantics/testdata/experimental_continuation1.carbon @@ -4,8 +4,8 @@ // Test that creating a continuation doesn't do anything. -fn main() -> Int { - var x: Int = 0; +fn main() -> i32 { + var x: i32 = 0; __continuation k { x = x + 1; } diff --git a/executable_semantics/testdata/experimental_continuation2.carbon b/executable_semantics/testdata/experimental_continuation2.carbon index d8f6baf6c5bdc..c60f9341af991 100644 --- a/executable_semantics/testdata/experimental_continuation2.carbon +++ b/executable_semantics/testdata/experimental_continuation2.carbon @@ -4,8 +4,8 @@ // Test creating and running a continuation. -fn main() -> Int { - var x: Int = 0; +fn main() -> i32 { + var x: i32 = 0; __continuation k { x = x + 1; } diff --git a/executable_semantics/testdata/experimental_continuation3.carbon b/executable_semantics/testdata/experimental_continuation3.carbon index afcb180a7a1af..e11178f20df88 100644 --- a/executable_semantics/testdata/experimental_continuation3.carbon +++ b/executable_semantics/testdata/experimental_continuation3.carbon @@ -5,8 +5,8 @@ // Test pausing a continuation with `__await` and restarting it with // `__run`. -fn main() -> Int { - var x: Int = 0; +fn main() -> i32 { + var x: i32 = 0; __continuation k { x = x + 1; __await; diff --git a/executable_semantics/testdata/experimental_continuation4.carbon b/executable_semantics/testdata/experimental_continuation4.carbon index f03df692a62c7..6f0ce7d51b8e2 100644 --- a/executable_semantics/testdata/experimental_continuation4.carbon +++ b/executable_semantics/testdata/experimental_continuation4.carbon @@ -5,8 +5,8 @@ // Assignment for continuations is shallow, so `k2` refers to the same // continuation as `k1`. -fn main() -> Int { - var x: Int = 0; +fn main() -> i32 { + var x: i32 = 0; __continuation k1 { x = x + 1; __await; diff --git a/executable_semantics/testdata/experimental_continuation5.carbon b/executable_semantics/testdata/experimental_continuation5.carbon index efdb383202241..02c826ce827ed 100644 --- a/executable_semantics/testdata/experimental_continuation5.carbon +++ b/executable_semantics/testdata/experimental_continuation5.carbon @@ -4,10 +4,10 @@ // Test access to block-scoped variables upon resuming a continuation. -fn main() -> Int { - var y: Int = 0; +fn main() -> i32 { + var y: i32 = 0; __continuation k { - var x: Int = 0; + var x: i32 = 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 65f9cd07deb5e..e31592c94d150 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 current: Int = 0; +var current: i32 = 0; -fn CountUpTo(x: Int) -> Int { +fn CountUpTo(x: i32) -> i32 { if (x == 0) { current = 0; __await; @@ -18,12 +18,12 @@ fn CountUpTo(x: Int) -> Int { } } -fn main() -> Int { +fn main() -> i32 { __continuation k { CountUpTo(5); } - var sum: Int = 0; - var count: Int = 5; + var sum: i32 = 0; + var count: i32 = 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 597b2ce004cf8..9ada4c5a5cb98 100644 --- a/executable_semantics/testdata/experimental_continuation7.carbon +++ b/executable_semantics/testdata/experimental_continuation7.carbon @@ -6,11 +6,11 @@ // on the stack such as the variable `x`. In this example the copy // happens after the variable `x` is created. -var y: Int = 0; +var y: i32 = 0; -fn main() -> Int { +fn main() -> i32 { __continuation k1 { - var x: Int = 0; + var x: i32 = 0; x = x + 1; __await; x = x + 2; diff --git a/executable_semantics/testdata/experimental_continuation8.carbon b/executable_semantics/testdata/experimental_continuation8.carbon index 6cb879a83c93d..d37bfe9b5e152 100644 --- a/executable_semantics/testdata/experimental_continuation8.carbon +++ b/executable_semantics/testdata/experimental_continuation8.carbon @@ -7,11 +7,11 @@ // happens before the variable `x` is created, so each continuation // creates a different `x`. -var y: Int = 0; +var y: i32 = 0; -fn main() -> Int { +fn main() -> i32 { __continuation k1 { - var x: Int = 0; + var x: i32 = 0; x = x + 1; __await; y = x; diff --git a/executable_semantics/testdata/experimental_continuation9.carbon b/executable_semantics/testdata/experimental_continuation9.carbon index be705ef4240df..5cbba38d43f1f 100644 --- a/executable_semantics/testdata/experimental_continuation9.carbon +++ b/executable_semantics/testdata/experimental_continuation9.carbon @@ -7,14 +7,14 @@ // is dangerous and can happen inside continuations. fn capture() -> __Continuation { - var x: Int = 1; + var x: i32 = 1; __continuation k { - var y: Int = x; + var y: i32 = x; } return k; } -fn main() -> Int { +fn main() -> i32 { 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 6016c2d336abe..c9b53d8891aba 100644 --- a/executable_semantics/testdata/fun1.carbon +++ b/executable_semantics/testdata/fun1.carbon @@ -2,10 +2,10 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn f(x: Int) -> Int { +fn f(x: i32) -> i32 { return x - 1; } -fn main() -> Int { +fn main() -> i32 { return f(1); } diff --git a/executable_semantics/testdata/fun2.carbon b/executable_semantics/testdata/fun2.carbon index a2980f353280b..f89949c2dd0cf 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(x: Int) -> Int { +fn f(x: i32) -> i32 { return 0; } -fn main() -> Int { - var a: Int = 0; var b: Int = 1; +fn main() -> i32 { + var a: i32 = 0; var b: i32 = 1; f(a); b = a; return b; diff --git a/executable_semantics/testdata/fun3.carbon b/executable_semantics/testdata/fun3.carbon index 200570bb6babe..e8997e87c3c42 100644 --- a/executable_semantics/testdata/fun3.carbon +++ b/executable_semantics/testdata/fun3.carbon @@ -3,10 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // Test multiple arguments -fn f(x: Int, y: Int) -> Int { +fn f(x: i32, y: i32) -> i32 { return x + y; } -fn main() -> Int { +fn main() -> i32 { return f(2,3) - 5; } diff --git a/executable_semantics/testdata/fun4.carbon b/executable_semantics/testdata/fun4.carbon index fffd1288b3591..9e38cd98dbdc4 100644 --- a/executable_semantics/testdata/fun4.carbon +++ b/executable_semantics/testdata/fun4.carbon @@ -5,7 +5,7 @@ // Test empty parameters and return type fn f() { } -fn main() -> Int { +fn main() -> i32 { f(); return 0; } diff --git a/executable_semantics/testdata/fun5.carbon b/executable_semantics/testdata/fun5.carbon index ad6bc85e870a6..1f392b6606830 100644 --- a/executable_semantics/testdata/fun5.carbon +++ b/executable_semantics/testdata/fun5.carbon @@ -2,8 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn add(x: Int, y: Int) => x + y; +fn add(x: i32, y: i32) => x + y; -fn main() -> Int { +fn main() -> i32 { return add(1, 2) - 3; } diff --git a/executable_semantics/testdata/fun6_fail_type.carbon b/executable_semantics/testdata/fun6_fail_type.carbon index c2de7341cbbca..1576f5fb3c043 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(x: Int, y: Int) -> Int { return x + y; } +fn f(x: i32, y: i32) -> i32 { return x + y; } -fn main() -> Int { - var xy: (Int, Int) = (1, 2); +fn main() -> i32 { + var xy: (i32, i32) = (1, 2); // should fail to type-check return f(xy); } diff --git a/executable_semantics/testdata/fun6_fail_type.golden b/executable_semantics/testdata/fun6_fail_type.golden index 0bfd7543f597c..6182f1b903797 100644 --- a/executable_semantics/testdata/fun6_fail_type.golden +++ b/executable_semantics/testdata/fun6_fail_type.golden @@ -1,4 +1,4 @@ COMPILATION ERROR: 10: type error in call -expected: (0 = Int, 1 = Int) -actual: (0 = (0 = Int, 1 = Int)) +expected: (0 = i32, 1 = i32) +actual: (0 = (0 = i32, 1 = i32)) EXIT CODE: 255 diff --git a/executable_semantics/testdata/fun_named_params.carbon b/executable_semantics/testdata/fun_named_params.carbon index bb5d158a7267e..f9b627c987c24 100644 --- a/executable_semantics/testdata/fun_named_params.carbon +++ b/executable_semantics/testdata/fun_named_params.carbon @@ -2,8 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn f(x: Int, .d = y: Int) => x + y; +fn f(x: i32, .d = y: i32) => x + y; -fn main() -> Int { +fn main() -> i32 { 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 61b9952a35424..fe4911e627288 100644 --- a/executable_semantics/testdata/fun_named_params2.carbon +++ b/executable_semantics/testdata/fun_named_params2.carbon @@ -2,8 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn f(x: Int, .d = y: Int, z: Int, .e = a: Int) => (x + y) - (z + a); +fn f(x: i32, .d = y: i32, z: i32, .e = a: i32) => (x + y) - (z + a); -fn main() -> Int { +fn main() -> i32 { return 0; } diff --git a/executable_semantics/testdata/fun_recur.carbon b/executable_semantics/testdata/fun_recur.carbon index c93318e182cb5..13a3924a631b8 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(x: Int) -> Int { +fn f(x: i32) -> i32 { if (x == 0) { return x; } else { @@ -10,6 +10,6 @@ fn f(x: Int) -> Int { } } -fn main() -> Int { +fn main() -> i32 { return f(2); } diff --git a/executable_semantics/testdata/funptr1.carbon b/executable_semantics/testdata/funptr1.carbon index 2173e0b6ff73c..8d7815a8c2e06 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(x: Int) -> Int { +fn add1(x: i32) -> i32 { return x + 1; } -fn main() -> Int { - var f: fnty(Int)->Int = add1; +fn main() -> i32 { + var f: fnty(i32)->i32 = add1; return f(-1); } diff --git a/executable_semantics/testdata/generic_function1.carbon b/executable_semantics/testdata/generic_function1.carbon index 3de4aba8bfeea..c49619d30fe7b 100644 --- a/executable_semantics/testdata/generic_function1.carbon +++ b/executable_semantics/testdata/generic_function1.carbon @@ -6,6 +6,6 @@ fn id[T:! Type](x: T) -> T { return x; } -fn main() -> Int { +fn main() -> i32 { return id(0); } diff --git a/executable_semantics/testdata/generic_function2.carbon b/executable_semantics/testdata/generic_function2.carbon index ef782e367647d..556b8ebd15172 100644 --- a/executable_semantics/testdata/generic_function2.carbon +++ b/executable_semantics/testdata/generic_function2.carbon @@ -6,6 +6,6 @@ fn fst[T:! Type](x: T, y: T) -> T { return x; } -fn main() -> Int { +fn main() -> i32 { return fst(0, 1); } diff --git a/executable_semantics/testdata/generic_function3.carbon b/executable_semantics/testdata/generic_function3.carbon index 716139ef58dca..d73579902de1d 100644 --- a/executable_semantics/testdata/generic_function3.carbon +++ b/executable_semantics/testdata/generic_function3.carbon @@ -2,10 +2,10 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn snd[T:! Type](x: Int, y: T) -> T { +fn snd[T:! Type](x: i32, y: T) -> T { return y; } -fn main() -> Int { +fn main() -> i32 { return snd(0, 1); } diff --git a/executable_semantics/testdata/generic_function_apply.carbon b/executable_semantics/testdata/generic_function_apply.carbon index d88324ab34c71..ad69b7012f8c9 100644 --- a/executable_semantics/testdata/generic_function_apply.carbon +++ b/executable_semantics/testdata/generic_function_apply.carbon @@ -6,7 +6,7 @@ fn apply[T:! Type, U:! Type](f: fnty (T) -> U, x: T) -> U { return f(x); } -fn positive(x: Bool) -> Int { +fn positive(x: Bool) -> i32 { if (x) { return 2; } else { @@ -14,6 +14,6 @@ fn positive(x: Bool) -> Int { } } -fn main() -> Int { +fn main() -> i32 { return apply(positive, false); } diff --git a/executable_semantics/testdata/generic_function_fail1.carbon b/executable_semantics/testdata/generic_function_fail1.carbon index a21596bc4d983..0c3a19f67d578 100644 --- a/executable_semantics/testdata/generic_function_fail1.carbon +++ b/executable_semantics/testdata/generic_function_fail1.carbon @@ -6,6 +6,6 @@ fn fst[T:! Type](x: T, y: T) -> T { return x; } -fn main() -> Int { +fn main() -> i32 { return fst(0, true); } diff --git a/executable_semantics/testdata/generic_function_fail1.golden b/executable_semantics/testdata/generic_function_fail1.golden index 95d8c5ec6c97c..c3d6a6dc1ca63 100644 --- a/executable_semantics/testdata/generic_function_fail1.golden +++ b/executable_semantics/testdata/generic_function_fail1.golden @@ -1,4 +1,4 @@ COMPILATION ERROR: 10: type error in argument deduction -expected: Int +expected: i32 actual: Bool EXIT CODE: 255 diff --git a/executable_semantics/testdata/generic_function_fail2.carbon b/executable_semantics/testdata/generic_function_fail2.carbon index 690254d5d8da0..416ac52ae7df7 100644 --- a/executable_semantics/testdata/generic_function_fail2.carbon +++ b/executable_semantics/testdata/generic_function_fail2.carbon @@ -2,10 +2,10 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn id[T:! Type](x: Int) -> Int { +fn id[T:! Type](x: i32) -> i32 { return x; } -fn main() -> Int { +fn main() -> i32 { return id(0); } diff --git a/executable_semantics/testdata/generic_function_fail3.carbon b/executable_semantics/testdata/generic_function_fail3.carbon index dedbc94b13410..3b4ec683a592e 100644 --- a/executable_semantics/testdata/generic_function_fail3.carbon +++ b/executable_semantics/testdata/generic_function_fail3.carbon @@ -6,6 +6,6 @@ fn id[T:! Type](x: T) -> T { return x + 0; } -fn main() -> Int { +fn main() -> i32 { return id(0); } diff --git a/executable_semantics/testdata/generic_function_fail3.golden b/executable_semantics/testdata/generic_function_fail3.golden index 7736dbc51630f..e39634c5ccdd1 100644 --- a/executable_semantics/testdata/generic_function_fail3.golden +++ b/executable_semantics/testdata/generic_function_fail3.golden @@ -1,4 +1,4 @@ COMPILATION ERROR: 6: type error in addition(1) -expected: Int +expected: i32 actual: T EXIT CODE: 255 diff --git a/executable_semantics/testdata/generic_function_swap.carbon b/executable_semantics/testdata/generic_function_swap.carbon index b646b4a041f32..4a7bc419fb33a 100644 --- a/executable_semantics/testdata/generic_function_swap.carbon +++ b/executable_semantics/testdata/generic_function_swap.carbon @@ -6,6 +6,6 @@ fn swap[T:! Type, U:! Type](tuple: (T, U)) -> (U, T) { return (tuple[1], tuple[0]); } -fn main() -> Int { +fn main() -> i32 { return swap((0, true))[1]; } diff --git a/executable_semantics/testdata/generic_function_tuple_map.carbon b/executable_semantics/testdata/generic_function_tuple_map.carbon index cd099cbd544db..e73084e2ca378 100644 --- a/executable_semantics/testdata/generic_function_tuple_map.carbon +++ b/executable_semantics/testdata/generic_function_tuple_map.carbon @@ -6,8 +6,8 @@ fn map[T:! Type](f: fnty (T) -> T, tuple: (T, T)) -> (T, T) { return (f(tuple[0]), f(tuple[1])); } -fn inc(x: Int) -> Int { return x + 1; } +fn inc(x: i32) -> i32 { return x + 1; } -fn main() -> Int { +fn main() -> i32 { return map(inc, (0, 2))[0]; } diff --git a/executable_semantics/testdata/global_variable1.carbon b/executable_semantics/testdata/global_variable1.carbon index ee13c7c9bd819..59c9863880afc 100644 --- a/executable_semantics/testdata/global_variable1.carbon +++ b/executable_semantics/testdata/global_variable1.carbon @@ -4,8 +4,8 @@ // Test global variable initialization and read. -var zero: Int = 0; +var zero: i32 = 0; -fn main() -> Int { +fn main() -> i32 { return zero; } diff --git a/executable_semantics/testdata/global_variable2.carbon b/executable_semantics/testdata/global_variable2.carbon index 22da34ad97fad..976c7ffc77d88 100644 --- a/executable_semantics/testdata/global_variable2.carbon +++ b/executable_semantics/testdata/global_variable2.carbon @@ -5,13 +5,13 @@ // Test that mutations to a global variable in one function is visible // in another function. -var flag: Int = 1; +var flag: i32 = 1; fn flipFlag() -> () { flag = 0; } -fn main() -> Int { +fn main() -> i32 { flipFlag(); return flag; } diff --git a/executable_semantics/testdata/global_variable3.carbon b/executable_semantics/testdata/global_variable3.carbon index 0bff693af229b..3fd83e2c3b8dd 100644 --- a/executable_semantics/testdata/global_variable3.carbon +++ b/executable_semantics/testdata/global_variable3.carbon @@ -4,8 +4,8 @@ // Test type checking of global variable. Error expected. -var flag: Int = true; +var flag: i32 = true; -fn main() -> Int { +fn main() -> i32 { return 0; } diff --git a/executable_semantics/testdata/global_variable3.golden b/executable_semantics/testdata/global_variable3.golden index bea966af02b8d..6b4a374ede660 100644 --- a/executable_semantics/testdata/global_variable3.golden +++ b/executable_semantics/testdata/global_variable3.golden @@ -1,4 +1,4 @@ COMPILATION ERROR: 7: type error in initializer of variable -expected: Int +expected: i32 actual: Bool EXIT CODE: 255 diff --git a/executable_semantics/testdata/global_variable4.carbon b/executable_semantics/testdata/global_variable4.carbon index fcf6d61011f5a..28c5b13c8b8b5 100644 --- a/executable_semantics/testdata/global_variable4.carbon +++ b/executable_semantics/testdata/global_variable4.carbon @@ -4,9 +4,9 @@ // Test mutation of a global variable. -var zero: Int = 1; +var zero: i32 = 1; -fn main() -> Int { +fn main() -> i32 { zero = 0; return zero; } diff --git a/executable_semantics/testdata/global_variable5.carbon b/executable_semantics/testdata/global_variable5.carbon index f4e073a3f6cbe..a528f6e93d179 100644 --- a/executable_semantics/testdata/global_variable5.carbon +++ b/executable_semantics/testdata/global_variable5.carbon @@ -4,12 +4,12 @@ // Test overshadowing of global variable. -var x: Int = 1; +var x: i32 = 1; -fn identity(x: Int) { +fn identity(x: i32) { return x; } -fn main() -> Int { +fn main() -> i32 { return identity(0); } diff --git a/executable_semantics/testdata/global_variable5.golden b/executable_semantics/testdata/global_variable5.golden index 2957a9e9f596d..73323db83507a 100644 --- a/executable_semantics/testdata/global_variable5.golden +++ b/executable_semantics/testdata/global_variable5.golden @@ -1,4 +1,4 @@ COMPILATION ERROR: 10: type error in return expected: () -actual: Int +actual: i32 EXIT CODE: 255 diff --git a/executable_semantics/testdata/global_variable6.carbon b/executable_semantics/testdata/global_variable6.carbon index e60522229937d..b21506d09b3e9 100644 --- a/executable_semantics/testdata/global_variable6.carbon +++ b/executable_semantics/testdata/global_variable6.carbon @@ -4,10 +4,10 @@ // Test a global variable depending on another global. -var x: Int = 0; +var x: i32 = 0; -var y: Int = x; +var y: i32 = x; -fn main() -> Int { +fn main() -> i32 { return y; } diff --git a/executable_semantics/testdata/global_variable7.carbon b/executable_semantics/testdata/global_variable7.carbon index 4a5ee11353716..fbdc37ae3e28a 100644 --- a/executable_semantics/testdata/global_variable7.carbon +++ b/executable_semantics/testdata/global_variable7.carbon @@ -4,12 +4,12 @@ // Test a global variable depending on a function. -fn f() -> Int { +fn f() -> i32 { return 0; } -var y: Int = f(); +var y: i32 = f(); -fn main() -> Int { +fn main() -> i32 { return y; } diff --git a/executable_semantics/testdata/global_variable8.carbon b/executable_semantics/testdata/global_variable8.carbon index 81587984e8666..7b5379ce43552 100644 --- a/executable_semantics/testdata/global_variable8.carbon +++ b/executable_semantics/testdata/global_variable8.carbon @@ -5,10 +5,10 @@ // Test that a global variable may not depend on a later global. // Error expected. -var x: Int = y; +var x: i32 = y; -var y: Int = 0; +var y: i32 = 0; -fn main() -> Int { +fn main() -> i32 { return x; } diff --git a/executable_semantics/testdata/if_else.carbon b/executable_semantics/testdata/if_else.carbon index 86751e380d75d..8b0402c005a02 100644 --- a/executable_semantics/testdata/if_else.carbon +++ b/executable_semantics/testdata/if_else.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn main() -> Int { +fn main() -> i32 { if (0 == 1) { return 1; } else { diff --git a/executable_semantics/testdata/if_else_if.carbon b/executable_semantics/testdata/if_else_if.carbon index f7b76917d3568..e6d65b491a5eb 100644 --- a/executable_semantics/testdata/if_else_if.carbon +++ b/executable_semantics/testdata/if_else_if.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn main() -> Int { +fn main() -> i32 { if (0 == 1) { return 1; } else if (0 == 0) { diff --git a/executable_semantics/testdata/if_else_if_else.carbon b/executable_semantics/testdata/if_else_if_else.carbon index 7de528cad7958..63d61ca03ae80 100644 --- a/executable_semantics/testdata/if_else_if_else.carbon +++ b/executable_semantics/testdata/if_else_if_else.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn main() -> Int { +fn main() -> i32 { if (0 == 1) { return 1; } else if (0 == 2) { diff --git a/executable_semantics/testdata/if_false.carbon b/executable_semantics/testdata/if_false.carbon index d1f4796ebcbf7..a457ef53a5d0b 100644 --- a/executable_semantics/testdata/if_false.carbon +++ b/executable_semantics/testdata/if_false.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn main() -> Int { +fn main() -> i32 { if (0 == 1) { return 1; } diff --git a/executable_semantics/testdata/if_nesting.carbon b/executable_semantics/testdata/if_nesting.carbon index 50afee2c554ba..e20a13292e925 100644 --- a/executable_semantics/testdata/if_nesting.carbon +++ b/executable_semantics/testdata/if_nesting.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn main() -> Int { +fn main() -> i32 { if (0 == 0) { if (0 == 1) { return 1; diff --git a/executable_semantics/testdata/if_true.carbon b/executable_semantics/testdata/if_true.carbon index 5503e624eb954..eb068817b1455 100644 --- a/executable_semantics/testdata/if_true.carbon +++ b/executable_semantics/testdata/if_true.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn main() -> Int { +fn main() -> i32 { if (1 == 1) { return 0; } diff --git a/executable_semantics/testdata/ignored_parameter.carbon b/executable_semantics/testdata/ignored_parameter.carbon index fbe00104243c4..0c145b98ed02c 100644 --- a/executable_semantics/testdata/ignored_parameter.carbon +++ b/executable_semantics/testdata/ignored_parameter.carbon @@ -2,10 +2,10 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn ReturnSecond(_: Int, x: Int) -> Int { +fn ReturnSecond(_: i32, x: i32) -> i32 { return x; } -fn main() -> Int { +fn main() -> i32 { return ReturnSecond(1, 0); } diff --git a/executable_semantics/testdata/match_any_int.carbon b/executable_semantics/testdata/match_any_int.carbon index 2bed2e8214386..8f7393d70cc48 100644 --- a/executable_semantics/testdata/match_any_int.carbon +++ b/executable_semantics/testdata/match_any_int.carbon @@ -2,10 +2,10 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn main() -> Int { +fn main() -> i32 { var t: auto = 5; match (t) { - case x: Int => + case x: i32 => return x - 5; } } diff --git a/executable_semantics/testdata/match_int.carbon b/executable_semantics/testdata/match_int.carbon index 1a96c676b9934..f4f43cd9fb558 100644 --- a/executable_semantics/testdata/match_int.carbon +++ b/executable_semantics/testdata/match_int.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn main() -> Int { +fn main() -> i32 { var t: auto = 5; match (t) { case 5 => diff --git a/executable_semantics/testdata/match_int_default.carbon b/executable_semantics/testdata/match_int_default.carbon index af0a9e1bf1007..41a7b77089291 100644 --- a/executable_semantics/testdata/match_int_default.carbon +++ b/executable_semantics/testdata/match_int_default.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn main() -> Int { +fn main() -> i32 { var t: auto = 5; match (t) { case 3 => diff --git a/executable_semantics/testdata/match_placeholder.carbon b/executable_semantics/testdata/match_placeholder.carbon index 7b9fddc045dd1..c0d3fc787779b 100644 --- a/executable_semantics/testdata/match_placeholder.carbon +++ b/executable_semantics/testdata/match_placeholder.carbon @@ -2,10 +2,10 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn main() -> Int { +fn main() -> i32 { var t: auto = (1, 2, 3, 4); match (t) { - case (_: Int, _: auto, x: Int, y: auto) => + case (_: i32, _: auto, x: i32, y: auto) => return y - x - 1; } } diff --git a/executable_semantics/testdata/next.carbon b/executable_semantics/testdata/next.carbon index 865899e86ee08..c64099d30d4b2 100644 --- a/executable_semantics/testdata/next.carbon +++ b/executable_semantics/testdata/next.carbon @@ -2,8 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn main () -> Int +fn main () -> i32 { - var x: Int = 0; + var x: i32 = 0; return x; } diff --git a/executable_semantics/testdata/no_match.carbon b/executable_semantics/testdata/no_match.carbon index fc9b2bc4b4314..9bb13a72650e7 100644 --- a/executable_semantics/testdata/no_match.carbon +++ b/executable_semantics/testdata/no_match.carbon @@ -2,8 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn main() -> Int { - var x: Int = 0; +fn main() -> i32 { + var x: i32 = 0; match (x) { case 1 => return 1; diff --git a/executable_semantics/testdata/pattern_init.carbon b/executable_semantics/testdata/pattern_init.carbon index c51f4e831237a..0edfae10e3299 100644 --- a/executable_semantics/testdata/pattern_init.carbon +++ b/executable_semantics/testdata/pattern_init.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn main() -> Int { +fn main() -> i32 { 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 35acad1e77de9..d4fe677c76317 100644 --- a/executable_semantics/testdata/pattern_variable_fail.carbon +++ b/executable_semantics/testdata/pattern_variable_fail.carbon @@ -2,8 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn main() -> Int { +fn main() -> i32 { // error - x : Int; + x : i32; return 1; } diff --git a/executable_semantics/testdata/placeholder_variable.carbon b/executable_semantics/testdata/placeholder_variable.carbon index 2fb18aded34dd..0d774ed46f381 100644 --- a/executable_semantics/testdata/placeholder_variable.carbon +++ b/executable_semantics/testdata/placeholder_variable.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn main() -> Int { +fn main() -> i32 { var _: auto = 1; return 0; } diff --git a/executable_semantics/testdata/record1.carbon b/executable_semantics/testdata/record1.carbon index 3d505c65edafc..88acdcccdf15c 100644 --- a/executable_semantics/testdata/record1.carbon +++ b/executable_semantics/testdata/record1.carbon @@ -2,8 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn main() -> Int { - var t2: (.x = Int, .y = Int) = (.x = 2, .y = 5); +fn main() -> i32 { + var t2: (.x = i32, .y = i32) = (.x = 2, .y = 5); t2.y = 3; return t2.y - t2.x - 1; // 3 - 2 - 1 } diff --git a/executable_semantics/testdata/return_empty_explicit.carbon b/executable_semantics/testdata/return_empty_explicit.carbon index 0b61343418138..5bb3bc0e3787c 100644 --- a/executable_semantics/testdata/return_empty_explicit.carbon +++ b/executable_semantics/testdata/return_empty_explicit.carbon @@ -6,7 +6,7 @@ fn F() -> () { return (); } -fn main() -> Int { +fn main() -> i32 { F(); return 0; } diff --git a/executable_semantics/testdata/return_empty_implicit1.carbon b/executable_semantics/testdata/return_empty_implicit1.carbon index f2b772ba61c05..1a58d4649cb1f 100644 --- a/executable_semantics/testdata/return_empty_implicit1.carbon +++ b/executable_semantics/testdata/return_empty_implicit1.carbon @@ -5,7 +5,7 @@ fn F() { } -fn main() -> Int { +fn main() -> i32 { F(); return 0; } diff --git a/executable_semantics/testdata/return_empty_implicit2.carbon b/executable_semantics/testdata/return_empty_implicit2.carbon index 433d1bbf97a28..9d83194a62f34 100644 --- a/executable_semantics/testdata/return_empty_implicit2.carbon +++ b/executable_semantics/testdata/return_empty_implicit2.carbon @@ -6,7 +6,7 @@ fn F() { return; } -fn main() -> Int { +fn main() -> i32 { F(); return 0; } diff --git a/executable_semantics/testdata/star.carbon b/executable_semantics/testdata/star.carbon index 3d943f2a13b60..58bbb3e34c51f 100644 --- a/executable_semantics/testdata/star.carbon +++ b/executable_semantics/testdata/star.carbon @@ -3,14 +3,14 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // Never actually called, so this only tests typechecking and semantic analysis. -fn F(n: Int, p: Int*, q: Int***) -> Int* { - var a: Int = n * *p; - var b: Int = a*n; +fn F(n: i32, p: i32*, q: i32***) -> i32* { + var a: i32 = n * *p; + var b: i32 = a*n; *p = b*(*p); **q = p; return **q; } -fn main() -> Int { +fn main() -> i32 { return 0; } diff --git a/executable_semantics/testdata/struct1.carbon b/executable_semantics/testdata/struct1.carbon index 142707ef0d87d..0679506e1f2d7 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 x: Int; - var y: Int; + var x: i32; + var y: i32; } -fn main() -> Int { +fn main() -> i32 { 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 dd195aac82276..e4e3f71895503 100644 --- a/executable_semantics/testdata/struct2.carbon +++ b/executable_semantics/testdata/struct2.carbon @@ -3,11 +3,11 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception struct Point { - var x: Int; - var y: Int; + var x: i32; + var y: i32; } -fn main() -> Int { +fn main() -> i32 { var p1: auto = Point(.x = 1, .y = 2); var p2: auto = p1; p2.x = 3; diff --git a/executable_semantics/testdata/struct3.carbon b/executable_semantics/testdata/struct3.carbon index ec6f819ac0745..967ea3dee543d 100644 --- a/executable_semantics/testdata/struct3.carbon +++ b/executable_semantics/testdata/struct3.carbon @@ -3,10 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception struct Point { - var x: Int; - var y: Int; + var x: i32; + var y: i32; } -fn main() -> Int { +fn main() -> i32 { return Point(.x = 1, .y = 2).x - 1; } diff --git a/executable_semantics/testdata/struct_field_access_mismatch.carbon b/executable_semantics/testdata/struct_field_access_mismatch.carbon index c4c0ecc62358d..62f1949cc6d67 100644 --- a/executable_semantics/testdata/struct_field_access_mismatch.carbon +++ b/executable_semantics/testdata/struct_field_access_mismatch.carbon @@ -3,10 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception struct Point { - var x: Int; - var y: Int; + var x: i32; + var y: i32; } -fn main() -> Int { +fn main() -> i32 { return Point(.x = 1, .y = 2).z - 1; } diff --git a/executable_semantics/testdata/struct_field_mismatch.carbon b/executable_semantics/testdata/struct_field_mismatch.carbon index 57170f0437eb1..76900787ab3ec 100644 --- a/executable_semantics/testdata/struct_field_mismatch.carbon +++ b/executable_semantics/testdata/struct_field_mismatch.carbon @@ -3,10 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception struct Point { - var x: Int; - var y: Int; + var x: i32; + var y: i32; } -fn main() -> Int { +fn main() -> i32 { return Point(.x = 1, .z = 2).x - 1; } diff --git a/executable_semantics/testdata/struct_field_mismatch.golden b/executable_semantics/testdata/struct_field_mismatch.golden index a4463ac38bad0..6f8e2d2ffd7b8 100644 --- a/executable_semantics/testdata/struct_field_mismatch.golden +++ b/executable_semantics/testdata/struct_field_mismatch.golden @@ -1,4 +1,4 @@ COMPILATION ERROR: 11: type error in call -expected: (x = Int, y = Int) -actual: (x = Int, z = Int) +expected: (x = i32, y = i32) +actual: (x = i32, z = i32) EXIT CODE: 255 diff --git a/executable_semantics/testdata/struct_field_missing.carbon b/executable_semantics/testdata/struct_field_missing.carbon index 9912bcfd9cd5f..66c13f3e8d297 100644 --- a/executable_semantics/testdata/struct_field_missing.carbon +++ b/executable_semantics/testdata/struct_field_missing.carbon @@ -3,10 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception struct Point { - var x: Int; - var y: Int; + var x: i32; + var y: i32; } -fn main() -> Int { +fn main() -> i32 { return Point(.x = 1).x - 1; } diff --git a/executable_semantics/testdata/struct_field_missing.golden b/executable_semantics/testdata/struct_field_missing.golden index 9c4a56440c097..1131c81865950 100644 --- a/executable_semantics/testdata/struct_field_missing.golden +++ b/executable_semantics/testdata/struct_field_missing.golden @@ -1,4 +1,4 @@ COMPILATION ERROR: 11: type error in call -expected: (x = Int, y = Int) -actual: (x = Int) +expected: (x = i32, y = i32) +actual: (x = i32) EXIT CODE: 255 diff --git a/executable_semantics/testdata/tuple1.carbon b/executable_semantics/testdata/tuple1.carbon index a3912a14b8d31..455ee40864a4b 100644 --- a/executable_semantics/testdata/tuple1.carbon +++ b/executable_semantics/testdata/tuple1.carbon @@ -2,9 +2,9 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn main() -> Int { - var x: Int = (1); - var t2: (Int,Int) = (5, 2); +fn main() -> i32 { + var x: i32 = (1); + var t2: (i32,i32) = (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 d906888a04f54..ebaaffd8e00ce 100644 --- a/executable_semantics/testdata/tuple2.carbon +++ b/executable_semantics/testdata/tuple2.carbon @@ -2,8 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn main() -> Int { - var t1: (Int,) = (5,); - var t2: (Int, Int) = (2, 3,); +fn main() -> i32 { + var t1: (i32,) = (5,); + var t2: (i32, i32) = (2, 3,); return t1[0] - t2[0] - t2[1]; } diff --git a/executable_semantics/testdata/tuple3.carbon b/executable_semantics/testdata/tuple3.carbon index e43ac4e0600ff..9fb60c2b47ebd 100644 --- a/executable_semantics/testdata/tuple3.carbon +++ b/executable_semantics/testdata/tuple3.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn main() -> Int { - var t: (Int, .x = Int) = (3, .x = 2); +fn main() -> i32 { + var t: (i32, .x = i32) = (3, .x = 2); return t.x + 1 - t[0]; } diff --git a/executable_semantics/testdata/tuple4.carbon b/executable_semantics/testdata/tuple4.carbon index f02dbc81a6e46..956483aacb37b 100644 --- a/executable_semantics/testdata/tuple4.carbon +++ b/executable_semantics/testdata/tuple4.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn main() -> Int { +fn main() -> i32 { var t: auto = (.x = 2, 3); return 0; } diff --git a/executable_semantics/testdata/tuple5.carbon b/executable_semantics/testdata/tuple5.carbon index b89be69549372..d40779c29f90a 100644 --- a/executable_semantics/testdata/tuple5.carbon +++ b/executable_semantics/testdata/tuple5.carbon @@ -4,7 +4,7 @@ // Test the that field order matters for tuples. -fn main() -> Int { - var t: (.x = Int, .y = Int) = (.y = 2, .x = 3); +fn main() -> i32 { + var t: (.x = i32, .y = i32) = (.y = 2, .x = 3); return 0; } diff --git a/executable_semantics/testdata/tuple5.golden b/executable_semantics/testdata/tuple5.golden index 56845af412d4c..eccc17107b43c 100644 --- a/executable_semantics/testdata/tuple5.golden +++ b/executable_semantics/testdata/tuple5.golden @@ -1,4 +1,4 @@ COMPILATION ERROR: 8: type error in pattern variable -expected: (x = Int, y = Int) -actual: (y = Int, x = Int) +expected: (x = i32, y = i32) +actual: (y = i32, x = i32) EXIT CODE: 255 diff --git a/executable_semantics/testdata/tuple_assign.carbon b/executable_semantics/testdata/tuple_assign.carbon index 94f5f6f2d7d2a..f8717764c7a05 100644 --- a/executable_semantics/testdata/tuple_assign.carbon +++ b/executable_semantics/testdata/tuple_assign.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn main() -> Int { +fn main() -> i32 { var x: auto = 0; var y: auto = 1; (x, y) = (5, -5); diff --git a/executable_semantics/testdata/tuple_equality.carbon b/executable_semantics/testdata/tuple_equality.carbon index de3bbe321bf84..fcc1cf21f083d 100644 --- a/executable_semantics/testdata/tuple_equality.carbon +++ b/executable_semantics/testdata/tuple_equality.carbon @@ -2,9 +2,9 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn main() -> Int { - var t1: (Int,Int) = (5, 2); - var t2: (Int,Int) = (5, 2); +fn main() -> i32 { + var t1: (i32,i32) = (5, 2); + var t2: (i32,i32) = (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 90649bfa88e87..507ebe1a14463 100644 --- a/executable_semantics/testdata/tuple_equality2.carbon +++ b/executable_semantics/testdata/tuple_equality2.carbon @@ -2,9 +2,9 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn main() -> Int { - var t1: (Int,Int) = (5, 2); - var t2: (Int,Int) = (5, 4); +fn main() -> i32 { + var t1: (i32,i32) = (5, 2); + var t2: (i32,i32) = (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 d5b71a4233c9f..00a694a1c5f5b 100644 --- a/executable_semantics/testdata/tuple_equality3.carbon +++ b/executable_semantics/testdata/tuple_equality3.carbon @@ -2,9 +2,9 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn main() -> Int { - var t1: (Int,Int) = (5, 2); - var t2: (Int,) = (5,); +fn main() -> i32 { + var t1: (i32,i32) = (5, 2); + var t2: (i32,) = (5,); if (t1 == t2) { return 1; } else { diff --git a/executable_semantics/testdata/tuple_equality3.golden b/executable_semantics/testdata/tuple_equality3.golden index 6cdc4b8eb2231..ff31cb848557a 100644 --- a/executable_semantics/testdata/tuple_equality3.golden +++ b/executable_semantics/testdata/tuple_equality3.golden @@ -1,4 +1,4 @@ COMPILATION ERROR: 8: type error in == -expected: (0 = Int, 1 = Int) -actual: (0 = Int) +expected: (0 = i32, 1 = i32) +actual: (0 = i32) EXIT CODE: 255 diff --git a/executable_semantics/testdata/tuple_match.carbon b/executable_semantics/testdata/tuple_match.carbon index b8073fc102cd0..9a54232ad7b0f 100644 --- a/executable_semantics/testdata/tuple_match.carbon +++ b/executable_semantics/testdata/tuple_match.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn main() -> Int { +fn main() -> i32 { var t: auto = (5, 2); match (t) { case (a: auto, b: auto) => diff --git a/executable_semantics/testdata/tuple_match2.carbon b/executable_semantics/testdata/tuple_match2.carbon index 53c6dbc3e218a..2f79de431b6c0 100644 --- a/executable_semantics/testdata/tuple_match2.carbon +++ b/executable_semantics/testdata/tuple_match2.carbon @@ -4,7 +4,7 @@ // Test matching with a mixture of positional and named fields. -fn main() -> Int { +fn main() -> i32 { var t: auto = (2, .x = 5); match (t) { case (a: auto, .x = b: auto) => diff --git a/executable_semantics/testdata/tuple_match3.carbon b/executable_semantics/testdata/tuple_match3.carbon index e0572188f8b06..f65310fd5388d 100644 --- a/executable_semantics/testdata/tuple_match3.carbon +++ b/executable_semantics/testdata/tuple_match3.carbon @@ -4,7 +4,7 @@ // Test matching of a tuple inside a tuple. -fn main() -> Int { +fn main() -> i32 { var t: auto = ((1,2),(3,4)); match (t) { case ((a: auto, b: auto), c: auto) => diff --git a/executable_semantics/testdata/type_compute.carbon b/executable_semantics/testdata/type_compute.carbon index 67a57298b5127..b7df36f7e1708 100644 --- a/executable_semantics/testdata/type_compute.carbon +++ b/executable_semantics/testdata/type_compute.carbon @@ -6,7 +6,7 @@ fn Id(t: Type) => t; // Test non-trivial type expression in variable declaration statement. -fn main() -> Int { - var x: Id(Int) = 0; +fn main() -> i32 { + var x: Id(i32) = 0; return x; } diff --git a/executable_semantics/testdata/type_compute2.carbon b/executable_semantics/testdata/type_compute2.carbon index 5898154b4bdfa..7f7322b03f93d 100644 --- a/executable_semantics/testdata/type_compute2.carbon +++ b/executable_semantics/testdata/type_compute2.carbon @@ -6,6 +6,6 @@ fn Id(t: Type) => t; // Test non-trivial type expression in return type. -fn main() -> Id(Int) { +fn main() -> Id(i32) { return 0; } diff --git a/executable_semantics/testdata/type_compute3.carbon b/executable_semantics/testdata/type_compute3.carbon index 7b6fdf50cd8dd..424a8dd7258ea 100644 --- a/executable_semantics/testdata/type_compute3.carbon +++ b/executable_semantics/testdata/type_compute3.carbon @@ -6,10 +6,10 @@ fn Id(t: Type) => t; // Test non-trivial type expression in parameter type. -fn f(x: Id(Int)) -> Int { +fn f(x: Id(i32)) -> i32 { return x; } -fn main() -> Int { +fn main() -> i32 { return f(0); } diff --git a/executable_semantics/testdata/while1.carbon b/executable_semantics/testdata/while1.carbon index 772246167df10..5215e4000fa1d 100644 --- a/executable_semantics/testdata/while1.carbon +++ b/executable_semantics/testdata/while1.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn main() -> Int { +fn main() -> i32 { var x: auto = 2; while (not (x == 0)) { x = x - 1; diff --git a/executable_semantics/testdata/zero.carbon b/executable_semantics/testdata/zero.carbon index 85911ed193e60..7a87538724c86 100644 --- a/executable_semantics/testdata/zero.carbon +++ b/executable_semantics/testdata/zero.carbon @@ -2,6 +2,6 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -fn main() -> Int { +fn main() -> i32 { return 0; }