mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Compare commits
5 Commits
0.4ubuntu2
...
0.4stripun
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0de47d7c83 | ||
|
|
cfd21f8ca2 | ||
|
|
d0e8944c56 | ||
|
|
3e54d13b62 | ||
|
|
b30d130d92 |
@@ -2,7 +2,7 @@ module std::thread::os;
|
||||
|
||||
$if thread::THREAD_MODEL == ThreadModel.WIN32:
|
||||
|
||||
typedef NativeThread = Win32_HANDLE;
|
||||
def NativeThread = Win32_HANDLE;
|
||||
|
||||
struct NativeMutex
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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); }
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -159,7 +159,11 @@ static void usage(void)
|
||||
OUTPUT(" --wincrt=<option> - Windows CRT linking: none, static, dynamic (default).");
|
||||
OUTPUT("");
|
||||
OUTPUT(" --macossdk <dir> - Set the directory for the MacOS SDK for cross compilation.");
|
||||
|
||||
OUTPUT(" --macos-min-version <ver> - Set the minimum MacOS version to compile for.");
|
||||
OUTPUT(" --macos-sdk-version <ver> - Set the MacOS SDK compiled for.");
|
||||
OUTPUT("");
|
||||
OUTPUT(" --linux-crt <dir> - Set the directory to use for finding crt1.o and related files.");
|
||||
OUTPUT(" --linux-crtbegin <dir> - Set the directory to use for finding crtbegin.o and related files.");
|
||||
}
|
||||
|
||||
|
||||
@@ -807,6 +811,18 @@ static void parse_option(BuildOptions *options)
|
||||
options->path = check_dir(next_arg());
|
||||
return;
|
||||
}
|
||||
if (match_longopt("linux-crt"))
|
||||
{
|
||||
if (at_end() || next_is_opt()) error_exit("error: --linux-crt needs a directory.");
|
||||
options->linuxpaths.crt = check_dir(next_arg());
|
||||
return;
|
||||
}
|
||||
if (match_longopt("linux-crtbegin"))
|
||||
{
|
||||
if (at_end() || next_is_opt()) error_exit("error: --linux-crtbegin needs a directory.");
|
||||
options->linuxpaths.crtbegin = check_dir(next_arg());
|
||||
return;
|
||||
}
|
||||
if (match_longopt("safe"))
|
||||
{
|
||||
options->safe_mode = 1;
|
||||
|
||||
@@ -297,6 +297,10 @@ typedef struct BuildOptions_
|
||||
const char *min_version;
|
||||
const char *sdk_version;
|
||||
} macos;
|
||||
struct {
|
||||
const char *crt;
|
||||
const char *crtbegin;
|
||||
} linuxpaths;
|
||||
int build_threads;
|
||||
const char** libraries_to_fetch;
|
||||
const char** files;
|
||||
@@ -456,6 +460,11 @@ typedef struct
|
||||
WinCrtLinking crt_linking;
|
||||
bool use_win_subsystem;
|
||||
} win;
|
||||
struct
|
||||
{
|
||||
const char *crt;
|
||||
const char *crtbegin;
|
||||
} linuxpaths;
|
||||
} BuildTarget;
|
||||
|
||||
|
||||
|
||||
@@ -243,6 +243,8 @@ static void update_build_target_from_options(BuildTarget *target, BuildOptions *
|
||||
if (options->macos.min_version) target->macos.min_version = options->macos.min_version;
|
||||
if (options->macos.sdk_version) target->macos.sdk_version = options->macos.sdk_version;
|
||||
if (options->win.crt_linking != WIN_CRT_DEFAULT) target->win.crt_linking = options->win.crt_linking;
|
||||
if (options->linuxpaths.crt) target->linuxpaths.crt = options->linuxpaths.crt;
|
||||
if (options->linuxpaths.crtbegin) target->linuxpaths.crtbegin = options->linuxpaths.crtbegin;
|
||||
if (options->x86_vector_capability != X86VECTOR_DEFAULT)
|
||||
{
|
||||
target->feature.x86_vector_capability = options->x86_vector_capability;
|
||||
|
||||
@@ -374,6 +374,12 @@ static void load_into_build_target(JSONObject *json, const char *type, BuildTarg
|
||||
// macos-sdk-version
|
||||
target->macos.sdk_version = get_valid_string(json, "macos-sdk-version", type, false);
|
||||
|
||||
// Linux crt
|
||||
target->linuxpaths.crt = get_valid_string(json, "linux-crt", type, false);
|
||||
|
||||
// Linux crtbegin
|
||||
target->linuxpaths.crtbegin = get_valid_string(json, "linux-crtbegin", type, false);
|
||||
|
||||
// version
|
||||
const char *version = get_valid_string(json, "version", type, false);
|
||||
if (version) target->version = version;
|
||||
|
||||
@@ -432,8 +432,7 @@ void compiler_compile(void)
|
||||
}
|
||||
else if (task_count > 1)
|
||||
{
|
||||
TaskQueueRef queue = taskqueue_create(active_target.build_threads > task_count ? task_count : active_target.build_threads, tasks);
|
||||
taskqueue_wait_for_completion(queue);
|
||||
taskqueue_run(active_target.build_threads > task_count ? task_count : active_target.build_threads, tasks);
|
||||
}
|
||||
|
||||
if (active_target.print_output)
|
||||
|
||||
@@ -340,6 +340,7 @@ static const char *find_freebsd_crt(void)
|
||||
|
||||
static const char *find_linux_crt(void)
|
||||
{
|
||||
if (active_target.linuxpaths.crt) return active_target.linuxpaths.crt;
|
||||
#if PLATFORM_POSIX
|
||||
glob_t globbuf;
|
||||
if (!glob("/usr/lib/*/crt1.o", 0, NULL, &globbuf) && globbuf.gl_pathc)
|
||||
@@ -362,6 +363,7 @@ static const char *find_linux_crt(void)
|
||||
|
||||
static const char *find_linux_crt_begin(void)
|
||||
{
|
||||
if (active_target.linuxpaths.crtbegin) return active_target.linuxpaths.crtbegin;
|
||||
#if PLATFORM_POSIX
|
||||
glob_t globbuf;
|
||||
if (!glob("/usr/lib/gcc/*/*/crtbegin.o", 0, NULL, &globbuf) && globbuf.gl_pathc)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -261,6 +261,8 @@ static void assign_panicfn(void)
|
||||
error_exit("Expected panic function to have the signature fn void(String, String, String, uint).");
|
||||
}
|
||||
global_context.panic_var = decl;
|
||||
decl->no_strip = true;
|
||||
|
||||
if (active_target.no_stdlib) return;
|
||||
|
||||
const char *panicf = "std::core::builtin::panicf";
|
||||
@@ -275,6 +277,8 @@ static void assign_panicfn(void)
|
||||
return;
|
||||
}
|
||||
|
||||
panicf_decl->no_strip = true;
|
||||
|
||||
Type *panicf_fn_type = panicf_decl->type->canonical;
|
||||
if (panicf_decl->decl_kind != DECL_FUNC)
|
||||
{
|
||||
|
||||
@@ -57,8 +57,6 @@ typedef struct Task_
|
||||
void *arg;
|
||||
} Task;
|
||||
|
||||
typedef void *TaskQueueRef;
|
||||
|
||||
uint16_t *win_utf8to16(const char *name);
|
||||
char *win_utf16to8(const uint16_t *name);
|
||||
// Use as if it was mkdir(..., 0755) == 0
|
||||
@@ -98,8 +96,7 @@ char *calloc_string(size_t len);
|
||||
void free_arena(void);
|
||||
void print_arena_status(void);
|
||||
void run_arena_allocator_tests(void);
|
||||
TaskQueueRef taskqueue_create(int threads, Task **task_list);
|
||||
void taskqueue_wait_for_completion(TaskQueueRef queue);
|
||||
void taskqueue_run(int threads, Task **task_list);
|
||||
int cpus(void);
|
||||
const char *date_get(void);
|
||||
const char *time_get(void);
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
|
||||
typedef struct TaskQueue_
|
||||
{
|
||||
pthread_t *threads;
|
||||
int thread_count;
|
||||
pthread_mutex_t lock;
|
||||
Task **queue;
|
||||
} TaskQueue;
|
||||
@@ -35,48 +33,80 @@ SHUTDOWN:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TaskQueueRef taskqueue_create(int threads, Task **task_list)
|
||||
void taskqueue_run(int threads, Task **task_list)
|
||||
{
|
||||
assert(threads > 0);
|
||||
TaskQueue *queue = CALLOCS(TaskQueue);
|
||||
queue->threads = MALLOC(sizeof(pthread_t) * (unsigned)threads);
|
||||
queue->thread_count = threads;
|
||||
queue->queue = task_list;
|
||||
if (pthread_mutex_init(&queue->lock, NULL)) error_exit("Failed to set up mutex");
|
||||
pthread_t *pthreads = malloc(sizeof(pthread_t) * (unsigned)threads);
|
||||
TaskQueue queue = { .queue = task_list };
|
||||
if (pthread_mutex_init(&queue.lock, NULL)) error_exit("Failed to set up mutex");
|
||||
for (int i = 0; i < threads; i++)
|
||||
{
|
||||
if (pthread_create(queue->threads + i, NULL, taskqueue_thread, queue)) error_exit("Fail to set up thread pool");
|
||||
if (pthread_create(&pthreads[i], NULL, taskqueue_thread, &queue)) error_exit("Fail to set up thread pool");
|
||||
}
|
||||
return queue;
|
||||
}
|
||||
|
||||
void taskqueue_wait_for_completion(TaskQueueRef queue_ref)
|
||||
{
|
||||
assert(queue_ref);
|
||||
TaskQueue *queue = queue_ref;
|
||||
for (int i = 0; i < queue->thread_count; i++)
|
||||
for (int i = 0; i < threads; i++)
|
||||
{
|
||||
if (pthread_join(queue->threads[i], NULL) != 0) error_exit("Failed to join thread.");
|
||||
if (pthread_join(pthreads[i], NULL) != 0) error_exit("Failed to join thread.");
|
||||
}
|
||||
pthread_mutex_destroy(&queue->lock);
|
||||
free(pthreads);
|
||||
pthread_mutex_destroy(&queue.lock);
|
||||
}
|
||||
|
||||
#elif PLATFORM_WINDOWS
|
||||
|
||||
#include <Windows.h>
|
||||
#include <process.h>
|
||||
|
||||
typedef struct TaskQueue_
|
||||
{
|
||||
CRITICAL_SECTION lock;
|
||||
Task **queue;
|
||||
} TaskQueue;
|
||||
|
||||
static DWORD WINAPI taskqueue_thread(LPVOID lpParam)
|
||||
{
|
||||
TaskQueue *task_queue = (TaskQueue *)lpParam;
|
||||
bool is_active = false;
|
||||
while (1)
|
||||
{
|
||||
EnterCriticalSection(&task_queue->lock);
|
||||
unsigned task_count = vec_size(task_queue->queue);
|
||||
if (!task_count) goto SHUTDOWN;
|
||||
Task *task = (Task*)task_queue->queue[task_count - 1];
|
||||
vec_pop(task_queue->queue);
|
||||
LeaveCriticalSection(&task_queue->lock);
|
||||
task->task(task->arg);
|
||||
}
|
||||
SHUTDOWN:
|
||||
LeaveCriticalSection(&task_queue->lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void taskqueue_run(int threads, Task **task_list)
|
||||
{
|
||||
assert(threads > 0);
|
||||
HANDLE *handles = malloc(sizeof(HANDLE) * (unsigned)threads);
|
||||
TaskQueue queue = { .queue = task_list };
|
||||
InitializeCriticalSection(&queue.lock);
|
||||
for (int i = 0; i < threads; i++)
|
||||
{
|
||||
handles[i] = (HANDLE)_beginthreadex(NULL, 0, taskqueue_thread, &queue, 0, NULL);
|
||||
if (handles[i] == NULL) error_exit("Fail to set up thread pool");
|
||||
}
|
||||
WaitForMultipleObjects(threads, handles, TRUE, INFINITE);
|
||||
|
||||
for (int i = 0; i < threads; i++)
|
||||
{
|
||||
CloseHandle(handles[i]);
|
||||
}
|
||||
free((void*)handles);
|
||||
DeleteCriticalSection(&queue.lock);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void taskqueue_add(TaskQueueRef queue_ref, Task *task)
|
||||
void taskqueue_run(int threads, Task **task_list)
|
||||
{
|
||||
}
|
||||
|
||||
TaskQueueRef taskqueue_create(int threads, Task **tasks)
|
||||
{
|
||||
return tasks;
|
||||
}
|
||||
|
||||
void taskqueue_wait_for_completion(TaskQueueRef queue)
|
||||
{
|
||||
Task **tasks = queue;
|
||||
FOREACH_BEGIN(Task *task, tasks)
|
||||
FOREACH_BEGIN(Task *task, task_list)
|
||||
task->task(task->arg);
|
||||
FOREACH_END();
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define COMPILER_VERSION "0.4.518"
|
||||
#define COMPILER_VERSION "0.4.522"
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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; }
|
||||
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module abc;
|
||||
|
||||
define @Foo = { @inline };
|
||||
def @Foo = { @inline };
|
||||
|
||||
module bar;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
module foo;
|
||||
|
||||
// define <name> = <name>
|
||||
// def <name> = <name>
|
||||
def standard_foo = __stdin;
|
||||
def someFunctionIntBool = someFunction<int, bool>;
|
||||
def FooInt = Foo<int>;
|
||||
def A_CONST_INT = A_CONST<int>;
|
||||
|
||||
def standard_foo<int> = 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
|
||||
|
||||
@@ -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
|
||||
def HELLO = int; // #error: uppercase letter
|
||||
def HELLO = Foo; // #error: uppercase letter
|
||||
@@ -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.
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
typedef Foo = distinct double[];
|
||||
def Foo = distinct double[];
|
||||
|
||||
fn void main()
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ struct Struct
|
||||
double y;
|
||||
}
|
||||
|
||||
typedef Foo = distinct Struct;
|
||||
def Foo = distinct Struct;
|
||||
|
||||
struct Struct2
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module test;
|
||||
|
||||
typedef Int2 = distinct int;
|
||||
def Int2 = distinct int;
|
||||
|
||||
fn void test()
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module test;
|
||||
|
||||
typedef Foo = distinct int;
|
||||
def Foo = distinct int;
|
||||
|
||||
fn int test1()
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@ struct Struct
|
||||
double y;
|
||||
}
|
||||
|
||||
typedef Foo = distinct Struct;
|
||||
def Foo = distinct Struct;
|
||||
|
||||
struct Struct2
|
||||
{
|
||||
|
||||
@@ -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 }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
typedef Number = int;
|
||||
def Number = int;
|
||||
|
||||
fn void test1()
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -13,7 +13,7 @@ enum EnumB : char
|
||||
C, D
|
||||
}
|
||||
|
||||
typedef Func = fn void(Enum);
|
||||
def Func = fn void(Enum);
|
||||
|
||||
fn void test1(Enum e)
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
typedef Number = int;
|
||||
def Number = int;
|
||||
|
||||
fn void test1()
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module test;
|
||||
|
||||
typedef Foo = distinct int;
|
||||
def Foo = distinct int;
|
||||
|
||||
fn void test1()
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -65,8 +65,8 @@ fn int Foo2.mutate(Foo2 *foo)
|
||||
return ++foo.x;
|
||||
}
|
||||
|
||||
define oopsInt = test2::argh<int>;
|
||||
define oopsDouble = test2::argh<int>;
|
||||
def oopsInt = test2::argh<int>;
|
||||
def oopsDouble = test2::argh<int>;
|
||||
typedef Argh = fn int(double, Bobo);
|
||||
typedef Argh2 = fn int(double, Bobo);
|
||||
|
||||
@@ -95,12 +95,12 @@ struct Foo
|
||||
int b;
|
||||
}
|
||||
|
||||
define getValueInt = test2::getValue<int>;
|
||||
define getValueDouble = test2::getValue<double>;
|
||||
def getValueInt = test2::getValue<int>;
|
||||
def getValueDouble = test2::getValue<double>;
|
||||
typedef IntBlob = test2::Blob<int>;
|
||||
typedef DoubleBlob = Blob<double>;
|
||||
define getMultInt = test2::getMult<int>;
|
||||
define getMultDouble = test2::getMult<double>;
|
||||
def getMultInt = test2::getMult<int>;
|
||||
def getMultDouble = test2::getMult<double>;
|
||||
|
||||
typedef IntArray = List<int>;
|
||||
typedef IntList = LinkedList<int>;
|
||||
@@ -173,7 +173,7 @@ module hello_world;
|
||||
import foo;
|
||||
|
||||
extern fn int printf(char *, ...);
|
||||
define doubleMult = foo::check<double>;
|
||||
def doubleMult = foo::check<double>;
|
||||
|
||||
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()
|
||||
{
|
||||
|
||||
@@ -67,8 +67,8 @@ fn int Foo2.mutate(Foo2 *foo)
|
||||
|
||||
|
||||
|
||||
define oopsInt = test2::argh<int>;
|
||||
define oopsDouble = test2::argh<int>;
|
||||
def oopsInt = test2::argh<int>;
|
||||
def oopsDouble = test2::argh<int>;
|
||||
typedef Argh = fn int(double, Bobo);
|
||||
typedef Argh2 = fn int(double, Bobo);
|
||||
|
||||
@@ -97,12 +97,12 @@ struct Foo
|
||||
int b;
|
||||
}
|
||||
|
||||
define getValueInt = test2::getValue<int>;
|
||||
define getValueDouble = test2::getValue<double>;
|
||||
def getValueInt = test2::getValue<int>;
|
||||
def getValueDouble = test2::getValue<double>;
|
||||
typedef IntBlob = test2::Blob<int>;
|
||||
typedef DoubleBlob = Blob<double>;
|
||||
define getMultInt = test2::getMult<int>;
|
||||
define getMultDouble = test2::getMult<double>;
|
||||
def getMultInt = test2::getMult<int>;
|
||||
def getMultDouble = test2::getMult<double>;
|
||||
|
||||
typedef IntArray = List<int>;
|
||||
typedef IntList = LinkedList<int>;
|
||||
@@ -175,7 +175,7 @@ module hello_world;
|
||||
import foo;
|
||||
|
||||
extern fn int printf(char *, ...);
|
||||
define doubleMult = foo::check<double>;
|
||||
def doubleMult = foo::check<double>;
|
||||
|
||||
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()
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -9,4 +9,4 @@ fn void abc()
|
||||
module tester;
|
||||
import foo;
|
||||
|
||||
define abc_my = foo::abc<int>;
|
||||
def abc_my = foo::abc<int>;
|
||||
@@ -2,7 +2,7 @@
|
||||
module test;
|
||||
import bar;
|
||||
|
||||
typedef BazTest = Baz<Test>;
|
||||
def BazTest = Baz<Test>;
|
||||
|
||||
struct Test // #error: Recursive definition of 'Test'
|
||||
{
|
||||
|
||||
@@ -13,8 +13,8 @@ fn Type addMult(Type x, Type a, Type b)
|
||||
module test;
|
||||
import gen;
|
||||
|
||||
define intMult = gen::mult<int>;
|
||||
define doubleAddMult = gen::addMult<double>;
|
||||
def intMult = gen::mult<int>;
|
||||
def doubleAddMult = gen::addMult<double>;
|
||||
|
||||
fn int getIt(int i)
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@ fn Type x(Type t)
|
||||
|
||||
module test;
|
||||
import hello;
|
||||
define xint = hello::x<int, -123>;
|
||||
def xint = hello::x<int, -123>;
|
||||
|
||||
import std::io;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ struct An3
|
||||
An2 y;
|
||||
}
|
||||
|
||||
typedef AnCall = fn void();
|
||||
def AnCall = fn void();
|
||||
|
||||
struct An2
|
||||
{
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module compiler_c3;
|
||||
import std::collections::list;
|
||||
|
||||
typedef IntArray = List<int>;
|
||||
def IntArray = List<int>;
|
||||
|
||||
extern fn void printf(char*, ...);
|
||||
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
def Bar = float; // #error: shadow a previous declaration
|
||||
@@ -49,7 +49,7 @@ fn void test7()
|
||||
int v = array[1];
|
||||
}
|
||||
|
||||
typedef Number = int;
|
||||
def Number = int;
|
||||
|
||||
fn void test8()
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@ enum Inf2 : char
|
||||
C,
|
||||
}
|
||||
|
||||
typedef BooInf = Inf;
|
||||
def BooInf = Inf;
|
||||
|
||||
|
||||
fn void enumInferenceTest()
|
||||
|
||||
@@ -4,7 +4,7 @@ enum EnumTest : long
|
||||
VALUE2
|
||||
}
|
||||
|
||||
typedef Frob = long;
|
||||
def Frob = long;
|
||||
|
||||
enum EnumTestAlias : Frob
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
typedef Number = int;
|
||||
typedef Number = uint; // #error: 'Number' would shadow a previous declaration.
|
||||
def Number = int;
|
||||
def Number = uint; // #error: 'Number' would shadow a previous declaration.
|
||||
@@ -1,4 +1,4 @@
|
||||
typedef Arr = int[4];
|
||||
def Arr = int[4];
|
||||
|
||||
Arr a = { 3, 4, 5, 6 };
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ enum FooEnum
|
||||
THREE,
|
||||
}
|
||||
|
||||
typedef FooEnumMap = EnumMap<FooEnum, uint>;
|
||||
def FooEnumMap = EnumMap<FooEnum, uint>;
|
||||
|
||||
fn void! enums()
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module linkedlist_test @test;
|
||||
import std::collections::linkedlist;
|
||||
|
||||
typedef IntList = LinkedList<int>;
|
||||
def IntList = LinkedList<int>;
|
||||
|
||||
fn void! test_push()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user