From f2b73fe3ca076da57a8b9bb498c8399404a2e9c2 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Tue, 23 Mar 2021 13:27:26 +0200 Subject: [PATCH] Revert "builder: create the binary in the current directory if -o is not provided" This reverts commit 9ae64e7fce258aa6a8338566471a0e164a03e238. --- vlib/v/checker/tests/in_mismatch_type.out | 6 +++--- vlib/v/pref/default.v | 6 ++---- vlib/v/tests/valgrind/1.strings_and_arrays.v | 13 ------------- 3 files changed, 5 insertions(+), 20 deletions(-) diff --git a/vlib/v/checker/tests/in_mismatch_type.out b/vlib/v/checker/tests/in_mismatch_type.out index d6e9e12d86..70a3d94d33 100644 --- a/vlib/v/checker/tests/in_mismatch_type.out +++ b/vlib/v/checker/tests/in_mismatch_type.out @@ -12,14 +12,14 @@ vlib/v/checker/tests/in_mismatch_type.vv:13:5: error: left operand to `in` does | ~~~~~~ 14 | println('yeah') 15 | } -vlib/v/checker/tests/in_mismatch_type.vv:16:5: error: use `str.contains(substr)` instead of `substr in str` +vlib/v/checker/tests/in_mismatch_type.vv:16:5: error: left operand to `in` does not match: expected `string`, not `int literal` 14 | println('yeah') 15 | } 16 | if 3 in s { | ~~~~~~ 17 | println('dope') 18 | } -vlib/v/checker/tests/in_mismatch_type.vv:19:5: error: use `str.contains(substr)` instead of `substr in str` +vlib/v/checker/tests/in_mismatch_type.vv:19:5: error: left operand to `in` does not match: expected `string`, not `rune` 17 | println('dope') 18 | } 19 | if `a` in s { @@ -70,7 +70,7 @@ vlib/v/checker/tests/in_mismatch_type.vv:37:5: error: left operand to `!in` does 39 | } vlib/v/checker/tests/in_mismatch_type.vv:41:5: error: left operand to `!in` does not match the map key type: expected `string`, not `int literal` 39 | } - 40 | + 40 | 41 | if 5 !in m { | ~~~~~~~ 42 | println('yay') diff --git a/vlib/v/pref/default.v b/vlib/v/pref/default.v index ba85fec395..d86fc02e29 100644 --- a/vlib/v/pref/default.v +++ b/vlib/v/pref/default.v @@ -46,10 +46,8 @@ pub fn (mut p Preferences) fill_with_defaults() { // The file name is just `.v` or `.vsh` or `.*` base = filename } - // target_dir := if os.is_dir(rpath) { rpath } else { os.dir(rpath) } - // If no "-o" was supplied, create the binary in the current - // directory. This is the behavior of Go, Clang, GCC, etc. - p.out_name = os.join_path(os.getwd(), base) + target_dir := if os.is_dir(rpath) { rpath } else { os.dir(rpath) } + p.out_name = os.join_path(target_dir, base) if rpath == '$p.vroot/cmd/v' && os.is_dir('vlib/compiler') { // Building V? Use v2, since we can't overwrite a running // executable on Windows + the precompiled V is more diff --git a/vlib/v/tests/valgrind/1.strings_and_arrays.v b/vlib/v/tests/valgrind/1.strings_and_arrays.v index 84c94ecca5..10978b849a 100644 --- a/vlib/v/tests/valgrind/1.strings_and_arrays.v +++ b/vlib/v/tests/valgrind/1.strings_and_arrays.v @@ -348,18 +348,6 @@ fn return_sb_str() string { return sb.str() // sb should be freed, but only after .str() is called } -fn parse_header0(s string) ?string { - if !s.contains(':') { - return error('missing colon in header') - } - words := s.split_nth(':', 2) - return words[0] -} - -fn advanced_optionals() { - s := parse_header0('foo:bar') or { return } -} - fn main() { println('start') simple() @@ -386,7 +374,6 @@ fn main() { s2 := return_sb_str() // free_map() // loop_map() - // advanced_optionals() free_array_except_returned_element() println('end') }