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

all: change optional to result of io (#16075)

This commit is contained in:
yuyi
2022-10-16 14:28:57 +08:00
committed by GitHub
parent 6e46933c55
commit f6844e9766
187 changed files with 1885 additions and 1874 deletions

View File

@@ -1,6 +1,6 @@
vlib/v/checker/tests/array_fancy_sort_err.vv:6:8: error: `.sort()` can only use ident, index or selector as argument,
e.g. `arr.sort(a < b)`, `arr.sort(a.id < b.id)`, `arr.sort(a[0] < b[0])`
4 | text := os.read_file(os.args[0])?
4 | text := os.read_file(os.args[0])!
5 | mut lines := text.split_into_lines()
6 | lines.sort(a.split('/').last() < b.split('/').last())
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -1,7 +1,7 @@
import os
fn main() {
text := os.read_file(os.args[0])?
text := os.read_file(os.args[0])!
mut lines := text.split_into_lines()
lines.sort(a.split('/').last() < b.split('/').last())
println(lines.join('\n'))

View File

@@ -1,7 +1,7 @@
vlib/v/checker/tests/fn_call_arg_mismatch_err_c.vv:13:18: error: `os.chdir(files)?` (no value) used as value in argument 1 to `os.ls`
vlib/v/checker/tests/fn_call_arg_mismatch_err_c.vv:13:18: error: `os.chdir(files)!` (no value) used as value in argument 1 to `os.ls`
11 | println(files)
12 | } else {
13 | println(os.ls(os.chdir(files)?)?)
13 | println(os.ls(os.chdir(files)!)!)
| ~~~~~~~~~~~~~~~~
14 | }
15 | println(files)

View File

@@ -2,15 +2,15 @@ module main
import os
fn list_files() ?[][]string {
mut unchecked_files := os.ls('utilities/modules')?
fn list_files() ![][]string {
mut unchecked_files := os.ls('utilities/modules')!
println(unchecked_files)
for files in unchecked_files {
println(files)
if os.is_file(files) == true {
println(files)
} else {
println(os.ls(os.chdir(files)?)?)
println(os.ls(os.chdir(files)!)!)
}
println(files)
}

View File

@@ -1,4 +1,4 @@
vlib/v/checker/tests/for_in_index_optional.vv:3:18: error: for in: cannot index `?[]string`
vlib/v/checker/tests/for_in_index_optional.vv:3:18: error: for in: cannot index `![]string`
1 | import os
2 | fn main() {
3 | for file in os.ls('.') {

View File

@@ -1,4 +1,4 @@
vlib/v/checker/tests/optional_type_call_err.vv:4:5: error: optional type cannot be called directly
vlib/v/checker/tests/optional_type_call_err.vv:4:5: error: result type cannot be called directly
2 |
3 | fn main() {
4 | os.ls('.').filter(it.ends_with('.v')) or { return }