diff --git a/vlib/builtin/builtin.v b/vlib/builtin/builtin.v index 501d7eecb1..21e68ec9bf 100644 --- a/vlib/builtin/builtin.v +++ b/vlib/builtin/builtin.v @@ -123,7 +123,7 @@ pub: typ int } -pub enum AttributeKind { +enum AttributeKind { plain // [name] string // ['name'] number // [123] diff --git a/vlib/net/tcp.v b/vlib/net/tcp.v index 39e61fe467..8429acceee 100644 --- a/vlib/net/tcp.v +++ b/vlib/net/tcp.v @@ -7,6 +7,7 @@ const ( tcp_default_write_timeout = 30 * time.second ) +[heap] pub struct TcpConn { pub mut: sock TcpSocket diff --git a/vlib/orm/orm_test.v b/vlib/orm/orm_test.v index d33da8ccbf..020fd584b8 100644 --- a/vlib/orm/orm_test.v +++ b/vlib/orm/orm_test.v @@ -126,6 +126,12 @@ fn test_orm_sqlite() { assert users3[0].age == 29 assert users3[1].age == 31 // + missing_user := sql db { + select from User where id == 8777 + } + println('missing_user:') + println(missing_user) // zero struct + // new_user := User{ name: 'New user' age: 30 diff --git a/vlib/sqlite/sqlite_test.v b/vlib/sqlite/sqlite_test.v index e66db08ba8..c0ffa80c10 100644 --- a/vlib/sqlite/sqlite_test.v +++ b/vlib/sqlite/sqlite_test.v @@ -21,6 +21,7 @@ fn test_sqlite() { code = db.exec_none('vacuum') assert code == 101 user := db.exec_one('select * from users where id = 3') or { panic(err) } + println(user) assert user.vals.len == 2 db.close() or { panic(err) } assert !db.is_open diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index 03aa2b3725..c99c5cb484 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -3098,6 +3098,11 @@ pub fn (mut c Checker) enum_decl(decl ast.EnumDecl) { if decl.fields.len == 0 { c.error('enum cannot be empty', decl.pos) } + /* + if decl.is_pub && c.mod == 'builtin' { + c.error('`builtin` module cannot have enums', decl.pos) + } + */ for i, field in decl.fields { if !c.pref.experimental && util.contains_capital(field.name) { // TODO C2V uses hundreds of enums with capitals, remove -experimental check once it's handled diff --git a/vlib/vweb/vweb.v b/vlib/vweb/vweb.v index 6d0b034027..21cb834c04 100644 --- a/vlib/vweb/vweb.v +++ b/vlib/vweb/vweb.v @@ -322,6 +322,7 @@ pub fn run(global_app &T, port int) { } $else { // println('vweb no db') } + request_app.Context = global_app.Context // copy the context ref that contains static files map etc // request_app.Context = Context{ // conn: 0 //} @@ -351,7 +352,7 @@ fn handle_conn(mut conn net.TcpConn, mut app T) { } app.Context = Context{ req: req - conn: unsafe { conn } + conn: conn form: map[string]string{} static_files: app.static_files static_mime_types: app.static_mime_types @@ -385,7 +386,7 @@ fn handle_conn(mut conn net.TcpConn, mut app T) { eprintln('error parsing path: $err') return } - if serve_static(mut app, url) { + if serve_if_static(mut app, url) { // successfully served a static file return } @@ -528,7 +529,8 @@ fn parse_attrs(name string, attrs []string) ?([]http.Method, string) { // check if request is for a static file and serves it // returns true if we served a static file, false otherwise -fn serve_static(mut app T, url urllib.URL) bool { +[manualfree] +fn serve_if_static(mut app T, url urllib.URL) bool { // TODO: handle url parameters properly - for now, ignore them static_file := app.static_files[url.path] mime_type := app.static_mime_types[url.path]