mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 03:51:18 +00:00
Use correct sizes and alignments. Fix designated initializers and literals. Added todo
This commit is contained in:
@@ -2,16 +2,6 @@ module bar;
|
||||
|
||||
typedef int as Bob;
|
||||
|
||||
/* hello *//* there */
|
||||
/+ why /+ you /* lucky +/ +/
|
||||
// Whut
|
||||
// Here
|
||||
//
|
||||
//---
|
||||
/*
|
||||
Hello
|
||||
*/
|
||||
|
||||
struct Test
|
||||
{
|
||||
int a;
|
||||
@@ -38,32 +28,6 @@ struct Teob
|
||||
int oekfeo;
|
||||
}
|
||||
|
||||
typedef long as Frob;
|
||||
|
||||
enum EnumTestAlias : Frob
|
||||
{
|
||||
VALUE1 = 4,
|
||||
VALUE2
|
||||
}
|
||||
|
||||
enum EnumTestDefault
|
||||
{
|
||||
VALUE,
|
||||
VALUE2
|
||||
}
|
||||
|
||||
enum EnumTestNoOverflowAfterLong : long
|
||||
{
|
||||
VALUE = 0x7FFF_FFFF_FFFF_FFFE,
|
||||
VALUE_NO_EXCEED
|
||||
}
|
||||
|
||||
enum EnumTestSmall : ushort
|
||||
{
|
||||
VALUE = 0xFF,
|
||||
VALUE2 = 0xFFFF
|
||||
}
|
||||
|
||||
enum EnumWithData : ushort (int a, char[] x, long b = 4)
|
||||
{
|
||||
// Currently the args are ignored TODO!
|
||||
@@ -105,8 +69,8 @@ error Error
|
||||
{
|
||||
BLURB,
|
||||
NO_SUCH_FILE,
|
||||
|
||||
}
|
||||
|
||||
error OtherError
|
||||
{
|
||||
FOO_BAR
|
||||
@@ -128,6 +92,39 @@ enum Inf2 : byte
|
||||
|
||||
typedef Inf as BooInf;
|
||||
|
||||
struct TestStruct
|
||||
{
|
||||
int a;
|
||||
}
|
||||
|
||||
struct TestStruct2
|
||||
{
|
||||
TestStruct a;
|
||||
char xx;
|
||||
TestStruct b;
|
||||
int c;
|
||||
}
|
||||
|
||||
union TestUnion
|
||||
{
|
||||
int a;
|
||||
double f;
|
||||
}
|
||||
|
||||
|
||||
func TestStruct structTest(int i)
|
||||
{
|
||||
|
||||
TestUnion tu;
|
||||
/* TestStruct foo = { i };
|
||||
TestStruct foo2 = { a = i };*/
|
||||
TestStruct foo3 = TestStruct { i };
|
||||
return foo3;
|
||||
/* TestStruct2 bar = { c = 2 };
|
||||
int x = 3 * i;
|
||||
TestStruct2 bar2 = { b.a = x, a.a = x + 1 };
|
||||
return bar2;*/
|
||||
}
|
||||
func void enumInferenceTest()
|
||||
{
|
||||
OtherError e = OtherError.FOO_BAR;
|
||||
|
||||
13
resources/tests/comments_ok.c3
Normal file
13
resources/tests/comments_ok.c3
Normal file
@@ -0,0 +1,13 @@
|
||||
module comments;
|
||||
/* Span *//* style */
|
||||
|
||||
/+ Nested /+ Errors /* Inside +/ +/
|
||||
// Single line
|
||||
/*
|
||||
Multiline span style
|
||||
*/
|
||||
|
||||
func void test()
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -4,3 +4,28 @@ enum EnumTest : long
|
||||
VALUE2
|
||||
}
|
||||
|
||||
typedef long as Frob;
|
||||
|
||||
enum EnumTestAlias : Frob
|
||||
{
|
||||
VALUE1 = 4,
|
||||
VALUE2
|
||||
}
|
||||
|
||||
enum EnumTestDefault
|
||||
{
|
||||
VALUE,
|
||||
VALUE2
|
||||
}
|
||||
|
||||
enum EnumTestNoOverflowAfterLong : long
|
||||
{
|
||||
VALUE = 0x7FFF_FFFF_FFFF_FFFE,
|
||||
VALUE_NO_EXCEED
|
||||
}
|
||||
|
||||
enum EnumTestSmall : ushort
|
||||
{
|
||||
VALUE = 0xFF,
|
||||
VALUE2 = 0xFFFF
|
||||
}
|
||||
|
||||
12
resources/tests/error_decl_ok.c3
Normal file
12
resources/tests/error_decl_ok.c3
Normal file
@@ -0,0 +1,12 @@
|
||||
module errors;
|
||||
|
||||
error TheError
|
||||
{
|
||||
FOO_MISSING,
|
||||
NO_SUCH_FILE,
|
||||
}
|
||||
|
||||
error OtherError
|
||||
{
|
||||
BAR_OVERFLOWED
|
||||
}
|
||||
0
resources/tests/structs_ok.c3
Normal file
0
resources/tests/structs_ok.c3
Normal file
5
resources/tests/typedef_errors.c3
Normal file
5
resources/tests/typedef_errors.c3
Normal file
@@ -0,0 +1,5 @@
|
||||
module typedefs;
|
||||
|
||||
typedef Loop as Loop2;
|
||||
typedef Loop2 as Loop3;
|
||||
typedef Loop3 as Loop;
|
||||
14
resources/tests/typedefs_ok.c3
Normal file
14
resources/tests/typedefs_ok.c3
Normal file
@@ -0,0 +1,14 @@
|
||||
module typedefs;
|
||||
|
||||
// Standard case
|
||||
typedef int as Foo;
|
||||
|
||||
// Nested resolution
|
||||
typedef AType as BType;
|
||||
typedef int as AType;
|
||||
|
||||
enum Bar : BType
|
||||
{
|
||||
A,
|
||||
B
|
||||
}
|
||||
Reference in New Issue
Block a user