More testdata formatting fixes (#1199)

This commit is contained in:
josh11b
2022-04-20 11:53:45 -07:00
committed by GitHub
parent 10b209eaa7
commit 663d67b316
22 changed files with 42 additions and 32 deletions
@@ -16,9 +16,9 @@ package ExecutableSemanticsTest api;
fn Main() -> i32 {
var x: i32 = -1;
{
var y: i32 = 0;
x = y;
// y dies here
var y: i32 = 0;
x = y;
// y dies here
}
return x;
}
+2 -2
View File
@@ -14,7 +14,7 @@ package ExecutableSemanticsTest api;
choice Ints {
None,
One(i32),
Two(i32,i32)
Two(i32, i32)
}
fn Main() -> i32 {
@@ -44,5 +44,5 @@ fn Main() -> i32 {
choice MoreInts {
None(),
One(i32),
Two(i32,i32),
Two(i32, i32),
}
+2 -1
View File
@@ -14,5 +14,6 @@ package ExecutableSemanticsTest api;
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
// 3 - 2 - 1
return t2.y - t2.x - 1;
}
+1 -1
View File
@@ -24,6 +24,6 @@ class Point {
fn Main() -> i32 {
var p: Point = Point.Origin();
var f: __Fn()-> i32 = p.GetX;
var f: __Fn() -> i32 = p.GetX;
return f();
}
@@ -21,6 +21,6 @@ class Point {
}
fn Main() -> i32 {
var f: __Fn()->Point = Point.Origin;
var f: __Fn() -> Point = Point.Origin;
return f().x;
}
@@ -25,6 +25,7 @@ fn capture() -> __Continuation {
fn Main() -> i32 {
var k: __Continuation = capture();
__run k; // error, lifetime of x is over
// error, lifetime of x is over
__run k;
return 0;
}
@@ -17,5 +17,5 @@ fn f(x: i32, y: i32) -> i32 {
}
fn Main() -> i32 {
return f(2,3) - 5;
return f(2, 3) - 5;
}
@@ -20,7 +20,8 @@ fn f(x: i32) -> i32 {
}
fn Main() -> i32 {
var a: i32 = 0; var b: i32 = 1;
var a: i32 = 0;
var b: i32 = 1;
f(a);
b = a;
return b;
+1 -1
View File
@@ -12,6 +12,6 @@
package ExecutableSemanticsTest api;
fn Main() -> i32 {
var t: (auto, (i32, i32)) = ((1,2),(3,4));
var t: (auto, (i32, i32)) = ((1, 2), (3, 4));
return t[0][0] + t[1][1] - 5;
}
@@ -46,7 +46,7 @@ fn ScaleGeneric[U:! Vector](c: U, s: i32) -> U {
return c.Scale(s);
}
fn AddAndScaleGeneric[T:! Vector, V:! Vector](a: T, b: V, s: i32) -> (T,V) {
fn AddAndScaleGeneric[T:! Vector, V:! Vector](a: T, b: V, s: i32) -> (T, V) {
return (ScaleGeneric(a.Add(a), s),
ScaleGeneric(b.Add(b), s));
}
+1 -1
View File
@@ -14,7 +14,7 @@ package ExecutableSemanticsTest api;
choice Ints {
None,
One(i32),
Two(i32,i32)
Two(i32, i32)
}
fn Main() -> i32 {
+1 -1
View File
@@ -16,7 +16,7 @@ class Point {
return {.x = 0, .y = 0};
}
fn SetX[me: Point](x :i32) {
fn SetX[me: Point](x: i32) {
x = 10;
}
@@ -7,13 +7,14 @@
// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes %s
// AUTOUPDATE: %{executable_semantics} %s
// CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/let/fail_tuple_pattern_let_context.carbon:17: Cannot assign to rvalue 'c'
// CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/let/fail_tuple_pattern_let_context.carbon:18: Cannot assign to rvalue 'c'
package ExecutableSemanticsTest api;
fn Main() -> i32 {
let (var a: auto, b: auto, c:auto, d: auto) = (1, 2, 3, 4);
let (var a: auto, b: auto, c: auto, d: auto) = (1, 2, 3, 4);
a = 0;
c = 0; // should fail
// should fail
c = 0;
return 0;
}
@@ -12,6 +12,7 @@
package ExecutableSemanticsTest api;
fn Main() -> i32 {
let (var a: auto, b: auto, c:auto, var (d: auto, let e:auto)) = (1, 2, 3, (4, 5));
let (var a: auto, b: auto, c: auto, var (d: auto, let e: auto)) =
(1, 2, 3, (4, 5));
return 0;
}
@@ -12,6 +12,6 @@
package ExecutableSemanticsTest api;
fn Main() -> i32 {
var (var a: auto, b: auto, let c:auto, d: auto) = (1, 2, 3, 4);
var (var a: auto, b: auto, let c: auto, d: auto) = (1, 2, 3, 4);
return 0;
}
@@ -14,11 +14,13 @@ package ExecutableSemanticsTest api;
choice Ints {
None,
One(i32),
Two(i32,i32)
Two(i32, i32)
}
fn Main() -> i32 {
let (var Ints.Two(a1: auto, var a2: auto), ((b: auto, var c:auto), var (d: auto, e:auto))) = (Ints.Two(1, 10), ((2, 3), (4, 5)));
let (var Ints.Two(a1: auto, var a2: auto),
((b: auto, var c: auto), var (d: auto, e: auto))) =
(Ints.Two(1, 10), ((2, 3), (4, 5)));
a1 = 0;
a2 = 0;
c = 0;
+6 -3
View File
@@ -13,11 +13,14 @@ package ExecutableSemanticsTest api;
fn Main() -> i32 {
var x: i32 = 5;
x = 10; // changes x to 10
// changes x to 10
x = 10;
var p: i32* = &x;
*p = 7; // changes x to 7
// changes x to 7
*p = 7;
var q: i32* = &*p;
*q = 0; // changes x to 0
// changes x to 0
*q = 0;
var y: i32 = *p;
return y;
+2 -2
View File
@@ -12,8 +12,8 @@
package ExecutableSemanticsTest api;
fn Main() -> i32 {
var t1: (i32,i32) = (5, 2);
var t2: (i32,i32) = (5, 2);
var t1: (i32, i32) = (5, 2);
var t2: (i32, i32) = (5, 2);
if (t1 == t2) {
return 0;
} else {
+2 -2
View File
@@ -12,8 +12,8 @@
package ExecutableSemanticsTest api;
fn Main() -> i32 {
var t1: (i32,i32) = (5, 2);
var t2: (i32,i32) = (5, 4);
var t1: (i32, i32) = (5, 2);
var t2: (i32, i32) = (5, 4);
if (t1 == t2) {
return 1;
} else {
@@ -11,7 +11,7 @@
package ExecutableSemanticsTest api;
fn Main() -> i32 {
var t1: (i32,i32) = (5, 2);
var t1: (i32, i32) = (5, 2);
var t2: (i32,) = (5,);
if (t1 == t2) {
return 1;
+1 -1
View File
@@ -14,7 +14,7 @@ package ExecutableSemanticsTest api;
// Test matching of a tuple inside a tuple.
fn Main() -> i32 {
var t: auto = ((1,2),(3,4));
var t: auto = ((1, 2), (3, 4));
match (t) {
case ((a: auto, b: auto), c: auto) =>
return a - b + c[0] - c[1] + 2;
+1 -1
View File
@@ -13,7 +13,7 @@ package ExecutableSemanticsTest api;
fn Main() -> i32 {
var x: i32 = (1);
var t2: (i32,i32) = (5, 2);
var t2: (i32, i32) = (5, 2);
t2[0] = 3;
return t2[0] - t2[1] - x;
}