Update tests to (Foo) { ... } syntax.

This commit is contained in:
Christoffer Lerno
2025-02-18 18:53:30 +01:00
parent 168c11e006
commit cbacd64987
98 changed files with 449 additions and 551 deletions

View File

@@ -20,7 +20,7 @@ fn int test()
int foo2 = $foo[2];
var $foos = { "Hello!" };
char* str = $foos[0];
bool x = ! int[] { 1, 2, 3 };
bool x = ! (int[]) { 1, 2, 3 };
Bar b = {};
Baz z = {};
int[] sub = {};

View File

@@ -1,11 +1,11 @@
// #target: windows-x64
module test;
const int[?] X = int[?] { 1, 2, 3 };
int[?] y = int[?] { 1, 2, 3 };
const int[?] X = (int[?]) { 1, 2, 3 };
int[?] y = (int[?]) { 1, 2, 3 };
fn void main()
{
int x = $typeof(int[?] { 1, 2, 3}).len;
int x = $typeof((int[?]) { 1, 2, 3}).len;
int z = X.len;
int w = y.len;
}

View File

@@ -10,7 +10,7 @@ struct Bar (Foo)
fn int main() {
Test(<Foo>) a = {{}};
Test(<any>) b = {{}};
Test(<Foo>) a2 = {Bar{}}; // #error: It is not possible to cast
Test(<Foo>) a2 = {(Bar){}}; // #error: It is not possible to cast
return 0;
}

View File

@@ -6,6 +6,6 @@ macro test(foo)
fn void main()
{
test(int[] { 1, 2 });
test((int[]) { 1, 2 });
test({ 1, 2 }); // #error: It is only possible to use an untyped list as a
}

View File

@@ -17,14 +17,14 @@ struct Bar
Bar[] arrbar = { { 3, 4 }, { 8, 9 }};
int[] xd = { 1, 2 };
int* fofeo = &&(int[2]{ 3, 4 });
int* fofeo = &&((int[2]){ 3, 4 });
fn int main()
{
Bar w = arrbar[1];
libc::printf("%d\n", arrbar[1].x);
int[] x = { 1, 2, 3 };
int* y = &&(int[3]{ 123, 234, 567 });
int* y = &&((int[3]){ 123, 234, 567 });
io::printn("Start:");
libc::printf("X len: %d mid element %d\n", (int)(x.len), x[1]);
libc::printf("Y mid element %d\n", y[1]);
@@ -33,7 +33,7 @@ fn int main()
int[1] azz = {};
//var $foo = { 1, 2, 3 };
bool xy = ! int[] { 1, 2, 3 };
bool xy = !(int[]){ 1, 2, 3 };
if (!xy) io::printn("Ok");
Bar b = {};
Baz z = {};