Skip to content

Commit

Permalink
Merge branch 'master' into martinskou/master
Browse files Browse the repository at this point in the history
* master:
  flag: add optional value description to string parameters (vlang#22024)
  fmt: fix alignment of struct init fields (vlang#22025)
  cgen: fix selector with interface var (vlang#22006)
  checker: add a deprecation warning for `const ()` groups (an error after 2025-01-01) (vlang#22019)
  v2: fix a notice for `v cmd/v2/v2.v`
  tools: reduce number of os/fs calls done by `v where`; ignore tests/ folders
  tools: make `v where` ignore .git/ folders (they contain binary files); let `-dir .` work recursively, so that `-dir vlib` works
  fmt: cleanup fields alignment (vlang#22018)
  veb: change example description, to avoid repetitive wording (ease debugging of issue#22017)
  all: allow multi return as fn argument (vlang#21991)
  examples: change // to blank line in 2048.v too, after 793b66d
  all: change single blank comment to blank line (vlang#22016)
  scanner: guard against scanner panic, discovered by fuzzing in PR#22016
  time: `d`,`c`,`dd`,`ddd`,`dddd` pattern support for parse_format() (vlang#22003)
  ast, parser, fmt: cleanup fmt of struct fields with empty line (vlang#22014)
  ast, parser, fmt: fix fmt of enum fields with empty line (vlang#22015)
  • Loading branch information
spytheman committed Aug 11, 2024
2 parents 582ff38 + 20a525a commit 313eb37
Show file tree
Hide file tree
Showing 825 changed files with 19,867 additions and 19,593 deletions.
14 changes: 7 additions & 7 deletions cmd/tools/gen_vc.v
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ fn new_gen_vc(flag_options FlagOptions) &GenVC {
}
return &GenVC{
options: flag_options
logger: logger
logger: logger
}
}

Expand Down Expand Up @@ -171,14 +171,14 @@ pub fn (ws &WebhookServer) reset() {
// parse flags to FlagOptions struct
fn parse_flags(mut fp flag.FlagParser) FlagOptions {
return FlagOptions{
serve: fp.bool('serve', 0, false, 'run in webhook server mode')
serve: fp.bool('serve', 0, false, 'run in webhook server mode')
work_dir: fp.string('work-dir', 0, work_dir, 'gen_vc working directory')
purge: fp.bool('purge', 0, false, 'force purge the local repositories')
port: fp.int('port', 0, server_port, 'port for web server to listen on')
log_to: fp.string('log-to', 0, log_to, "log to is 'file' or 'terminal'")
purge: fp.bool('purge', 0, false, 'force purge the local repositories')
port: fp.int('port', 0, server_port, 'port for web server to listen on')
log_to: fp.string('log-to', 0, log_to, "log to is 'file' or 'terminal'")
log_file: fp.string('log-file', 0, log_file, "log file to use when log-to is 'file'")
dry_run: fp.bool('dry-run', 0, dry_run, 'when specified dont push anything to remote repo')
force: fp.bool('force', 0, false, 'force update even if already up to date')
dry_run: fp.bool('dry-run', 0, dry_run, 'when specified dont push anything to remote repo')
force: fp.bool('force', 0, false, 'force update even if already up to date')
}
}

Expand Down
10 changes: 5 additions & 5 deletions cmd/tools/measure/fmt_speed.v
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ fn process_files(files []string) ! {
fn new_parser(path string, comments_mode scanner.CommentsMode, table &ast.Table, pref_ &pref.Preferences) &parser.Parser {
mut p := &parser.Parser{
scanner: scanner.new_scanner_file(path, comments_mode, pref_) or { panic(err) }
table: table
pref: pref_
scope: &ast.Scope{
table: table
pref: pref_
scope: &ast.Scope{
start_pos: 0
parent: table.global_scope
parent: table.global_scope
}
errors: []errors.Error{}
errors: []errors.Error{}
warnings: []errors.Warning{}
}
p.set_path(path)
Expand Down
10 changes: 5 additions & 5 deletions cmd/tools/measure/parser_speed.v
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ fn process_files(files []string) ! {
fn new_parser(path string, comments_mode scanner.CommentsMode, table &ast.Table, pref_ &pref.Preferences) &parser.Parser {
mut p := &parser.Parser{
scanner: scanner.new_scanner_file(path, comments_mode, pref_) or { panic(err) }
table: table
pref: pref_
scope: &ast.Scope{
table: table
pref: pref_
scope: &ast.Scope{
start_pos: 0
parent: table.global_scope
parent: table.global_scope
}
errors: []errors.Error{}
errors: []errors.Error{}
warnings: []errors.Warning{}
}
p.set_path(path)
Expand Down
40 changes: 20 additions & 20 deletions cmd/tools/modules/testing/common.v
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub mut:
failed_cmds shared []string
reporter Reporter = Reporter(NormalReporter{})
hash string // used as part of the name of the temporary directory created for tests, to ease cleanup
//

exec_mode ActionMode = .compile // .compile_and_run only for `v test`
}

Expand All @@ -117,22 +117,22 @@ mut:

fn (mut ts TestSession) append_message(kind MessageKind, msg string, mtc MessageThreadContext) {
ts.nmessages <- LogMessage{
file: mtc.file
file: mtc.file
flow_id: mtc.flow_id
message: msg
kind: kind
when: time.now()
kind: kind
when: time.now()
}
}

fn (mut ts TestSession) append_message_with_duration(kind MessageKind, msg string, d time.Duration, mtc MessageThreadContext) {
ts.nmessages <- LogMessage{
file: mtc.file
file: mtc.file
flow_id: mtc.flow_id
message: msg
kind: kind
when: time.now()
took: d
kind: kind
when: time.now()
took: d
}
}

Expand Down Expand Up @@ -310,16 +310,16 @@ pub fn new_test_session(_vargs string, will_compile bool) TestSession {
os.setenv('VCOLORS', 'always', true)
}
mut ts := TestSession{
vexe: vexe
vroot: vroot
skip_files: skip_files
fail_fast: testing.fail_fast
show_stats: '-stats' in vargs.split(' ')
show_asserts: '-show-asserts' in vargs.split(' ')
vargs: vargs
vtmp_dir: new_vtmp_dir
hash: hash
silent_mode: _vargs.contains('-silent')
vexe: vexe
vroot: vroot
skip_files: skip_files
fail_fast: testing.fail_fast
show_stats: '-stats' in vargs.split(' ')
show_asserts: '-show-asserts' in vargs.split(' ')
vargs: vargs
vtmp_dir: new_vtmp_dir
hash: hash
silent_mode: _vargs.contains('-silent')
progress_mode: _vargs.contains('-progress')
}
ts.handle_test_runner_option()
Expand Down Expand Up @@ -368,7 +368,7 @@ pub fn (mut ts TestSession) test() {
if current_wd == os.wd_at_startup && current_wd == ts.vroot {
ts.root_relative = true
}
//

ts.init()
mut remaining_files := []string{}
for dot_relative_file in ts.files {
Expand Down Expand Up @@ -493,7 +493,7 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
}
file := os.real_path(relative_file)
mtc := MessageThreadContext{
file: file
file: file
flow_id: thread_id.str()
}
normalised_relative_file := relative_file.replace('\\', '/')
Expand Down
6 changes: 3 additions & 3 deletions cmd/tools/modules/testing/output.v
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ pub enum MessageKind {
compile_end // sent right after *each* _test.v file compilation, the message contains the output of that compilation
cmd_begin // sent right before *each* _test.v file execution, the resulting status is not known yet, but the _test.v file itself is
cmd_end // sent right after *each* _test.v file execution, the message contains the output of that execution
//

ok // success of a _test.v file
fail // failed _test.v file, one or more assertions failed
skip // the _test.v file was skipped for some reason
info // a generic information message, detailing the actions of the `v test` program (some tests could be repeated for example, and the details are sent with an .info status)
//

cannot_compile // when the _test.v file compiled with errors
//

sentinel // send just once after all executions are done; it signals that the reporting/printing thread should stop the loop and exit
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/tools/modules/vgit/vgit.v
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub fn prepare_vc_source(vcdir string, cdir string, commit string) (string, stri
check_v_commit_timestamp_before_self_rebuilding(v_timestamp)
scripting.chdir(vcdir)
scripting.run('git checkout --quiet master')
//

mut vccommit := ''
mut partial_hash := v_commithash[0..7]
if '5b7a1e8'.starts_with(partial_hash) {
Expand Down
16 changes: 8 additions & 8 deletions cmd/tools/oldv.v
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ mut:

fn (mut c Context) compile_oldv_if_needed() {
c.vgcontext = vgit.VGitContext{
workdir: c.vgo.workdir
v_repo_url: c.vgo.v_repo_url
vc_repo_url: c.vgo.vc_repo_url
cc: c.cc
commit_v: c.commit_v
path_v: c.path_v
path_vc: c.path_vc
workdir: c.vgo.workdir
v_repo_url: c.vgo.v_repo_url
vc_repo_url: c.vgo.vc_repo_url
cc: c.cc
commit_v: c.commit_v
path_v: c.path_v
path_vc: c.path_vc
make_fresh_tcc: c.fresh_tcc
show_vccommit: c.show_vccommit
show_vccommit: c.show_vccommit
}
c.vgcontext.compile_oldv_if_needed()
c.commit_v_hash = c.vgcontext.commit_v__hash
Expand Down
16 changes: 8 additions & 8 deletions cmd/tools/performance_compare.v
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ mut:

fn new_context() Context {
return Context{
cwd: os.getwd()
cwd: os.getwd()
commit_after: 'master'
warmups: 4
warmups: 4
}
}

Expand Down Expand Up @@ -80,12 +80,12 @@ fn (c &Context) prepare_v(cdir string, commit string) {
cc = 'cc'
}
mut vgit_context := vgit.VGitContext{
cc: cc
commit_v: commit
path_v: cdir
path_vc: c.vc
workdir: c.vgo.workdir
v_repo_url: c.vgo.v_repo_url
cc: cc
commit_v: commit
path_v: cdir
path_vc: c.vc
workdir: c.vgo.workdir
v_repo_url: c.vgo.v_repo_url
vc_repo_url: c.vgo.vc_repo_url
}
vgit_context.compile_oldv_if_needed()
Expand Down
6 changes: 3 additions & 3 deletions cmd/tools/vast/vast.v
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ fn json(file string) string {
pref_.fill_with_defaults()
pref_.enable_globals = true
pref_.is_fmt = true
//

mut t := Tree{
root: new_object()
root: new_object()
table: ast.new_table()
pref: pref_
pref: pref_
}
// parse file with comment
ast_file := parser.parse_file(file, mut t.table, .parse_comments, t.pref)
Expand Down
8 changes: 4 additions & 4 deletions cmd/tools/vbump.v
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ Try ${tool_name} -h for more help...')

options := Options{
show_help: fp.bool('help', `h`, false, 'Show this help text.')
patch: fp.bool('patch', `p`, false, 'Bump the patch version.')
minor: fp.bool('minor', `n`, false, 'Bump the minor version.')
major: fp.bool('major', `m`, false, 'Bump the major version.')
skip: fp.string('skip', `s`, '', 'Skip lines matching this substring.').trim_space()
patch: fp.bool('patch', `p`, false, 'Bump the patch version.')
minor: fp.bool('minor', `n`, false, 'Bump the minor version.')
major: fp.bool('major', `m`, false, 'Bump the major version.')
skip: fp.string('skip', `s`, '', 'Skip lines matching this substring.').trim_space()
}

remaining := fp.finalize() or {
Expand Down
18 changes: 9 additions & 9 deletions cmd/tools/vbump_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct BumpTestCase {
const test_cases = [
BumpTestCase{
file_name: 'v.mod'
contents: "Module {
contents: "Module {
name: 'Sample'
description: 'Sample project'
version: '1.2.6'
Expand All @@ -32,28 +32,28 @@ const test_cases = [
}
"
line: 3
line: 3
expected_patch: " version: '1.2.7'"
expected_minor: " version: '1.3.0'"
expected_major: " version: '2.0.0'"
},
BumpTestCase{
file_name: 'random_versions.vv'
contents: "
contents: "
1.1.2
1.2.5
3.21.73
version = '1.5.1'
"
line: 4
line: 4
expected_patch: "version = '1.5.2'"
expected_minor: "version = '1.6.0'"
expected_major: "version = '2.0.0'"
},
BumpTestCase{
file_name: 'sample_tool.v'
contents: "// Module comment and copyright information
contents: "// Module comment and copyright information
import os
import flag
Expand All @@ -64,7 +64,7 @@ fn main() {
// stuff
}
"
line: 5
line: 5
expected_patch: "const tool_version = '0.1.34'"
expected_minor: "const tool_version = '0.2.0'"
expected_major: "const tool_version = '1.0.0'"
Expand Down Expand Up @@ -111,7 +111,7 @@ struct SkipTestCase {
const skip_test_cases = [
SkipTestCase{
file_name: 'CITATION.cff'
contents: 'abstract: A sample CLI tool made in V that prints geometric shapes to the screen.
contents: 'abstract: A sample CLI tool made in V that prints geometric shapes to the screen.
authors:
- alias: hungrybluedev
family-names: Haldar
Expand All @@ -125,8 +125,8 @@ title: geo
url: https://github.com/hungrybluedev/geo
version: 0.2.4
'
line: 12
skip: 'cff-version'
line: 12
skip: 'cff-version'
expected_patch: 'version: 0.2.5'
expected_minor: 'version: 0.3.0'
expected_major: 'version: 1.0.0'
Expand Down
18 changes: 9 additions & 9 deletions cmd/tools/vcheck-md.v
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ pub mut:

fn (v1 CheckResult) + (v2 CheckResult) CheckResult {
return CheckResult{
files: v1.files + v2.files
files: v1.files + v2.files
warnings: v1.warnings + v2.warnings
errors: v1.errors + v2.errors
oks: v1.oks + v2.oks
errors: v1.errors + v2.errors
oks: v1.oks + v2.oks
}
}

Expand Down Expand Up @@ -77,8 +77,8 @@ fn main() {
}
mut mdfile := MDFile{
skip_line_length_check: skip_line_length_check
path: file_path
lines: lines
path: file_path
lines: lines
}
res += mdfile.check()
}
Expand Down Expand Up @@ -243,7 +243,7 @@ fn (mut f MDFile) parse_line(lnumber int, line string) {
command += ' ${default_command}'
}
f.current = VCodeExample{
sline: lnumber
sline: lnumber
command: command
}
}
Expand Down Expand Up @@ -305,7 +305,7 @@ fn (mut ad AnchorData) add_links(line_number int, line string) {
re.match_string(elem)
link := re.get_group_by_name(elem, 'link')
ad.links[link] << AnchorLink{
line: line_number
line: line_number
label: re.get_group_by_name(elem, 'label')
}
}
Expand All @@ -317,7 +317,7 @@ fn (mut ad AnchorData) add_link_targets(line_number int, line string) {
headline := line.substr(headline_start_pos + 1, line.len)
link := create_ref_link(headline)
ad.anchors[link] << Headline{
line: line_number
line: line_number
label: headline
level: headline_start_pos
}
Expand Down Expand Up @@ -634,7 +634,7 @@ fn (mut f MDFile) check_examples() CheckResult {
}
return CheckResult{
errors: errors
oks: oks
oks: oks
}
}

Expand Down
Loading

0 comments on commit 313eb37

Please sign in to comment.