mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
New faults and syntax (#2034)
- Remove `[?]` syntax. - Change `int!` to `int?` syntax. - New `fault` declarations. - Enum associated values can reference the calling enum.
This commit is contained in:
committed by
GitHub
parent
fefce25081
commit
25bccf4883
@@ -3,7 +3,7 @@ module test;
|
||||
struct Abc
|
||||
{
|
||||
int x;
|
||||
int[?] y;
|
||||
int[*] y;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
struct Foo
|
||||
{
|
||||
int x;
|
||||
int[?] y; // #error: flexible array member must be the last element
|
||||
int[*] y; // #error: flexible array member must be the last element
|
||||
int z;
|
||||
}
|
||||
|
||||
struct Bar
|
||||
{
|
||||
int[?] y; // #error: flexible array member cannot be the only element
|
||||
int[*] y; // #error: flexible array member cannot be the only element
|
||||
}
|
||||
|
||||
struct Baz
|
||||
{
|
||||
int y;
|
||||
int[?] z;
|
||||
int[*] z;
|
||||
}
|
||||
|
||||
struct BazContainerOk
|
||||
|
||||
@@ -6,11 +6,11 @@ struct Abc
|
||||
struct Foo
|
||||
{
|
||||
int a;
|
||||
int[?] x;
|
||||
int[*] x;
|
||||
}
|
||||
|
||||
struct Foo2
|
||||
{
|
||||
int a;
|
||||
int[?] x, y; // #error: must be the last element
|
||||
int[*] x, y; // #error: must be the last element
|
||||
}
|
||||
|
||||
@@ -38,12 +38,12 @@ fn void main()
|
||||
%Matrix2x2_b = type { %.anon.1 }
|
||||
%.anon.1 = type { [4 x float] }
|
||||
|
||||
@"$ct.foo.$anon" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 16, i64 0, i64 4, [0 x i64] zeroinitializer }, align 8
|
||||
@"$ct.foo.$anon.3" = linkonce global %.introspect { i8 11, i64 0, ptr null, i64 16, i64 0, i64 2, [0 x i64] zeroinitializer }, align 8
|
||||
@"$ct.foo.Matrix2x2" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 16, i64 0, i64 1, [0 x i64] zeroinitializer }, align 8
|
||||
@"$ct.foo.$anon.6" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 16, i64 0, i64 4, [0 x i64] zeroinitializer }, align 8
|
||||
@"$ct.foo.$anon.7" = linkonce global %.introspect { i8 11, i64 0, ptr null, i64 16, i64 0, i64 2, [0 x i64] zeroinitializer }, align 8
|
||||
@"$ct.foo.Matrix2x2_b" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 16, i64 0, i64 1, [0 x i64] zeroinitializer }, align 8
|
||||
@"$ct.foo.$anon" = linkonce global %.introspect { i8 9, i64 0, ptr null, i64 16, i64 0, i64 4, [0 x i64] zeroinitializer }, align 8
|
||||
@"$ct.foo.$anon.3" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 16, i64 0, i64 2, [0 x i64] zeroinitializer }, align 8
|
||||
@"$ct.foo.Matrix2x2" = linkonce global %.introspect { i8 9, i64 0, ptr null, i64 16, i64 0, i64 1, [0 x i64] zeroinitializer }, align 8
|
||||
@"$ct.foo.$anon.6" = linkonce global %.introspect { i8 9, i64 0, ptr null, i64 16, i64 0, i64 4, [0 x i64] zeroinitializer }, align 8
|
||||
@"$ct.foo.$anon.7" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 16, i64 0, i64 2, [0 x i64] zeroinitializer }, align 8
|
||||
@"$ct.foo.Matrix2x2_b" = linkonce global %.introspect { i8 9, i64 0, ptr null, i64 16, i64 0, i64 1, [0 x i64] zeroinitializer }, align 8
|
||||
@.__const = private unnamed_addr constant %Matrix2x2 { %.anon { %.anon.0 { float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00 } } }, align 4
|
||||
@.__const.8 = private unnamed_addr constant %Matrix2x2_b { %.anon.1 { [4 x float] [float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00] } }, align 4
|
||||
@.str = private unnamed_addr constant [13 x i8] c"%f %f %f %f\0A\00", align 1
|
||||
|
||||
@@ -16,7 +16,7 @@ fn Event test(int x)
|
||||
/* #expect: test.ll
|
||||
%Event = type { i32 }
|
||||
|
||||
@"$ct.test.Event" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 4, i64 0, i64 1, [0 x i64] zeroinitializer }, align 8
|
||||
@"$ct.test.Event" = linkonce global %.introspect { i8 9, i64 0, ptr null, i64 4, i64 0, i64 1, [0 x i64] zeroinitializer }, align 8
|
||||
@.__const = private unnamed_addr constant %Event { i32 1 }, align 4
|
||||
@.__const.1 = private unnamed_addr constant %Event { i32 2 }, align 4
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ fn void test1()
|
||||
|
||||
%Point = type { i32, i32 }
|
||||
|
||||
@"$ct.test.Point" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 8, i64 0, i64 2, [0 x i64] zeroinitializer }, align 8
|
||||
@"$ct.test.Point" = linkonce global %.introspect { i8 9, i64 0, ptr null, i64 8, i64 0, i64 2, [0 x i64] zeroinitializer }, align 8
|
||||
@.__const = private unnamed_addr constant %Point { i32 5, i32 6 }, align 4
|
||||
|
||||
define void @test.test1() #0 {
|
||||
|
||||
@@ -8,7 +8,7 @@ struct Bar
|
||||
int y;
|
||||
}
|
||||
int ufe;
|
||||
int[?] z;
|
||||
int[*] z;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ Foo foo8 @private = FOO7;
|
||||
|
||||
/* #expect: structo.ll
|
||||
|
||||
@"$ct.structo.Foo" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 16, i64 0, i64 2, [0 x i64] zeroinitializer }, align 8
|
||||
@"$ct.structo.Foo" = linkonce global %.introspect { i8 9, i64 0, ptr null, i64 16, i64 0, i64 2, [0 x i64] zeroinitializer }, align 8
|
||||
@structo.x = internal unnamed_addr global i64 16, align 8
|
||||
@structo.foo1 = internal unnamed_addr global %Foo { i32 1, i64 2 }, align 8
|
||||
@structo.foo2 = internal unnamed_addr global %Foo { i32 2, i64 0 }, align 8
|
||||
|
||||
Reference in New Issue
Block a user