1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

parser: require assign on type alias (#6477)

This commit is contained in:
Daniel Däschle
2020-09-25 12:02:32 +02:00
committed by GitHub
parent 2ea94d621f
commit abc98c273c
27 changed files with 49 additions and 43 deletions

View File

@@ -6,7 +6,7 @@ module builtin
__global g_m2_buf byteptr
__global g_m2_ptr byteptr
type FnExitCb fn()
type FnExitCb = fn()
fn C.atexit(f FnExitCb) int
pub fn exit(code int) {
@@ -71,8 +71,8 @@ pub fn eprintln(s string) {
}
C.fflush(C.stdout)
C.fflush(C.stderr)
C.write(2, s.str, s.len)
C.write(2, c'\n', 1)
C.write(2, s.str, s.len)
C.write(2, c'\n', 1)
C.fflush(C.stderr)
}
@@ -82,12 +82,12 @@ pub fn eprint(s string) {
}
C.fflush(C.stdout)
C.fflush(C.stderr)
C.write(2, s.str, s.len)
C.write(2, s.str, s.len)
C.fflush(C.stderr)
}
pub fn print(s string) {
C.write(1, s.str, s.len)
C.write(1, s.str, s.len)
}
const (

View File

@@ -199,7 +199,7 @@ pub:
context_record &ContextRecord
}
type VectoredExceptionHandler fn(&ExceptionPointers)u32
type VectoredExceptionHandler = fn(&ExceptionPointers)u32
fn C.AddVectoredExceptionHandler(u32, C.PVECTORED_EXCEPTION_HANDLER)
fn add_vectored_exception_handler(handler VectoredExceptionHandler) {

View File

@@ -91,7 +91,7 @@ fn test_cmp() {
assert 1 ⩾ 0
}
*/
type MyInt int
type MyInt = int
fn test_int_alias() {
i := MyInt(2)
@@ -168,7 +168,7 @@ fn test_num_separator() {
// f32 or f64
assert 312_2.55 == 3122.55
assert 312_2.55 == 3122.55
}
fn test_int_decl() {

View File

@@ -734,7 +734,7 @@ fn test_raw() {
assert raw3[7] == `\\`
assert raw3[8] == `x`
assert raw3[9] == `0`
assert raw3[10] == `0`
assert raw3[10] == `0`
}
fn test_raw_with_quotes() {
@@ -862,7 +862,7 @@ fn test_string_literal_with_backslash(){
}
/*
type MyString string
type MyString = string
fn test_string_alias() {
s := MyString('hi')