diff --git a/lib/std/threads/os/thread_win32.c3 b/lib/std/threads/os/thread_win32.c3 index 60e8f45c7..da6cc446a 100644 --- a/lib/std/threads/os/thread_win32.c3 +++ b/lib/std/threads/os/thread_win32.c3 @@ -2,7 +2,7 @@ module std::thread::os; $if thread::THREAD_MODEL == ThreadModel.WIN32: -typedef NativeThread = Win32_HANDLE; +def NativeThread = Win32_HANDLE; struct NativeMutex { diff --git a/lib/std/time/os/time_darwin.c3 b/lib/std/time/os/time_darwin.c3 index 5ce08731a..d5e03b866 100644 --- a/lib/std/time/os/time_darwin.c3 +++ b/lib/std/time/os/time_darwin.c3 @@ -8,8 +8,8 @@ struct Darwin_mach_timebase_info uint denom; } -typedef Darwin_mach_timebase_info_t = Darwin_mach_timebase_info; -typedef Darwin_mach_timebase_info_data_t = Darwin_mach_timebase_info; +def Darwin_mach_timebase_info_t = Darwin_mach_timebase_info; +def Darwin_mach_timebase_info_data_t = Darwin_mach_timebase_info; extern fn void mach_timebase_info(Darwin_mach_timebase_info_data_t* timebase); extern fn ulong mach_absolute_time(); diff --git a/lib/std/time/time.c3 b/lib/std/time/time.c3 index bb8683181..76c671113 100644 --- a/lib/std/time/time.c3 +++ b/lib/std/time/time.c3 @@ -1,9 +1,9 @@ module std::time; -typedef Time @inline = distinct long; -typedef TimeDuration @inline = distinct long; -typedef Clock @inline = distinct ulong; -typedef NanoDuration @inline = distinct long; +def Time @inline = distinct long; +def TimeDuration @inline = distinct long; +def Clock @inline = distinct ulong; +def NanoDuration @inline = distinct long; const TimeDuration MICROSECONDS_PER_SECOND = 1_000_000; const TimeDuration MICROSECONDS_PER_MINUTE = MICROSECONDS_PER_SECOND * 60; diff --git a/resources/grammar/c3.l b/resources/grammar/c3.l index bb7c0dddd..69fc432d2 100644 --- a/resources/grammar/c3.l +++ b/resources/grammar/c3.l @@ -95,9 +95,9 @@ int comment_level = 0; "char" { count(); return(CHAR); } "const" { count(); return(CONST); } "continue" { count(); return(CONTINUE); } +"def" { count(); return(DEF); } "default" { count(); return(DEFAULT); } "defer" { count(); return(DEFER); } -"define" { count(); return(DEFINE); } "distinct" { count(); return(DISTINCT); } "do" { count(); return(DO); } "double" { count(); return(DOUBLE); } @@ -137,7 +137,6 @@ int comment_level = 0; "tlocal" { count(); return(TLOCAL); } "true" { count(); return(TRUE); } "try" { count(); return(TRY); } -"typedef" { count(); return(TYPEDEF); } "typeid" { count(); return(TYPEID); } "uint" { count(); return(UINT); } "uint128" { count(); return(UINT128); } diff --git a/resources/grammar/grammar.y b/resources/grammar/grammar.y index dd711d440..2444571b5 100644 --- a/resources/grammar/grammar.y +++ b/resources/grammar/grammar.y @@ -17,7 +17,7 @@ void yyerror(char *s); %token AND_OP OR_OP MUL_ASSIGN DIV_ASSIGN MOD_ASSIGN ADD_ASSIGN %token SUB_ASSIGN SHL_ASSIGN SHR_ASSIGN AND_ASSIGN %token XOR_ASSIGN OR_ASSIGN VAR NUL ELVIS NEXTCASE ANYFAULT -%token TYPEDEF MODULE IMPORT DEFINE EXTERN +%token MODULE IMPORT DEF EXTERN %token CHAR SHORT INT LONG FLOAT DOUBLE CONST VOID USZ ISZ UPTR IPTR ANY %token ICHAR USHORT UINT ULONG BOOL INT128 UINT128 FLOAT16 FLOAT128 BFLOAT16 %token TYPEID BITSTRUCT STATIC BANGBANG AT_CONST_IDENT HASH_TYPE_IDENT @@ -1110,9 +1110,6 @@ typedef_type | type opt_generic_parameters ; -typedef_declaration - : TYPEDEF TYPE_IDENT opt_attributes '=' opt_distinct_inline typedef_type ';' - ; multi_declaration @@ -1166,8 +1163,9 @@ define_ident ; define_declaration - : DEFINE define_ident ';' - | DEFINE define_attribute ';' + : DEF define_ident ';' + | DEF define_attribute ';' + | DEF TYPE_IDENT opt_attributes '=' opt_distinct_inline typedef_type ';' ; tl_ct_if @@ -1233,7 +1231,6 @@ top_level | fault_declaration | enum_declaration | macro_declaration - | typedef_declaration | define_declaration | static_declaration | bitstruct_declaration diff --git a/resources/testfragments/parsertest.c3 b/resources/testfragments/parsertest.c3 index 09051872f..094e26158 100644 --- a/resources/testfragments/parsertest.c3 +++ b/resources/testfragments/parsertest.c3 @@ -231,8 +231,8 @@ fn void hello() throws Errors return; } -typedef Foo* as Bar; -typedef fn void(int, Foo*) as Zoo; +def Foo* as Bar; +def fn void(int, Foo*) as Zoo; diff --git a/resources/testfragments/sdl_video.c3 b/resources/testfragments/sdl_video.c3 index b29103aab..84b5717eb 100644 --- a/resources/testfragments/sdl_video.c3 +++ b/resources/testfragments/sdl_video.c3 @@ -103,7 +103,7 @@ const uint SDL_WINDOWPOS_UNDEFINED = UndefinedDisplay(x); #define SDL_WINDOWPOS_ISCENTERED(X) \ (((X)&0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK) -typedef enum +def enum { SDL_ORIENTATION_UNKNOWN, /**< The display orientation can't be determined */ SDL_ORIENTATION_LANDSCAPE, /**< The display is in landscape mode, with the right side up, relative to portrait mode */ @@ -115,7 +115,7 @@ typedef enum /** * \brief An opaque handle to an OpenGL context. */ -typedef void *SDL_GLContext; +def void *SDL_GLContext; enum GLAttr @@ -149,14 +149,14 @@ enum GLAttr GL_CONTEXT_NO_ERROR } -typedef enum +def enum { SDL_GL_CONTEXT_PROFILE_CORE = 0x0001, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = 0x0002, SDL_GL_CONTEXT_PROFILE_ES = 0x0004 /**< GLX_CONTEXT_ES2_PROFILE_BIT_EXT */ } SDL_GLprofile; -typedef enum +def enum { SDL_GL_CONTEXT_DEBUG_FLAG = 0x0001, SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 0x0002, @@ -164,13 +164,13 @@ typedef enum SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = 0x0008 } SDL_GLcontextFlag; -typedef enum +def enum { SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE = 0x0000, SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 0x0001 } SDL_GLcontextReleaseFlag; -typedef enum +def enum { SDL_GL_CONTEXT_RESET_NO_NOTIFICATION = 0x0000, SDL_GL_CONTEXT_RESET_LOSE_CONTEXT = 0x0001 @@ -810,7 +810,7 @@ extern DECLSPEC int SDLCALL SDL_GetWindowGammaRamp(SDL_Window * window, * * \sa SDL_HitTest */ -typedef enum +def enum { SDL_HITTEST_NORMAL, /**< Region is normal. No special properties. */ SDL_HITTEST_DRAGGABLE, /**< Region can drag entire window. */ @@ -829,7 +829,7 @@ typedef enum * * \sa SDL_SetWindowHitTest */ -typedef SDL_HitTestResult (SDLCALL *SDL_HitTest)(SDL_Window *win, +def SDL_HitTestResult (SDLCALL *SDL_HitTest)(SDL_Window *win, const SDL_Point *area, void *data); diff --git a/src/compiler/parse_global.c b/src/compiler/parse_global.c index 555c2c91f..a91984696 100644 --- a/src/compiler/parse_global.c +++ b/src/compiler/parse_global.c @@ -1745,7 +1745,11 @@ static inline void decl_add_type(Decl *decl, TypeKind kind) */ static inline Decl *parse_typedef_declaration(ParseContext *c) { - if (!try_consume(c, TOKEN_DEF)) advance_and_verify(c, TOKEN_TYPEDEF); + if (!try_consume(c, TOKEN_DEF)) + { + sema_warning_at(c->span, "The use of 'typedef' is deprecated, please use 'def'."); + advance_and_verify(c, TOKEN_TYPEDEF); + } Decl *decl = decl_new(DECL_POISONED, symstr(c), c->span); DEBUG_LOG("Parse typedef %s", decl->name); @@ -1849,20 +1853,28 @@ static inline Decl *parse_typedef_declaration(ParseContext *c) static inline Decl *parse_define_ident(ParseContext *c) { // 1. Store the beginning of the "define". - if (!try_consume(c, TOKEN_DEF)) advance_and_verify(c, TOKEN_DEFINE); + if (!try_consume(c, TOKEN_DEF)) + { + sema_warning_at(c->span, "The use of 'define' is deprecated, please use 'def'."); + advance_and_verify(c, TOKEN_DEFINE); + } // 2. At this point we expect an ident or a const token. // since the Type is handled. TokenType alias_type = c->tok; if (alias_type != TOKEN_IDENT && alias_type != TOKEN_CONST_IDENT && alias_type != TOKEN_AT_IDENT) { - if (alias_type == TOKEN_TYPE_IDENT) + if (token_is_keyword_ident(alias_type) && alias_type != TOKEN_FN) + { + SEMA_ERROR_HERE("'%s' is a reserved keyword, try another name.", token_type_to_string(alias_type)); + } + else if (alias_type == TOKEN_TYPE_IDENT) { SEMA_ERROR_HERE("A variable, constant or attribute name was expected here. If you want to define a new type, use 'typedef' instead."); } else { - SEMA_ERROR_HERE("A variable, constant or attribute name was expected here."); + SEMA_ERROR_HERE("A type, variable, constant or attribute name was expected here."); } return poisoned_decl; } diff --git a/src/version.h b/src/version.h index 85d6fb96c..dae9cfa8a 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define COMPILER_VERSION "0.4.519" \ No newline at end of file +#define COMPILER_VERSION "0.4.520" \ No newline at end of file diff --git a/test/test_suite/abi/aarch64_hfa_args.c3t b/test/test_suite/abi/aarch64_hfa_args.c3t index a1a0d4700..cc9311c92 100644 --- a/test/test_suite/abi/aarch64_hfa_args.c3t +++ b/test/test_suite/abi/aarch64_hfa_args.c3t @@ -1,7 +1,7 @@ // #target: macos-aarch64 module test; -typedef Int8x16 = ichar[<16>]; -typedef Float32x3 = float[<3>]; +def Int8x16 = ichar[<16>]; +def Float32x3 = float[<3>]; struct HFAv3 { diff --git a/test/test_suite/abi/darwin64_avx.c3t b/test/test_suite/abi/darwin64_avx.c3t index ca0455e76..f1c96b818 100644 --- a/test/test_suite/abi/darwin64_avx.c3t +++ b/test/test_suite/abi/darwin64_avx.c3t @@ -2,7 +2,7 @@ // #opt: --x86cpu=avx1 module test; -typedef Mm256 = float[<8>]; +def Mm256 = float[<8>]; struct St256 { Mm256 m; } @@ -19,7 +19,7 @@ fn void f39() { f38(x38); f37(x37); } // CHECK: declare void @func40(%struct.t128* byval(%struct.t128) align 16) -typedef Mm128 = float[<4>]; +def Mm128 = float[<4>]; struct Two128 { Mm128 m; Mm128 n; @@ -44,7 +44,7 @@ fn void func43(Sa s) { } -typedef Vec46 = float[<2>]; +def Vec46 = float[<2>]; extern fn void f46(Vec46,Vec46,Vec46,Vec46,Vec46,Vec46,Vec46,Vec46,Vec46,Vec46); fn void test46() { Vec46 x = {1,2}; f46(x,x,x,x,x,x,x,x,x,x); } @@ -69,7 +69,7 @@ fn void test54() { test54_helper(x54, x54, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, Complex { 0, 1.0 }); } -typedef Mm512 = float[<16>]; +def Mm512 = float[<16>]; struct St512 { Mm512 m; } diff --git a/test/test_suite/abi/darwin64_avx512.c3t b/test/test_suite/abi/darwin64_avx512.c3t index 43f4e584e..7d818314f 100644 --- a/test/test_suite/abi/darwin64_avx512.c3t +++ b/test/test_suite/abi/darwin64_avx512.c3t @@ -2,8 +2,8 @@ // #opt: --x86cpu=avx512 module test; -typedef Mm256 = float[<8>]; -typedef Mm512 = float[<16>]; +def Mm256 = float[<8>]; +def Mm512 = float[<16>]; struct St512 { Mm512 m; } diff --git a/test/test_suite/abi/darwin64_sse.c3t b/test/test_suite/abi/darwin64_sse.c3t index 7f491de08..67d9f7b43 100644 --- a/test/test_suite/abi/darwin64_sse.c3t +++ b/test/test_suite/abi/darwin64_sse.c3t @@ -2,7 +2,7 @@ // #opt: --x86cpu=sse4 module test; -typedef Mm256 = float[<8>]; +def Mm256 = float[<8>]; struct St256 { Mm256 m; } @@ -19,7 +19,7 @@ fn void f39() { f38(x38); f37(x37); } // CHECK: declare void @func40(%struct.t128* byval(%struct.t128) align 16) -typedef Mm128 = float[<4>]; +def Mm128 = float[<4>]; struct Two128 { Mm128 m; Mm128 n; diff --git a/test/test_suite/abi/darwinx64_2.c3t b/test/test_suite/abi/darwinx64_2.c3t index 6aefa91f7..fa5e3bd13 100644 --- a/test/test_suite/abi/darwinx64_2.c3t +++ b/test/test_suite/abi/darwinx64_2.c3t @@ -86,7 +86,7 @@ fn V4f32wrapper f27(V4f32wrapper x) { // PR22563 - We should unwrap simple structs and arrays to pass // and return them in the appropriate vector registers if possible. -typedef V8f32 = float[<8>]; +def V8f32 = float[<8>]; struct V8f32wrapper { V8f32 v; } @@ -133,15 +133,15 @@ fn float f31(F31foo x) { return x.c; } -typedef V1i64 = ulong[<1>]; +def V1i64 = ulong[<1>]; fn V1i64 f34(V1i64 arg) { return arg; } -typedef V1i64_2 = uint[<2>]; +def V1i64_2 = uint[<2>]; fn V1i64_2 f35(V1i64_2 arg) { return arg+arg; } -typedef V2i32 = float[<2>]; +def V2i32 = float[<2>]; fn V2i32 f36(V2i32 arg) { return arg; } diff --git a/test/test_suite/abi/riscv64-lp64-abi.c3t b/test/test_suite/abi/riscv64-lp64-abi.c3t index cdad24cd4..21578c008 100644 --- a/test/test_suite/abi/riscv64-lp64-abi.c3t +++ b/test/test_suite/abi/riscv64-lp64-abi.c3t @@ -5,7 +5,7 @@ struct Large { long a, b, c, d; } -typedef V32i8 = char[<32>]; +def V32i8 = char[<32>]; fn int f_scalar_stack_1(int a, int128 b, float c, float128 d, V32i8 e, char f, char g, char h) { diff --git a/test/test_suite/attributes/attr_not_imported.c3 b/test/test_suite/attributes/attr_not_imported.c3 index 4e0ff3a4c..d8aba13d9 100644 --- a/test/test_suite/attributes/attr_not_imported.c3 +++ b/test/test_suite/attributes/attr_not_imported.c3 @@ -1,6 +1,6 @@ module abc; -define @Foo = { @inline }; +def @Foo = { @inline }; module bar; diff --git a/test/test_suite/attributes/attribute_visibility.c3t b/test/test_suite/attributes/attribute_visibility.c3t index 227f045ae..14e9ee109 100644 --- a/test/test_suite/attributes/attribute_visibility.c3t +++ b/test/test_suite/attributes/attribute_visibility.c3t @@ -1,7 +1,7 @@ // #target: macos-x64 module test; const int FOO @private = 4; -define @Align(x) = { @align(x * FOO) }; +def @Align(x) = { @align(x * FOO) }; module test2; import test; diff --git a/test/test_suite/attributes/user_defined_attributes.c3t b/test/test_suite/attributes/user_defined_attributes.c3t index 2e88b5c2b..8847102cb 100644 --- a/test/test_suite/attributes/user_defined_attributes.c3t +++ b/test/test_suite/attributes/user_defined_attributes.c3t @@ -2,12 +2,12 @@ module test; -define @Foo = { @noreturn @weak }; +def @Foo = { @noreturn @weak }; -define @Align(y) = { @align(y) }; -define @Align16(x) @private = { @Align(8 * x) @align(1024) }; -define @Test = { @noinline }; -define @TestZero = { }; +def @Align(y) = { @align(y) }; +def @Align16(x) @private = { @Align(8 * x) @align(1024) }; +def @Test = { @noinline }; +def @TestZero = { }; struct Foo { int z; diff --git a/test/test_suite/bitstruct/invalid_bitstruct_member_types.c3 b/test/test_suite/bitstruct/invalid_bitstruct_member_types.c3 index e45249df5..0f218df19 100644 --- a/test/test_suite/bitstruct/invalid_bitstruct_member_types.c3 +++ b/test/test_suite/bitstruct/invalid_bitstruct_member_types.c3 @@ -5,8 +5,8 @@ bitstruct Test : int float a : 1..3; // #error: 'float' is not supported in a bitstruct, only enums, integer and boolean values may be used. } -typedef Baz = distinct float; -typedef Foo = distinct bool; +def Baz = distinct float; +def Foo = distinct bool; enum Boo { BAR diff --git a/test/test_suite/compile_time/ct_switch_type_errors.c3 b/test/test_suite/compile_time/ct_switch_type_errors.c3 index 7b290c741..82e98fbdd 100644 --- a/test/test_suite/compile_time/ct_switch_type_errors.c3 +++ b/test/test_suite/compile_time/ct_switch_type_errors.c3 @@ -22,8 +22,8 @@ fn void test1() $endswitch } -typedef Foo = int; -typedef Bar = double; +def Foo = int; +def Bar = double; fn void test2() { $switch (int.typeid) diff --git a/test/test_suite/define/common.c3 b/test/test_suite/define/common.c3 index e91a52091..f04a6d4c6 100644 --- a/test/test_suite/define/common.c3 +++ b/test/test_suite/define/common.c3 @@ -1,13 +1,13 @@ module foo; -// define = +// def = def standard_foo = __stdin; def someFunctionIntBool = someFunction; def FooInt = Foo; def A_CONST_INT = A_CONST; def standard_foo = ofke; // #error: Expected '=' -def fn foo = fef; // #error: A variable, constant or attribute name was expected here. +def fn foo = fef; // #error: A type, variable, constant or attribute name was expected here def feokfe = fn void(int); // #error: Expected a function or variable name here def AOFKE = ofek; // #error: Expected a constant name here def okfoe = OFKEOK; // #error: Expected a function or variable name here diff --git a/test/test_suite/define/define_name_errors.c3 b/test/test_suite/define/define_name_errors.c3 index d41693ac5..70e4b5292 100644 --- a/test/test_suite/define/define_name_errors.c3 +++ b/test/test_suite/define/define_name_errors.c3 @@ -1,9 +1,9 @@ -typedef int = int; // #error: 'int' is the name of a built-in type and can't be used as an alias. +def int = int; // #error: 'int' is a reserved keyword, try another name def main = foo; // #error: 'main' is reserved and cannot be used as an alias. -typedef hello = int; // #error: uppercase letter -typedef hello = Foo; // #error: uppercase letter +def hello = int; // #error: uppercase letter +def hello = Foo; // #error: uppercase letter -typedef HELLO = int; // #error: uppercase letter -typedef HELLO = Foo; // #error: uppercase letter \ No newline at end of file +def HELLO = int; // #error: uppercase letter +def HELLO = Foo; // #error: uppercase letter \ No newline at end of file diff --git a/test/test_suite/define/forbidden_defines.c3 b/test/test_suite/define/forbidden_defines.c3 index 924c51beb..6e475b5dd 100644 --- a/test/test_suite/define/forbidden_defines.c3 +++ b/test/test_suite/define/forbidden_defines.c3 @@ -1,3 +1,3 @@ -typedef Abc = int[*]; // #error: Inferred array types can only -typedef Bcd = anyfault; // #error: 'anyfault' may not be aliased. -typedef Efd = any; // #error: 'any' may not be aliased. +def Abc = int[*]; // #error: Inferred array types can only +def Bcd = anyfault; // #error: 'anyfault' may not be aliased. +def Efd = any; // #error: 'any' may not be aliased. diff --git a/test/test_suite/distinct/distinct_invalid.c3 b/test/test_suite/distinct/distinct_invalid.c3 index 9540a4e8c..03a1d3401 100644 --- a/test/test_suite/distinct/distinct_invalid.c3 +++ b/test/test_suite/distinct/distinct_invalid.c3 @@ -3,8 +3,8 @@ fault Error ABC } -typedef Foo1 = distinct Error; // #error: You cannot create a distinct type +def Foo1 = distinct Error; // #error: You cannot create a distinct type -typedef Foo3 = distinct void; // #error: create a distinct type from 'void' +def Foo3 = distinct void; // #error: create a distinct type from 'void' -typedef Foo4 = distinct typeid; // #error: create a distinct type from 'typeid' +def Foo4 = distinct typeid; // #error: create a distinct type from 'typeid' diff --git a/test/test_suite/distinct/distinct_slicing.c3 b/test/test_suite/distinct/distinct_slicing.c3 index a69fa382e..263c6b22f 100644 --- a/test/test_suite/distinct/distinct_slicing.c3 +++ b/test/test_suite/distinct/distinct_slicing.c3 @@ -1,4 +1,4 @@ -typedef Foo = distinct double[]; +def Foo = distinct double[]; fn void main() { diff --git a/test/test_suite/distinct/distinct_struct.c3 b/test/test_suite/distinct/distinct_struct.c3 index e05b40f94..b5b1f447d 100644 --- a/test/test_suite/distinct/distinct_struct.c3 +++ b/test/test_suite/distinct/distinct_struct.c3 @@ -5,7 +5,7 @@ struct Struct double y; } -typedef Foo = distinct Struct; +def Foo = distinct Struct; struct Struct2 { diff --git a/test/test_suite/distinct/distinct_struct_array.c3 b/test/test_suite/distinct/distinct_struct_array.c3 index 912face8f..605fa3f1f 100644 --- a/test/test_suite/distinct/distinct_struct_array.c3 +++ b/test/test_suite/distinct/distinct_struct_array.c3 @@ -1,6 +1,6 @@ module test; -typedef Foo = distinct int; +def Foo = distinct int; struct Struct { @@ -8,8 +8,8 @@ struct Struct int y; } -typedef Struct2 = distinct Struct; -typedef StructArr = distinct Struct2[3]; +def Struct2 = distinct Struct; +def StructArr = distinct Struct2[3]; fn void test(int x) { diff --git a/test/test_suite/distinct/distinct_union.c3 b/test/test_suite/distinct/distinct_union.c3 index d3908cf93..56db83e4f 100644 --- a/test/test_suite/distinct/distinct_union.c3 +++ b/test/test_suite/distinct/distinct_union.c3 @@ -6,7 +6,7 @@ union Union double y; } -typedef Foo = distinct Union; +def Foo = distinct Union; union Union2 { @@ -19,9 +19,9 @@ union Union2 } Foo f = { .x = 1 }; -typedef Union3 = distinct Union2; +def Union3 = distinct Union2; -typedef UnionArr = distinct Union3[3]; +def UnionArr = distinct Union3[3]; fn void test(int x) { diff --git a/test/test_suite/distinct/test_errors.c3 b/test/test_suite/distinct/test_errors.c3 index abced5862..e640cdcbf 100644 --- a/test/test_suite/distinct/test_errors.c3 +++ b/test/test_suite/distinct/test_errors.c3 @@ -1,6 +1,6 @@ module test; -typedef Int2 = distinct int; +def Int2 = distinct int; fn void test() { diff --git a/test/test_suite/distinct/test_ops_on_int.c3 b/test/test_suite/distinct/test_ops_on_int.c3 index e4f176290..69347c3c7 100644 --- a/test/test_suite/distinct/test_ops_on_int.c3 +++ b/test/test_suite/distinct/test_ops_on_int.c3 @@ -1,6 +1,6 @@ module test; -typedef Foo = distinct int; +def Foo = distinct int; fn int test1() { diff --git a/test/test_suite/distinct/test_ops_on_struct.c3 b/test/test_suite/distinct/test_ops_on_struct.c3 index 81f5c1751..23fe19ca8 100644 --- a/test/test_suite/distinct/test_ops_on_struct.c3 +++ b/test/test_suite/distinct/test_ops_on_struct.c3 @@ -6,7 +6,7 @@ struct Struct double y; } -typedef Foo = distinct Struct; +def Foo = distinct Struct; struct Struct2 { diff --git a/test/test_suite/expressions/addr_of_fails.c3 b/test/test_suite/expressions/addr_of_fails.c3 index 8cdb55fbc..45603e0e6 100644 --- a/test/test_suite/expressions/addr_of_fails.c3 +++ b/test/test_suite/expressions/addr_of_fails.c3 @@ -60,8 +60,8 @@ fn void test6() int[]* e = &arr[1..2]; // #error: To take the address of a temporary value, use '&&' instead of '&' } -typedef Baz = Foo; -typedef Bar = distinct int; +def Baz = Foo; +def Bar = distinct int; fault Err { FOO } union Un { int x; } enum MyEnum { BAR } diff --git a/test/test_suite/expressions/assignability.c3 b/test/test_suite/expressions/assignability.c3 index 0d6d2910d..8cbc5bde7 100644 --- a/test/test_suite/expressions/assignability.c3 +++ b/test/test_suite/expressions/assignability.c3 @@ -1,4 +1,4 @@ -typedef Number = int; +def Number = int; fn void test1() { diff --git a/test/test_suite/expressions/casts/cast_enum_const_to_distinct.c3 b/test/test_suite/expressions/casts/cast_enum_const_to_distinct.c3 index 195bb263c..dca990bf2 100644 --- a/test/test_suite/expressions/casts/cast_enum_const_to_distinct.c3 +++ b/test/test_suite/expressions/casts/cast_enum_const_to_distinct.c3 @@ -2,7 +2,7 @@ enum Foo { ABC } -typedef Abc = distinct int; +def Abc = distinct int; fn void main() { Abc d = Foo.ABC; // #error: Implicitly casting diff --git a/test/test_suite/expressions/casts/cast_enum_to_various.c3 b/test/test_suite/expressions/casts/cast_enum_to_various.c3 index 8a3380169..f8f537b13 100644 --- a/test/test_suite/expressions/casts/cast_enum_to_various.c3 +++ b/test/test_suite/expressions/casts/cast_enum_to_various.c3 @@ -13,7 +13,7 @@ enum EnumB : char C, D } -typedef Func = fn void(Enum); +def Func = fn void(Enum); fn void test1(Enum e) { diff --git a/test/test_suite/expressions/casts/cast_func_to_various.c3 b/test/test_suite/expressions/casts/cast_func_to_various.c3 index d9a29a694..b3c3536d6 100644 --- a/test/test_suite/expressions/casts/cast_func_to_various.c3 +++ b/test/test_suite/expressions/casts/cast_func_to_various.c3 @@ -8,9 +8,9 @@ enum Enum : uptr A, B } -typedef Func = fn void(int); -typedef FuncOther = fn bool(char*); -typedef FuncSame = fn void(int); +def Func = fn void(int); +def FuncOther = fn bool(char*); +def FuncSame = fn void(int); fn void test1(Func arg) diff --git a/test/test_suite/expressions/casts/cast_unknown.c3 b/test/test_suite/expressions/casts/cast_unknown.c3 index a181fa558..17ca4995b 100644 --- a/test/test_suite/expressions/casts/cast_unknown.c3 +++ b/test/test_suite/expressions/casts/cast_unknown.c3 @@ -1,4 +1,4 @@ -typedef Number = int; +def Number = int; fn void test1() { diff --git a/test/test_suite/expressions/casts/explicit_cast.c3 b/test/test_suite/expressions/casts/explicit_cast.c3 index 93c2a17e3..3b1abb0db 100644 --- a/test/test_suite/expressions/casts/explicit_cast.c3 +++ b/test/test_suite/expressions/casts/explicit_cast.c3 @@ -1,6 +1,6 @@ -typedef Number8 = char; -typedef Number32 = int; -typedef DNumber32 = distinct int; +def Number8 = char; +def Number32 = int; +def DNumber32 = distinct int; fn void test1() { int a = (ichar)(10); diff --git a/test/test_suite/expressions/casts/failed_distinct_float_conversions.c3 b/test/test_suite/expressions/casts/failed_distinct_float_conversions.c3 index 63e5623a7..af536b51f 100644 --- a/test/test_suite/expressions/casts/failed_distinct_float_conversions.c3 +++ b/test/test_suite/expressions/casts/failed_distinct_float_conversions.c3 @@ -1,5 +1,5 @@ -typedef Foo = distinct double; -typedef Bar = distinct void*; +def Foo = distinct double; +def Bar = distinct void*; fn int main() { float f = 1; diff --git a/test/test_suite/expressions/casts/struct_cast_and_distinct.c3 b/test/test_suite/expressions/casts/struct_cast_and_distinct.c3 index 45441af99..bf48d9c2d 100644 --- a/test/test_suite/expressions/casts/struct_cast_and_distinct.c3 +++ b/test/test_suite/expressions/casts/struct_cast_and_distinct.c3 @@ -1,6 +1,6 @@ module test; -typedef Foo = distinct int; +def Foo = distinct int; fn void test1() { diff --git a/test/test_suite/from_docs/examples_struct.c3 b/test/test_suite/from_docs/examples_struct.c3 index 2cb28de7d..7b4e2c62f 100644 --- a/test/test_suite/from_docs/examples_struct.c3 +++ b/test/test_suite/from_docs/examples_struct.c3 @@ -1,4 +1,4 @@ -typedef Callback = fn int(char c); +def Callback = fn int(char c); struct Person { int i; } struct Company { int j; } enum Status : int diff --git a/test/test_suite/functions/test_regression.c3t b/test/test_suite/functions/test_regression.c3t index 81a53cdc9..60612b30c 100644 --- a/test/test_suite/functions/test_regression.c3t +++ b/test/test_suite/functions/test_regression.c3t @@ -65,8 +65,8 @@ fn int Foo2.mutate(Foo2 *foo) return ++foo.x; } -define oopsInt = test2::argh; -define oopsDouble = test2::argh; +def oopsInt = test2::argh; +def oopsDouble = test2::argh; typedef Argh = fn int(double, Bobo); typedef Argh2 = fn int(double, Bobo); @@ -95,12 +95,12 @@ struct Foo int b; } -define getValueInt = test2::getValue; -define getValueDouble = test2::getValue; +def getValueInt = test2::getValue; +def getValueDouble = test2::getValue; typedef IntBlob = test2::Blob; typedef DoubleBlob = Blob; -define getMultInt = test2::getMult; -define getMultDouble = test2::getMult; +def getMultInt = test2::getMult; +def getMultDouble = test2::getMult; typedef IntArray = List; typedef IntList = LinkedList; @@ -173,7 +173,7 @@ module hello_world; import foo; extern fn int printf(char *, ...); -define doubleMult = foo::check; +def doubleMult = foo::check; fn void hello() { @@ -219,8 +219,8 @@ macro Hello wut() } typedef Bye = Hello; -define wat = wut; -define byebye = hello; +def wat = wut; +def byebye = hello; fn int hello() { diff --git a/test/test_suite/functions/test_regression_mingw.c3t b/test/test_suite/functions/test_regression_mingw.c3t index 848615d14..b8f01bd71 100644 --- a/test/test_suite/functions/test_regression_mingw.c3t +++ b/test/test_suite/functions/test_regression_mingw.c3t @@ -67,8 +67,8 @@ fn int Foo2.mutate(Foo2 *foo) -define oopsInt = test2::argh; -define oopsDouble = test2::argh; +def oopsInt = test2::argh; +def oopsDouble = test2::argh; typedef Argh = fn int(double, Bobo); typedef Argh2 = fn int(double, Bobo); @@ -97,12 +97,12 @@ struct Foo int b; } -define getValueInt = test2::getValue; -define getValueDouble = test2::getValue; +def getValueInt = test2::getValue; +def getValueDouble = test2::getValue; typedef IntBlob = test2::Blob; typedef DoubleBlob = Blob; -define getMultInt = test2::getMult; -define getMultDouble = test2::getMult; +def getMultInt = test2::getMult; +def getMultDouble = test2::getMult; typedef IntArray = List; typedef IntList = LinkedList; @@ -175,7 +175,7 @@ module hello_world; import foo; extern fn int printf(char *, ...); -define doubleMult = foo::check; +def doubleMult = foo::check; fn void hello() { @@ -221,8 +221,8 @@ macro Hello wut() } typedef Bye = Hello; -define wat = wut; -define byebye = hello; +def wat = wut; +def byebye = hello; fn int hello() { diff --git a/test/test_suite/functions/too_many_params.c3 b/test/test_suite/functions/too_many_params.c3 index 1c42ee6f0..c0a6917cf 100644 --- a/test/test_suite/functions/too_many_params.c3 +++ b/test/test_suite/functions/too_many_params.c3 @@ -1,5 +1,5 @@ import std::io; -typedef Tester = fn int(int x, int y, int z); +def Tester = fn int(int x, int y, int z); fn int test1( int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, // 20 diff --git a/test/test_suite/generic/generic_copy.c3t b/test/test_suite/generic/generic_copy.c3t index ede601329..a1935e92b 100644 --- a/test/test_suite/generic/generic_copy.c3t +++ b/test/test_suite/generic/generic_copy.c3t @@ -9,4 +9,4 @@ fn void abc() module tester; import foo; -define abc_my = foo::abc; \ No newline at end of file +def abc_my = foo::abc; \ No newline at end of file diff --git a/test/test_suite/generic/generic_cyclic.c3 b/test/test_suite/generic/generic_cyclic.c3 index 8a6f686a3..f4e48b167 100644 --- a/test/test_suite/generic/generic_cyclic.c3 +++ b/test/test_suite/generic/generic_cyclic.c3 @@ -2,7 +2,7 @@ module test; import bar; -typedef BazTest = Baz; +def BazTest = Baz; struct Test // #error: Recursive definition of 'Test' { diff --git a/test/test_suite/generic/generic_idents.c3t b/test/test_suite/generic/generic_idents.c3t index a9c152b81..9bd2803ad 100644 --- a/test/test_suite/generic/generic_idents.c3t +++ b/test/test_suite/generic/generic_idents.c3t @@ -13,8 +13,8 @@ fn Type addMult(Type x, Type a, Type b) module test; import gen; -define intMult = gen::mult; -define doubleAddMult = gen::addMult; +def intMult = gen::mult; +def doubleAddMult = gen::addMult; fn int getIt(int i) { diff --git a/test/test_suite/generic/generic_num.c3t b/test/test_suite/generic/generic_num.c3t index a04316954..f9afef039 100644 --- a/test/test_suite/generic/generic_num.c3t +++ b/test/test_suite/generic/generic_num.c3t @@ -8,7 +8,7 @@ fn Type x(Type t) module test; import hello; -define xint = hello::x; +def xint = hello::x; import std::io; diff --git a/test/test_suite/methods/access.c3 b/test/test_suite/methods/access.c3 index aed49d55e..42cf06d83 100644 --- a/test/test_suite/methods/access.c3 +++ b/test/test_suite/methods/access.c3 @@ -10,7 +10,7 @@ struct An3 An2 y; } -typedef AnCall = fn void(); +def AnCall = fn void(); struct An2 { diff --git a/test/test_suite/methods/access_private_method.c3 b/test/test_suite/methods/access_private_method.c3 index bd1f763a1..5e81cb5db 100644 --- a/test/test_suite/methods/access_private_method.c3 +++ b/test/test_suite/methods/access_private_method.c3 @@ -1,4 +1,4 @@ -typedef NodeNotifyHandler = fn void(TreeView* this, TreeNode* node, String prop, void* data); +def NodeNotifyHandler = fn void(TreeView* this, TreeNode* node, String prop, void* data); fn void TreeView.nodeNotifyHandler(TreeView* this, TreeNode* node, String prop, void* data) @private {} struct TreeNode { int abc; NodeNotifyHandler notifyHandler; } diff --git a/test/test_suite/methods/extension_method_generic.c3 b/test/test_suite/methods/extension_method_generic.c3 index 364a2794f..2d6fb3e2e 100644 --- a/test/test_suite/methods/extension_method_generic.c3 +++ b/test/test_suite/methods/extension_method_generic.c3 @@ -1,7 +1,7 @@ module compiler_c3; import std::collections::list; -typedef IntArray = List; +def IntArray = List; extern fn void printf(char*, ...); diff --git a/test/test_suite/methods/method_from_var.c3 b/test/test_suite/methods/method_from_var.c3 index e0122129c..ce5bba181 100644 --- a/test/test_suite/methods/method_from_var.c3 +++ b/test/test_suite/methods/method_from_var.c3 @@ -1,4 +1,4 @@ -typedef NodeNotifyHandler = fn void(TreeView* this, TreeNode* node, String prop, void* data); +def NodeNotifyHandler = fn void(TreeView* this, TreeNode* node, String prop, void* data); fn void TreeView.nodeNotifyHandler(TreeView* this, TreeNode* node, String prop, void* data) @private {} struct TreeNode { int abc; NodeNotifyHandler notifyHandler; } diff --git a/test/test_suite/statements/default_args.c3 b/test/test_suite/statements/default_args.c3 index 7ab73dda6..b90fd6caa 100644 --- a/test/test_suite/statements/default_args.c3 +++ b/test/test_suite/statements/default_args.c3 @@ -1,4 +1,4 @@ -typedef Foo = fn void(int a = 10); +def Foo = fn void(int a = 10); fn int abc() { return 1; } -typedef Foo2 = fn void(int a = abc()); +def Foo2 = fn void(int a = abc()); diff --git a/test/test_suite/statements/foreach_custom_errors.c3 b/test/test_suite/statements/foreach_custom_errors.c3 index 60a4f30d0..9577dd2d5 100644 --- a/test/test_suite/statements/foreach_custom_errors.c3 +++ b/test/test_suite/statements/foreach_custom_errors.c3 @@ -4,7 +4,7 @@ fn void test1() foreach (a : x) { }; // #error: It's not possible to enumerate an expression of type 'int' } -typedef Test1 = distinct int; +def Test1 = distinct int; fn void test2() { diff --git a/test/test_suite/statements/foreach_r_custom_errors.c3 b/test/test_suite/statements/foreach_r_custom_errors.c3 index cdd389f88..66f4d8a94 100644 --- a/test/test_suite/statements/foreach_r_custom_errors.c3 +++ b/test/test_suite/statements/foreach_r_custom_errors.c3 @@ -4,7 +4,7 @@ fn void test1() foreach_r (a : x) { }; // #error: It's not possible to enumerate an expression of type 'int' } -typedef Test1 = distinct int; +def Test1 = distinct int; fn void test2() { diff --git a/test/test_suite/struct/member_expr.c3 b/test/test_suite/struct/member_expr.c3 index 1afc51e7a..2e5d18c70 100644 --- a/test/test_suite/struct/member_expr.c3 +++ b/test/test_suite/struct/member_expr.c3 @@ -1,7 +1,7 @@ -typedef Func = fn int(int); +def Func = fn int(int); -typedef Func2 = fn int(Foo*, int); +def Func2 = fn int(Foo*, int); struct Foo { diff --git a/test/test_suite/struct/zero_member.c3 b/test/test_suite/struct/zero_member.c3 index 316f704cd..fab779baa 100644 --- a/test/test_suite/struct/zero_member.c3 +++ b/test/test_suite/struct/zero_member.c3 @@ -1,4 +1,4 @@ -typedef Foo = int[0]; // #error: An array may not have zero +def Foo = int[0]; // #error: An array may not have zero struct Bar { diff --git a/test/test_suite/symbols/shadow_struct.c3 b/test/test_suite/symbols/shadow_struct.c3 index 34aa1626b..a9cb4b10b 100644 --- a/test/test_suite/symbols/shadow_struct.c3 +++ b/test/test_suite/symbols/shadow_struct.c3 @@ -4,7 +4,7 @@ struct Foo int y; } -typedef Foo = float; // #error: shadow a previous declaration +def Foo = float; // #error: shadow a previous declaration enum Bar { @@ -12,4 +12,4 @@ enum Bar TEST2 } -typedef Bar = float; // #error: shadow a previous declaration \ No newline at end of file +def Bar = float; // #error: shadow a previous declaration \ No newline at end of file diff --git a/test/test_suite/symbols/various.c3 b/test/test_suite/symbols/various.c3 index 56b16c193..1ba7188e2 100644 --- a/test/test_suite/symbols/various.c3 +++ b/test/test_suite/symbols/various.c3 @@ -49,7 +49,7 @@ fn void test7() int v = array[1]; } -typedef Number = int; +def Number = int; fn void test8() { diff --git a/test/test_suite/types/enum_inference.c3 b/test/test_suite/types/enum_inference.c3 index 4d965c71e..49fb3bdad 100644 --- a/test/test_suite/types/enum_inference.c3 +++ b/test/test_suite/types/enum_inference.c3 @@ -13,7 +13,7 @@ enum Inf2 : char C, } -typedef BooInf = Inf; +def BooInf = Inf; fn void enumInferenceTest() diff --git a/test/test_suite/types/enum_ok.c3 b/test/test_suite/types/enum_ok.c3 index c1c8ab000..589b9d418 100644 --- a/test/test_suite/types/enum_ok.c3 +++ b/test/test_suite/types/enum_ok.c3 @@ -4,7 +4,7 @@ enum EnumTest : long VALUE2 } -typedef Frob = long; +def Frob = long; enum EnumTestAlias : Frob { diff --git a/test/test_suite/types/recursive_typedef.c3 b/test/test_suite/types/recursive_typedef.c3 index 4473211f7..07ee1ab76 100644 --- a/test/test_suite/types/recursive_typedef.c3 +++ b/test/test_suite/types/recursive_typedef.c3 @@ -1,9 +1,9 @@ -typedef Number2 = Number1; // #error: Recursive definition of 'Number2' -typedef Number1 = Number2; +def Number2 = Number1; // #error: Recursive definition of 'Number2' +def Number1 = Number2; -typedef Number = Number; // #error: Recursive definition of 'Number' +def Number = Number; // #error: Recursive definition of 'Number' -typedef Loop2 = Loop; // #error: Recursive definition of 'Loop2' -typedef Loop3 = Loop2; -typedef Loop = Loop3; +def Loop2 = Loop; // #error: Recursive definition of 'Loop2' +def Loop3 = Loop2; +def Loop = Loop3; diff --git a/test/test_suite/types/redefinition.c3 b/test/test_suite/types/redefinition.c3 index 78c8cd476..b17fe2247 100644 --- a/test/test_suite/types/redefinition.c3 +++ b/test/test_suite/types/redefinition.c3 @@ -1,2 +1,2 @@ -typedef Number = int; -typedef Number = uint; // #error: 'Number' would shadow a previous declaration. \ No newline at end of file +def Number = int; +def Number = uint; // #error: 'Number' would shadow a previous declaration. \ No newline at end of file diff --git a/test/test_suite/types/typedefs.c3 b/test/test_suite/types/typedefs.c3 index 67ec8efd8..8e293f9bb 100644 --- a/test/test_suite/types/typedefs.c3 +++ b/test/test_suite/types/typedefs.c3 @@ -1,4 +1,4 @@ -typedef Arr = int[4]; +def Arr = int[4]; Arr a = { 3, 4, 5, 6 }; diff --git a/test/unit/stdlib/collections/enummap.c3 b/test/unit/stdlib/collections/enummap.c3 index 97f2f0c2d..badd3797e 100644 --- a/test/unit/stdlib/collections/enummap.c3 +++ b/test/unit/stdlib/collections/enummap.c3 @@ -8,7 +8,7 @@ enum FooEnum THREE, } -typedef FooEnumMap = EnumMap; +def FooEnumMap = EnumMap; fn void! enums() { diff --git a/test/unit/stdlib/collections/linkedlist.c3 b/test/unit/stdlib/collections/linkedlist.c3 index 923d05152..aadeb09fe 100644 --- a/test/unit/stdlib/collections/linkedlist.c3 +++ b/test/unit/stdlib/collections/linkedlist.c3 @@ -1,7 +1,7 @@ module linkedlist_test @test; import std::collections::linkedlist; -typedef IntList = LinkedList; +def IntList = LinkedList; fn void! test_push() {