Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v fmt changes eg var[1..2] to var[1...2] #19680

Closed
holder66 opened this issue Oct 27, 2023 · 0 comments · Fixed by #19684
Closed

v fmt changes eg var[1..2] to var[1...2] #19680

holder66 opened this issue Oct 27, 2023 · 0 comments · Fixed by #19684
Assignees
Labels
Bug This tag is applied to issues which reports bugs. Status: Confirmed This bug has been confirmed to be valid by a contributor. Unit: vfmt Bugs/feature requests, that are related to the `vfmt`, the formatter for V.

Comments

@holder66
Copy link

holder66 commented Oct 27, 2023

Describe the bug

Applying v fmt to this v code:

fn ignore_all(source_header []string) []string {
	mut ignore_header := []string{cap: source_header.len}
	for var in source_header {
		ignore_header << match true {
			var.len < 3 { 'i#' + var }
			var[1..2].contains('#') { var }
			else { 'i#' + var }
		}
	}
	return ignore_header
}

changes the var[1..2] to var[1...2]

Reproduction Steps

see above

Expected Behavior

the var[1..2] should not be modified by v fmt

Current Behavior

see above

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.2 b3b68e4, timestamp: 2023-10-27 12:27:54 +0300

Environment details (OS name and version, etc.)

V full version: V 0.4.2 4bc9a8f.b3b68e4
OS: macos, macOS, 14.0, 23A344
Processor: 16 cpus, 64bit, little endian, Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz

getwd: /Users/henryolders/vlang/vukda
vexe: /Users/henryolders/v/v
vexe mtime: 2023-10-27 15:32:52

vroot: OK, value: /Users/henryolders/v
VMODULES: OK, value: /Users/henryolders/.vmodules
VTMP: OK, value: /tmp/v_507

env VFLAGS: "-use-os-system-to-run"

Git version: git version 2.41.0
Git vroot status: weekly.2023.42-65-gb3b68e41-dirty
.git/config present: true

CC version: Apple clang version 15.0.0 (clang-1500.0.40.1)
thirdparty/tcc status: thirdparty-macos-amd64 46662e2

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

@holder66 holder66 added the Bug This tag is applied to issues which reports bugs. label Oct 27, 2023
@ttytm ttytm added the Status: Confirmed This bug has been confirmed to be valid by a contributor. label Oct 28, 2023
@ttytm ttytm added the Unit: vfmt Bugs/feature requests, that are related to the `vfmt`, the formatter for V. label Oct 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs. Status: Confirmed This bug has been confirmed to be valid by a contributor. Unit: vfmt Bugs/feature requests, that are related to the `vfmt`, the formatter for V.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants