semi-colon after return statements are required

This commit is contained in:
gluax 2021-04-14 16:59:07 -04:00
parent bd9297499e
commit 1803925b08
154 changed files with 573 additions and 573 deletions

View File

@ -29,7 +29,7 @@ pub fn resolve_core_module<'a>(context: AsgContext<'a>, module: &str) -> Result<
r#" r#"
circuit Blake2s { circuit Blake2s {
function hash(seed: [u8; 32], message: [u8; 32]) -> [u8; 32] { function hash(seed: [u8; 32], message: [u8; 32]) -> [u8; 32] {
return [0; 32] return [0; 32];
} }
} }
"#, "#,

View File

@ -1,6 +1,6 @@
circuit Foo { circuit Foo {
function echo(x: u32) -> u32 { function echo(x: u32) -> u32 {
return x return x;
} }
} }

View File

@ -1,6 +1,6 @@
circuit Foo { circuit Foo {
function echo(x: u32) -> u32 { function echo(x: u32) -> u32 {
return x return x;
} }
} }

View File

@ -1,6 +1,6 @@
circuit Foo { circuit Foo {
function echo(x: u32) -> u32 { function echo(x: u32) -> u32 {
return x return x;
} }
} }

View File

@ -1,6 +1,6 @@
circuit Foo { circuit Foo {
function echo(x: u32) -> u32 { function echo(x: u32) -> u32 {
return x return x;
} }
} }

View File

@ -55,7 +55,7 @@ fn test_mut_member_function_fail() {
let program_string = r#" let program_string = r#"
circuit Foo { circuit Foo {
function echo(mut self, x: u32) -> u32 { function echo(mut self, x: u32) -> u32 {
return x return x;
} }
} }

View File

@ -2,7 +2,7 @@ circuit Foo {
f: u32, f: u32,
function bar() -> u32 { function bar() -> u32 {
return f return f;
} }
} }

View File

@ -1,6 +1,6 @@
circuit Foo { circuit Foo {
function bar() -> u32 { function bar() -> u32 {
return self.f return self.f;
} }
} }

View File

@ -1,7 +1,7 @@
function main () -> i8 { function main () -> i8 {
if true { if true {
return 1i8 //ignored return 1i8; //ignored
} }
return 2i8 //ignored return 2i8; //ignored
return 3i8 //returns return 3i8; //returns
} }

View File

@ -2,8 +2,8 @@ function main () -> u16 {
if false { if false {
const a = 1u16; const a = 1u16;
const b = a + 1u16; const b = a + 1u16;
return b return b;
} else if false { } else if false {
return 0u16 return 0u16;
} }
} }

View File

@ -1,7 +1,7 @@
function main(input) -> u32 { function main(input) -> u32 {
if input.registers.a == 0 { if input.registers.a == 0 {
return 0u32 return 0u32;
} else { } else {
return 1u32 return 1u32;
} }
} }

View File

@ -1,5 +1,5 @@
function foo() -> field { function foo() -> field {
return myGlobal return myGlobal;
} }
function main() { function main() {

View File

@ -1,3 +1,3 @@
function main() -> (bool, bool) { function main() -> (bool, bool) {
return true return true;
} }

View File

@ -1,3 +1,3 @@
function main() -> [u8; 3] { function main() -> [u8; 3] {
return input.registers.r return input.registers.r;
} }

View File

@ -1,3 +1,3 @@
function main() -> bool { function main() -> bool {
return input.registers.r return input.registers.r;
} }

View File

@ -1,6 +1,6 @@
circuit Foo { circuit Foo {
function echo(self, x: u32) -> u32 { function echo(self, x: u32) -> u32 {
return x return x;
} }
} }

View File

@ -2,11 +2,11 @@ circuit Foo {
x: u32, x: u32,
function add_x(self, y: u32) -> u32 { function add_x(self, y: u32) -> u32 {
return self.x + y return self.x + y;
} }
function call_add_x(self, y: u32) -> u32 { function call_add_x(self, y: u32) -> u32 {
return self.add_x(y) return self.add_x(y);
} }
} }

View File

@ -1,6 +1,6 @@
circuit Foo { circuit Foo {
function echo(x: u32) -> u32 { function echo(x: u32) -> u32 {
return x return x;
} }
} }

View File

@ -2,7 +2,7 @@ circuit Foo {
foo: u32, foo: u32,
function bar() -> u32 { function bar() -> u32 {
return 1u32 return 1u32;
} }
} }

View File

@ -49,7 +49,7 @@ fn test_mut_member_function() {
let program_string = r#" let program_string = r#"
circuit Foo { circuit Foo {
function echo(mut self, x: u32) -> u32 { function echo(mut self, x: u32) -> u32 {
return x return x;
} }
} }

View File

@ -2,7 +2,7 @@ circuit PedersenHash {
parameters: [u32; 512] parameters: [u32; 512]
function new(parameters: [u32; 512]) -> Self { function new(parameters: [u32; 512]) -> Self {
return Self { parameters: parameters } return Self { parameters: parameters };
} }
function hash(self, bits: [bool; 512]) -> u32 { function hash(self, bits: [bool; 512]) -> u32 {
@ -11,7 +11,7 @@ circuit PedersenHash {
const base = bits[i] ? self.parameters[i] : 0u32; const base = bits[i] ? self.parameters[i] : 0u32;
digest += base; digest += base;
} }
return digest return digest;
} }
} }

View File

@ -1,6 +1,6 @@
circuit Foo { circuit Foo {
static function new() -> Self { static function new() -> Self {
return Self { } return Self { };
} }
} }

View File

@ -2,7 +2,7 @@ circuit Foo {
f: u32, f: u32,
function bar(self) -> u32 { function bar(self) -> u32 {
return self.f return self.f;
} }
} }

View File

@ -1,5 +1,5 @@
import core.unstable.blake2s.Blake2s; import core.unstable.blake2s.Blake2s;
function main(seed: [u8; 32], message: [u8; 32]) -> [u8; 32] { function main(seed: [u8; 32], message: [u8; 32]) -> [u8; 32] {
return Blake2s::hash(seed, message) return Blake2s::hash(seed, message);
} }

View File

@ -36,7 +36,7 @@ fn test_function_rename() {
a += 1; a += 1;
} }
return a return a;
} }
function main() { function main() {
@ -63,7 +63,7 @@ fn test_imports() {
} }
function foo() -> u32 { function foo() -> u32 {
return 1u32 return 1u32;
} }
"#; "#;
imports imports

View File

@ -1,5 +1,5 @@
function one() -> u32 { function one() -> u32 {
return 1u32 return 1u32;
} }
function main() { function main() {

View File

@ -5,7 +5,7 @@ function iteration() -> u32 {
a += 1; a += 1;
} }
return a return a;
} }
function main() { function main() {

View File

@ -32,7 +32,7 @@ fn test_iteration() {
fn test_const_args() { fn test_const_args() {
let program_string = r#" let program_string = r#"
function one(const value: u32) -> u32 { function one(const value: u32) -> u32 {
return value + 1 return value + 1;
} }
function main() { function main() {
@ -52,7 +52,7 @@ fn test_const_args() {
fn test_const_args_used() { fn test_const_args_used() {
let program_string = r#" let program_string = r#"
function index(arr: [u8; 3], const value: u32) -> u8 { function index(arr: [u8; 3], const value: u32) -> u8 {
return arr[value] return arr[value];
} }
function main() { function main() {

View File

@ -1,5 +1,5 @@
function tuple() -> (bool, bool) { function tuple() -> (bool, bool) {
return (true, false) return (true, false);
} }
function main() { function main() {

View File

@ -1,3 +1,3 @@
function main() -> (bool, bool) { function main() -> (bool, bool) {
return (input.registers.a, input.registers.b) return (input.registers.a, input.registers.b);
} }

View File

@ -5,5 +5,5 @@ function main(
u32, u32,
u32, u32,
) { ) {
return (a, b) return (a, b);
} }

View File

@ -1,5 +1,5 @@
function one() -> bool { function one() -> bool {
return true return true;
} }
function main() { function main() {

View File

@ -1,5 +1,5 @@
function one() -> u32 { function one() -> u32 {
return 1u32 return 1u32;
} }
function main() { function main() {

View File

@ -1,9 +1,9 @@
function array_3x2_nested() -> [[u8; 2]; 3] { function array_3x2_nested() -> [[u8; 2]; 3] {
return [[0u8; 2]; 3] return [[0u8; 2]; 3];
} }
function array_3x2_tuple() -> [[u8; 2]; 3] { function array_3x2_tuple() -> [[u8; 2]; 3] {
return [0u8; (3, 2)] return [0u8; (3, 2)];
} }
function main() { function main() {

View File

@ -1,9 +1,9 @@
function array_3x2_nested() -> [u8; (3, 2)] { function array_3x2_nested() -> [u8; (3, 2)] {
return [[0u8; 2]; 3] return [[0u8; 2]; 3];
} }
function array_3x2_tuple() -> [u8; (3, 2)] { function array_3x2_tuple() -> [u8; (3, 2)] {
return [0u8; (3, 2)] return [0u8; (3, 2)];
} }
function main() { function main() {

View File

@ -3,7 +3,7 @@ function tuples() -> ((u8, u8), u32) {
const a: (u8, u8) = (1, 2); const a: (u8, u8) = (1, 2);
const b: u32 = 3; const b: u32 = 3;
return (a, b) return (a, b);
} }
function main() { function main() {

View File

@ -4,9 +4,9 @@ function tuple_conditional () -> (
i64 i64
) { ) {
if true { if true {
return (1, 1) return (1, 1);
} else { } else {
return (2, 2) return (2, 2);
} }
} }

View File

@ -4,5 +4,5 @@ circuit Point {
} }
function foo() -> u32 { function foo() -> u32 {
return 1u32 return 1u32;
} }

View File

@ -3,7 +3,7 @@ function swap(a: [u32; 2], const i: u32, const j: u32) -> [u32; 2] {
const t = a[i]; const t = a[i];
a[i] = a[j]; a[i] = a[j];
a[j] = t; a[j] = t;
return a return a;
} }
function main() { function main() {

View File

@ -1,7 +1,7 @@
function main() -> u32 { function main() -> u32 {
if input.registers.a == 0u32 { if input.registers.a == 0u32 {
return 0u32 return 0u32;
} else { } else {
return 1u32 return 1u32;
} }
} }

View File

@ -1,5 +1,5 @@
function foo() -> (bool, bool) { function foo() -> (bool, bool) {
return (true, false) return (true, false);
} }
function main() { function main() {

View File

@ -1,5 +1,5 @@
function foo() -> (bool, bool) { function foo() -> (bool, bool) {
return (true, false) return (true, false);
} }
function main() { function main() {

View File

@ -1,5 +1,5 @@
function foo() -> (bool, bool) { function foo() -> (bool, bool) {
return (true, false) return (true, false);
} }
function main() { function main() {

View File

@ -1,3 +1,3 @@
function main() -> [u8; 3] { function main() -> [u8; 3] {
return input.registers.r return input.registers.r;
} }

View File

@ -1,3 +1,3 @@
function main() -> bool { function main() -> bool {
return input.registers.r return input.registers.r;
} }

View File

@ -6,7 +6,7 @@ circuit Foo {
x: 1u32 x: 1u32
}; };
return new return new;
} }
} }

View File

@ -6,7 +6,7 @@ circuit Foo {
x: 1u32 x: 1u32
}; };
return new return new;
} }
} }

View File

@ -4,7 +4,7 @@ circuit Foo {
function z (mut self) -> u16 { function z (mut self) -> u16 {
self.y.0 += 1u8; self.y.0 += 1u8;
return 1u16 return 1u16;
} }
} }
function main() { function main() {

View File

@ -2,7 +2,7 @@ circuit Foo {
a: u8, a: u8,
function use_a(const self) -> u8 { function use_a(const self) -> u8 {
return self.a + 1 return self.a + 1;
} }
} }

View File

@ -2,7 +2,7 @@ circuit Bar {
b2: u32 b2: u32
function add_five(z:u32) -> u32 { function add_five(z:u32) -> u32 {
return z+5u32 return z+5u32;
} }
} }

View File

@ -2,7 +2,7 @@ circuit Foo {
x: u8 x: u8
function new(x: u8) -> Self { function new(x: u8) -> Self {
return Self { x } return Self { x };
} }
} }

View File

@ -2,7 +2,7 @@ circuit Foo {
x: u32, x: u32,
function echo(self) -> u32 { function echo(self) -> u32 {
return self.x return self.x;
} }
} }

View File

@ -1,6 +1,6 @@
circuit Foo { circuit Foo {
function echo(x: u32) -> u32 { function echo(x: u32) -> u32 {
return x return x;
} }
} }

View File

@ -1,6 +1,6 @@
circuit Foo { circuit Foo {
function echo(x: u32) -> u32 { function echo(x: u32) -> u32 {
return x return x;
} }
} }

View File

@ -2,11 +2,11 @@ circuit Foo {
x: u32, x: u32,
function add_x(self, y: u32) -> u32 { function add_x(self, y: u32) -> u32 {
return self.x + y return self.x + y;
} }
function call_add_x(self, y: u32) -> u32 { function call_add_x(self, y: u32) -> u32 {
return self.add_x(y) return self.add_x(y);
} }
} }

View File

@ -1,6 +1,6 @@
circuit Foo { circuit Foo {
function echo(x: u32) -> u32 { function echo(x: u32) -> u32 {
return x return x;
} }
} }

View File

@ -1,6 +1,6 @@
circuit Foo { circuit Foo {
function echo(x: u32) -> u32 { function echo(x: u32) -> u32 {
return x return x;
} }
} }

View File

@ -1,6 +1,6 @@
circuit Foo { circuit Foo {
function echo(x: u32) -> u32 { function echo(x: u32) -> u32 {
return x return x;
} }
} }

View File

@ -2,7 +2,7 @@ circuit Foo {
foo: u32, foo: u32,
function bar() -> u32 { function bar() -> u32 {
return 1u32 return 1u32;
} }
} }

View File

@ -3,7 +3,7 @@ circuit TestMe {
function test_me(mut self) -> u8 { function test_me(mut self) -> u8 {
self.x += 1; self.x += 1;
return self.x return self.x;
} }
} }

View File

@ -2,7 +2,7 @@ circuit PedersenHash {
parameters: [u32; 512] parameters: [u32; 512]
function new(parameters: [u32; 512]) -> Self { function new(parameters: [u32; 512]) -> Self {
return Self { parameters: parameters } return Self { parameters: parameters };
} }
function hash(self, bits: [bool; 512]) -> u32 { function hash(self, bits: [bool; 512]) -> u32 {
@ -11,7 +11,7 @@ circuit PedersenHash {
const base = bits[i] ? self.parameters[i] : 0u32; const base = bits[i] ? self.parameters[i] : 0u32;
digest += base; digest += base;
} }
return digest return digest;
} }
} }

View File

@ -1,6 +1,6 @@
circuit Foo { circuit Foo {
static function new() -> Self { static function new() -> Self {
return Self { } return Self { };
} }
} }

View File

@ -2,7 +2,7 @@ circuit Foo {
f: u32, f: u32,
function bar(self) -> u32 { function bar(self) -> u32 {
return self.f return self.f;
} }
} }

View File

@ -2,7 +2,7 @@ circuit Foo {
f: u32, f: u32,
function bar() -> u32 { function bar() -> u32 {
return f return f;
} }
} }

View File

@ -1,6 +1,6 @@
circuit Foo { circuit Foo {
function bar() -> u32 { function bar() -> u32 {
return self.f return self.f;
} }
} }

View File

@ -1,5 +1,5 @@
import core.unstable.blake2s.Blake2s; import core.unstable.blake2s.Blake2s;
function main(seed: [u8; 32], message: [u8; 32]) -> [u8; 32] { function main(seed: [u8; 32], message: [u8; 32]) -> [u8; 32] {
return Blake2s::hash(seed, message) return Blake2s::hash(seed, message);
} }

View File

@ -1,3 +1,3 @@
function main(registers) -> field { function main(registers) -> field {
return registers.r return registers.r;
} }

View File

@ -1,7 +1,7 @@
function main(x: u8) -> u8 { function main(x: u8) -> u8 {
if x == 2u8 { if x == 2u8 {
return 3u8 return 3u8;
} else { } else {
return 4u8 return 4u8;
} }
} }

View File

@ -1,5 +1,5 @@
function one() -> u32 { function one() -> u32 {
return 1u32 return 1u32;
} }
function main() { function main() {

View File

@ -5,7 +5,7 @@ function iteration() -> u32 {
a += 1; a += 1;
} }
return a return a;
} }
function main() { function main() {

View File

@ -1,5 +1,5 @@
function tuple() -> (bool, bool) { function tuple() -> (bool, bool) {
return (true, false) return (true, false);
} }
function main() { function main() {

View File

@ -1,7 +1,7 @@
function main () -> i8 { function main () -> i8 {
if true { if true {
return 1i8 //ignored return 1i8; //ignored;
} }
return 2i8 //ignored return 2i8; //ignored;
return 3i8 //returns return 3i8; //returns;
} }

View File

@ -2,8 +2,8 @@ function main () -> u16 {
if false { if false {
const a = 1u16; const a = 1u16;
const b = a + 1u16; const b = a + 1u16;
return b return b;
} else if false { } else if false {
return 0u16 return 0u16;
} }
} }

View File

@ -1,3 +1,3 @@
function main() -> (bool, bool) { function main() -> (bool, bool) {
return (input.registers.a, input.registers.b) return (input.registers.a, input.registers.b);
} }

View File

@ -5,5 +5,5 @@ function main(
u32, u32,
u32, u32,
) { ) {
return (a, b) return (a, b);
} }

View File

@ -1,5 +1,5 @@
function one() -> bool { function one() -> bool {
return true return true;
} }
function main() { function main() {

View File

@ -1,5 +1,5 @@
function one() -> u32 { function one() -> u32 {
return 1u32 return 1u32;
} }
function main() { function main() {

View File

@ -1,5 +1,5 @@
function array_3x2_tuple() -> [[u8; 2]; 3] { function array_3x2_tuple() -> [[u8; 2]; 3] {
return [0u8; (2, 3)] // The correct 3x2 array tuple is `[0u8; (3, 2)]` return [0u8; (2, 3)]; // The correct 3x2 array tuple is `[0u8; (3, 2)]`
} }
function main() { function main() {

View File

@ -1,9 +1,9 @@
function array_3x2_nested() -> [[u8; 2]; 3] { function array_3x2_nested() -> [[u8; 2]; 3] {
return [[0u8; 2]; 3] return [[0u8; 2]; 3];
} }
function array_3x2_tuple() -> [[u8; 2]; 3] { function array_3x2_tuple() -> [[u8; 2]; 3] {
return [0u8; (3, 2)] return [0u8; (3, 2)];
} }
function main() { function main() {

View File

@ -1,5 +1,5 @@
function array_3x2_nested() -> [u8; (3, 2)] { function array_3x2_nested() -> [u8; (3, 2)] {
return [[0u8; 3]; 2] // The correct 3x2 nested array is `[0u8; 2]; 3]` return [[0u8; 3]; 2]; // The correct 3x2 nested array is `[0u8; 2]; 3]`
} }
function main() { function main() {

View File

@ -1,9 +1,9 @@
function array_3x2_nested() -> [u8; (3, 2)] { function array_3x2_nested() -> [u8; (3, 2)] {
return [[0u8; 2]; 3] return [[0u8; 2]; 3];
} }
function array_3x2_tuple() -> [u8; (3, 2)] { function array_3x2_tuple() -> [u8; (3, 2)] {
return [0u8; (3, 2)] return [0u8; (3, 2)];
} }
function main() { function main() {

View File

@ -3,7 +3,7 @@ function tuples() -> ((u8, u8), u32) {
const a: (u8, u8) = (1, 2); const a: (u8, u8) = (1, 2);
const b: u32 = 3; const b: u32 = 3;
return (a, b) return (a, b);
} }
function main() { function main() {

View File

@ -4,9 +4,9 @@ function tuple_conditional () -> (
i64 i64
) { ) {
if true { if true {
return (1, 1) return (1, 1);
} else { } else {
return (2, 2) return (2, 2);
} }
} }

View File

@ -1,5 +1,5 @@
function foo() -> field { function foo() -> field {
return myGlobal return myGlobal;
} }
function main() { function main() {

View File

@ -4,5 +4,5 @@ circuit Point {
} }
function foo() -> u32 { function foo() -> u32 {
return 1u32 return 1u32;
} }

View File

@ -1,3 +1,3 @@
function main () -> [[u8; 4]; 2] { function main () -> [[u8; 4]; 2] {
return [[1u8, 2u8, 3u8, 4u8], [5u8, 6u8, 7u8, 8u8]] return [[1u8, 2u8, 3u8, 4u8], [5u8, 6u8, 7u8, 8u8]];
} }

View File

@ -1,3 +1,3 @@
function main() -> bool { function main() -> bool {
return false return false;
} }

View File

@ -1,3 +1,3 @@
function main() -> u8 { function main() -> u8 {
return 1u8 return 1u8;
} }

View File

@ -3,7 +3,7 @@ function swap(a: [u32; 2], const i: u32, const j: u32) -> [u32; 2] {
const t = a[i]; const t = a[i];
a[i] = a[j]; a[i] = a[j];
a[j] = t; a[j] = t;
return a return a;
} }
function main() { function main() {

View File

@ -1,9 +1,9 @@
function main (x: bool) -> bool { function main (x: bool) -> bool {
if false { if false {
return x return x;
} else if x { } else if x {
return false return false;
} else { } else {
return false return false;
} }
} }

View File

@ -1,7 +1,7 @@
function main() -> u32 { function main() -> u32 {
if input.registers.a == 0u32 { if input.registers.a == 0u32 {
return 0u32 return 0u32;
} else { } else {
return 1u32 return 1u32;
} }
} }

View File

@ -1,3 +1,3 @@
function main() -> (bool, bool) { function main() -> (bool, bool) {
return true return true;
} }

View File

@ -1,3 +1,3 @@
function main() -> bool { function main() -> bool {
return a return a;
} }

View File

@ -1,5 +1,5 @@
function foo() -> (bool, bool) { function foo() -> (bool, bool) {
return (true, false) return (true, false);
} }
function main() { function main() {

View File

@ -1,5 +1,5 @@
function foo() -> (bool, bool) { function foo() -> (bool, bool) {
return (true, false) return (true, false);
} }
function main() { function main() {

View File

@ -1,5 +1,5 @@
function foo() -> (bool, bool) { function foo() -> (bool, bool) {
return (true, false) return (true, false);
} }
function main() { function main() {

View File

@ -1,5 +1,5 @@
// The 'hello-world' main function. // The 'hello-world' main function.
function main(a: u32, b: u32) -> u32 { function main(a: u32, b: u32) -> u32 {
const c: u32 = a + b; const c: u32 = a + b;
return c return c;
} }

View File

@ -3,7 +3,7 @@ circuit PedersenHash {
// Instantiates a Pedersen hash circuit // Instantiates a Pedersen hash circuit
function new(parameters: [group; 256]) -> Self { function new(parameters: [group; 256]) -> Self {
return Self { parameters: parameters } return Self { parameters: parameters };
} }
function hash(self, bits: [bool; 256]) -> group { function hash(self, bits: [bool; 256]) -> group {
@ -13,13 +13,13 @@ circuit PedersenHash {
digest += self.parameters[i]; digest += self.parameters[i];
} }
} }
return digest return digest;
} }
} }
// The 'pedersen-hash' main function. // The 'pedersen-hash' main function.
function main(hash_input: [bool; 256], const parameters: [group; 256]) -> group { function main(hash_input: [bool; 256], const parameters: [group; 256]) -> group {
const pedersen = PedersenHash::new(parameters); const pedersen = PedersenHash::new(parameters);
return pedersen.hash(hash_input) return pedersen.hash(hash_input);
} }

View File

@ -65,6 +65,6 @@ circuit SillySudoku {
} }
// Returns true if all numbers 1-9 have been seen exactly once. // Returns true if all numbers 1-9 have been seen exactly once.
return result return result;
} }
} }

View File

@ -16,7 +16,7 @@ function main(puzzle: [u8; (3, 3)], answer: [u8; (3, 3)]) -> bool {
console.log("The answer is {}.", result); console.log("The answer is {}.", result);
return result return result;
} }
// Tests that the `silly-sudoku` circuit outputs true on a correct answer. // Tests that the `silly-sudoku` circuit outputs true on a correct answer.

Some files were not shown because too many files have changed in this diff Show More