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
|
||||
name: 'T'
|
||||
mod: 'builtin'
|
||||
is_public: true
|
||||
})
|
||||
t.register_type_symbol({
|
||||
kind: .any_float
|
||||
@ -610,7 +611,7 @@ pub mut:
|
||||
|
||||
pub struct Enum {
|
||||
pub:
|
||||
vals []string
|
||||
vals []string
|
||||
is_flag bool
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,21 @@ fn test_foo() {
|
||||
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 {
|
||||
mut r := []U{}
|
@ -36,14 +36,15 @@ pub const (
|
||||
)
|
||||
|
||||
pub struct Context {
|
||||
mut:
|
||||
static_files map[string]string
|
||||
static_mime_types map[string]string
|
||||
pub:
|
||||
req http.Request
|
||||
conn net.Socket
|
||||
form map[string]string
|
||||
// TODO Response
|
||||
pub mut:
|
||||
form map[string]string
|
||||
headers string // response headers
|
||||
done bool
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user