mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
generics: test T{}
This commit is contained in:
parent
013fdb8a4b
commit
59711d9c55
@ -492,6 +492,7 @@ pub fn (mut t Table) register_builtin_type_symbols() {
|
|||||||
kind: .any
|
kind: .any
|
||||||
name: 'T'
|
name: 'T'
|
||||||
mod: 'builtin'
|
mod: 'builtin'
|
||||||
|
is_public: true
|
||||||
})
|
})
|
||||||
t.register_type_symbol({
|
t.register_type_symbol({
|
||||||
kind: .any_float
|
kind: .any_float
|
||||||
@ -610,7 +611,7 @@ pub mut:
|
|||||||
|
|
||||||
pub struct Enum {
|
pub struct Enum {
|
||||||
pub:
|
pub:
|
||||||
vals []string
|
vals []string
|
||||||
is_flag bool
|
is_flag bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +38,21 @@ fn test_foo() {
|
|||||||
assert sum<int>(b) == 6
|
assert sum<int>(b) == 6
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn create<T>() {
|
||||||
|
a := T{}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct User {
|
||||||
|
}
|
||||||
|
|
||||||
|
struct City {
|
||||||
|
}
|
||||||
|
|
||||||
|
fn test_create() {
|
||||||
|
create<User>()
|
||||||
|
create<City>()
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
fn map_f<T,U>(l []T, f fn(T)U) []U {
|
fn map_f<T,U>(l []T, f fn(T)U) []U {
|
||||||
mut r := []U{}
|
mut r := []U{}
|
@ -36,14 +36,15 @@ pub const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
pub struct Context {
|
pub struct Context {
|
||||||
|
mut:
|
||||||
static_files map[string]string
|
static_files map[string]string
|
||||||
static_mime_types map[string]string
|
static_mime_types map[string]string
|
||||||
pub:
|
pub:
|
||||||
req http.Request
|
req http.Request
|
||||||
conn net.Socket
|
conn net.Socket
|
||||||
form map[string]string
|
|
||||||
// TODO Response
|
// TODO Response
|
||||||
pub mut:
|
pub mut:
|
||||||
|
form map[string]string
|
||||||
headers string // response headers
|
headers string // response headers
|
||||||
done bool
|
done bool
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user