diff --git a/vlib/builtin/string.v b/vlib/builtin/string.v index a849541fbe..0d081e521e 100644 --- a/vlib/builtin/string.v +++ b/vlib/builtin/string.v @@ -550,7 +550,7 @@ pub fn (s string) index_old(p string) int { mut i := 0 for i < s.len { mut j := 0 - for j < p.len && s[i + j] == p[j] { + for j < p.len && s.str[i + j] == p.str[j] { j++ } if j == p.len { @@ -568,7 +568,7 @@ pub fn (s string) index(p string) ?int { mut i := 0 for i < s.len { mut j := 0 - for j < p.len && s[i + j] == p[j] { + for j < p.len && s.str[i + j] == p.str[j] { j++ } if j == p.len { @@ -587,20 +587,20 @@ fn (s string) index_kmp(p string) int { mut prefix := [0].repeat(p.len) mut j := 0 for i := 1; i < p.len; i++ { - for p[j] != p[i] && j > 0 { + for p.str[j] != p.str[i] && j > 0 { j = prefix[j - 1] } - if p[j] == p[i] { + if p.str[j] == p.str[i] { j++ } prefix[i] = j } j = 0 for i in 0..s.len { - for p[j] != s[i] && j > 0 { + for p.str[j] != s.str[i] && j > 0 { j = prefix[j - 1] } - if p[j] == s[i] { + if p.str[j] == s.str[i] { j++ } if j == p.len { @@ -627,7 +627,7 @@ pub fn (s string) last_index(p string) ?int { mut i := s.len - p.len for i >= 0 { mut j := 0 - for j < p.len && s[i + j] == p[j] { + for j < p.len && s.str[i + j] == p.str[j] { j++ } if j == p.len { @@ -653,7 +653,7 @@ pub fn (s string) index_after(p string, start int) int { for i < s.len { mut j := 0 mut ii := i - for j < p.len && s[ii] == p[j] { + for j < p.len && s.str[ii] == p.str[j] { j++ ii++ } @@ -667,7 +667,7 @@ pub fn (s string) index_after(p string, start int) int { pub fn (s string) index_byte(c byte) int { for i in 0..s.len { - if s[i] == c { + if s.str[i] == c { return i } } @@ -676,7 +676,7 @@ pub fn (s string) index_byte(c byte) int { pub fn (s string) last_index_byte(c byte) int { for i := s.len - 1; i >= 0; i-- { - if s[i] == c { + if s.str[i] == c { return i } } @@ -716,7 +716,7 @@ pub fn (s string) starts_with(p string) bool { return false } for i in 0..p.len { - if s[i] != p[i] { + if s.str[i] != p.str[i] { return false } } diff --git a/vlib/compiler/gen_c.v b/vlib/compiler/gen_c.v index 78b8f70131..40496c61f2 100644 --- a/vlib/compiler/gen_c.v +++ b/vlib/compiler/gen_c.v @@ -565,7 +565,7 @@ fn (p mut Parser) cast(typ string) { p.expected_type = typ expr_typ := p.bool_expression() // Do not allow `int(my_int)` - if expr_typ == typ && typ != 'u64' { + if expr_typ == typ { p.warn('casting `$typ` to `$expr_typ` is not needed') } // `face := FT_Face(cobj)` => `FT_Face face = *((FT_Face*)cobj);` diff --git a/vlib/compiler/main.v b/vlib/compiler/main.v index 13c1d201c5..d5c9af182b 100644 --- a/vlib/compiler/main.v +++ b/vlib/compiler/main.v @@ -546,7 +546,7 @@ pub fn (v &V) v_files_from_dir(dir string) []string { verror("$dir doesn't exist") } else if !os.is_dir(dir) { - verror("$dir isn't a directory") + verror("$dir isn't a directory!") } mut files := os.ls(dir)or{ panic(err) diff --git a/vlib/compiler/modules.v b/vlib/compiler/modules.v index 555188b5fb..92cd22ae9a 100644 --- a/vlib/compiler/modules.v +++ b/vlib/compiler/modules.v @@ -170,10 +170,15 @@ fn (v mut V) set_module_lookup_paths() { v.module_lookup_paths << os.base_dir(v.compiled_dir) // pdir of _test.v } v.module_lookup_paths << v.compiled_dir + x := os.join_path(v.compiled_dir, 'modules') + if v.pref.verbosity.is_higher_or_equal(.level_two) { + println('x: "$x"') + } v.module_lookup_paths << os.join_path(v.compiled_dir, 'modules') v.module_lookup_paths << v.pref.lookup_path if v.pref.verbosity.is_higher_or_equal(.level_two) { - v.log('v.module_lookup_paths: $v.module_lookup_paths') + v.log('v.module_lookup_paths') //: $v.module_lookup_paths') + println(v.module_lookup_paths) } } diff --git a/vlib/os/os.v b/vlib/os/os.v index 03ff9a9bd0..200d92795b 100644 --- a/vlib/os/os.v +++ b/vlib/os/os.v @@ -935,7 +935,8 @@ pub fn is_dir(path string) bool { return false } // ref: https://code.woboq.org/gcc/include/sys/stat.h.html - return int(statbuf.st_mode) & S_IFMT == S_IFDIR + val:= int(statbuf.st_mode) & S_IFMT + return val == S_IFDIR } } diff --git a/vlib/v/builder/builder.v b/vlib/v/builder/builder.v index 5e952ef740..9aa5d79626 100644 --- a/vlib/v/builder/builder.v +++ b/vlib/v/builder/builder.v @@ -132,7 +132,7 @@ pub fn (b &Builder) v_files_from_dir(dir string) []string { verror("$dir doesn't exist") } else if !os.is_dir(dir) { - verror("$dir isn't a directory") + verror("$dir isn't a directory!") } mut files := os.ls(dir) or { panic(err) @@ -206,7 +206,7 @@ fn module_path(mod string) string { pub fn (b &Builder) find_module_path(mod string) ?string { mod_path := module_path(mod) for search_path in b.module_search_paths { - try_path := os.join_path(search_path, mod_path) + try_path := os.join_path(search_path,mod_path) if b.pref.verbosity.is_higher_or_equal(.level_three) { println(' >> trying to find $mod in $try_path ..') }