diff --git a/vlib/time/README.md b/vlib/time/README.md index fca9966a48..37fbed609f 100644 --- a/vlib/time/README.md +++ b/vlib/time/README.md @@ -32,7 +32,6 @@ const time_to_test = time.Time{ minute: 23 second: 42 nanosecond: 123456789 - unix: 332198622 } println(time_to_test.format()) diff --git a/vlib/time/time_test.v b/vlib/time/time_test.v index 54f928eafb..c5457d5671 100644 --- a/vlib/time/time_test.v +++ b/vlib/time/time_test.v @@ -219,7 +219,6 @@ fn test_weekday_str() { hour: 0 minute: 0 second: 0 - // unix: 0 } assert t.weekday_str() == name } diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index 40f983ae9a..f23280badc 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -1631,13 +1631,7 @@ fn (mut c Checker) selector_expr(mut node ast.SelectorExpr) ast.Type { is_used_outside := sym.mod != c.mod if is_used_outside && !field.is_pub && sym.language != .c { unwrapped_sym := c.table.sym(c.unwrap_generic(typ)) - if unwrapped_sym.kind == .struct_ && unwrapped_sym.name == 'time.Time' { - c.add_error_detail('this will become an error after 2024-05-31') - c.warn('field `${unwrapped_sym.name}.${field_name}` is not public, use `${node.expr}.unix()` instead', - node.pos) - } else { - c.error('field `${unwrapped_sym.name}.${field_name}` is not public', node.pos) - } + c.error('field `${unwrapped_sym.name}.${field_name}` is not public', node.pos) } field_sym := c.table.sym(field.typ) if field.is_deprecated && is_used_outside { diff --git a/vlib/v/checker/struct.v b/vlib/v/checker/struct.v index 6b17e8ae03..9327da75b2 100644 --- a/vlib/v/checker/struct.v +++ b/vlib/v/checker/struct.v @@ -758,13 +758,9 @@ or use an explicit `unsafe{ a[..] }`, if you do not want a copy of the slice.', } else { parts.last() } - if !c.inside_unsafe { - c.add_error_detail('this will become an error after 2024-05-31') - c.warn('initalizing private field `${field.name}` of `${mod_type}`', - init_field.pos) - // c.error('cannot access private field `${field.name}` on `${mod_type}`', init_field.pos) - break - } + c.error('cannot access private field `${field.name}` on `${mod_type}`', + init_field.pos) + break } } } diff --git a/vlib/v/checker/tests/struct_field_private_err.out b/vlib/v/checker/tests/struct_field_private_err.out index c9a4476837..286a91df2f 100644 --- a/vlib/v/checker/tests/struct_field_private_err.out +++ b/vlib/v/checker/tests/struct_field_private_err.out @@ -1,14 +1,12 @@ -vlib/v/checker/tests/struct_field_private_err.vv:8:2: warning: initalizing private field `x` of `amod.Bcg` +vlib/v/checker/tests/struct_field_private_err.vv:8:2: error: cannot access private field `x` on `amod.Bcg` 6 | 7 | _ := amod.Bcg{ 8 | x: 0 | ~~~~ 9 | } 10 | -Details: this will become an error after 2024-05-31 -vlib/v/checker/tests/struct_field_private_err.vv:11:10: warning: initalizing private field `bar` of `amod.FooParams` +vlib/v/checker/tests/struct_field_private_err.vv:11:10: error: cannot access private field `bar` on `amod.FooParams` 9 | } 10 | 11 | amod.foo(bar: 'bar') | ~~~~~~~~~~ -Details: this will become an error after 2024-05-31 diff --git a/vlib/vweb/assets/assets.v b/vlib/vweb/assets/assets.v index 7f180aaad5..54ba96d62d 100644 --- a/vlib/vweb/assets/assets.v +++ b/vlib/vweb/assets/assets.v @@ -3,7 +3,6 @@ module assets // this module provides an AssetManager for combining // and caching javascript & css. import os -import time import crypto.md5 const unknown_asset_type_error = 'vweb.assets: unknown asset type' @@ -21,7 +20,7 @@ pub mut: struct Asset { file_path string - last_modified time.Time + last_modified i64 mut: include_name string } @@ -131,8 +130,8 @@ fn (am AssetManager) get_cache_key(asset_type string) string { mut latest_modified := i64(0) for asset in am.get_assets(asset_type) { files_salt += asset.file_path - if asset.last_modified.unix() > latest_modified { - latest_modified = asset.last_modified.unix() + if asset.last_modified > latest_modified { + latest_modified = asset.last_modified } } hash := md5.sum(files_salt.bytes()).hex() @@ -182,11 +181,7 @@ pub fn (mut am AssetManager) add(asset_type string, file string) bool { } asset := Asset{ file_path: file - last_modified: unsafe { - time.Time{ - unix: os.file_last_mod_unix(file) - } - } + last_modified: os.file_last_mod_unix(file) } if asset_type == 'css' { am.css << asset diff --git a/vlib/x/json2/count_test.v b/vlib/x/json2/count_test.v index 4e8bd34ade..f7b1f2c7ec 100644 --- a/vlib/x/json2/count_test.v +++ b/vlib/x/json2/count_test.v @@ -2,15 +2,14 @@ module json2 import time -const fixed_time = time.Time{ +const fixed_time = time.new( year: 2022 month: 3 day: 11 hour: 13 minute: 54 second: 25 - // unix: 1647006865 -} +) type StringAlias = string type BoolAlias = bool diff --git a/vlib/x/json2/decoder2/tests/decode_struct_test.v b/vlib/x/json2/decoder2/tests/decode_struct_test.v index 0b6b8cd970..b2f0c1119b 100644 --- a/vlib/x/json2/decoder2/tests/decode_struct_test.v +++ b/vlib/x/json2/decoder2/tests/decode_struct_test.v @@ -1,15 +1,14 @@ import x.json2.decoder2 as json import time -const fixed_time = time.Time{ +const fixed_time = time.new( year: 2022 month: 3 day: 11 hour: 13 minute: 54 second: 25 - // unix: 1647006865 -} +) type StringAlias = string type BoolAlias = bool diff --git a/vlib/x/json2/tests/decode_struct_test.v b/vlib/x/json2/tests/decode_struct_test.v index f4fb37fc79..c02c3af12b 100644 --- a/vlib/x/json2/tests/decode_struct_test.v +++ b/vlib/x/json2/tests/decode_struct_test.v @@ -1,15 +1,14 @@ import x.json2 as json import time -const fixed_time = time.Time{ +const fixed_time = time.new( year: 2022 month: 3 day: 11 hour: 13 minute: 54 second: 25 - // unix: 1647006865 -} +) type StringAlias = string type BoolAlias = bool diff --git a/vlib/x/json2/tests/encode_struct_test.v b/vlib/x/json2/tests/encode_struct_test.v index 5cef9efb96..08b881e6ca 100644 --- a/vlib/x/json2/tests/encode_struct_test.v +++ b/vlib/x/json2/tests/encode_struct_test.v @@ -1,15 +1,14 @@ import x.json2 as json import time -const fixed_time = time.Time{ +const fixed_time = time.new( year: 2022 month: 3 day: 11 hour: 13 minute: 54 second: 25 - // unix: 1647006865 -} +) type StringAlias = string type BoolAlias = bool diff --git a/vlib/x/json2/tests/encode_struct_todo_test.vv b/vlib/x/json2/tests/encode_struct_todo_test.vv index 8dcd98f621..4fe925d799 100644 --- a/vlib/x/json2/tests/encode_struct_todo_test.vv +++ b/vlib/x/json2/tests/encode_struct_todo_test.vv @@ -1,15 +1,14 @@ import x.json2 as json import time -const fixed_time = time.Time{ +const fixed_time = time.new( year: 2022 month: 3 day: 11 hour: 13 minute: 54 second: 25 - // unix: 1647006865 -} +) type StringAlias = string type BoolAlias = bool