Skip to content

match + or #17201

@trufae

Description

@trufae

Describe the bug

The following snippet is valid, but it is a bit confusing to read because it have the }{ construction which looks weird to me.

fn read_bool() !bool {
	return true
}

fn main() {
	// valid syntax, but looks ugly because of "} {"
	match read_bool() or {
	} {
		true {}
	}
	/*
	// invalid syntax. shold be valid?
	match read_bool() {
		true {}
	} or {}
	*/
}

Expected Behavior

not sure what would be expected, but having }{ looks like an antipattern to me

Current Behavior

see the code comments above

Reproduction Steps

v run bug1.v

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.3.3 e70848a

Environment details (OS name and version, etc.)

OS: linux, Linux version 5.15.90-0-lts (buildozer@build-3-17-x86_64) (gcc (Alpine 12.2.1_git20220924-r4) 12.2.1 20220924, GNU ld (GNU Binutils) 2.39) #1-Alpine SMP Wed, 25 Jan 2023 08:18:30 +0000
Processor: 4 cpus, 64bit, little endian, Intel(R) Celeron(R) N4120 CPU @ 1.10GHz
CC version: cc (Alpine 12.2.1_git20220924-r4) 12.2.1 20220924

getwd: /home/pancake/prg/v-sax
vmodules: /home/pancake/.vmodules
vroot: /home/pancake/prg/v
vexe: /home/pancake/prg/v/v
vexe mtime: 2023-02-01 17:02:38
is vroot writable: true
is vmodules writable: true
V full version: V 0.3.3 e70848a

Git version: git version 2.38.3
Git vroot status: 0.3.3-20-g90ae3c82 (2 commit(s) behind V master)
.git/config present: true
thirdparty/tcc status: thirdparty-linuxmusl-amd64 6b2bc80

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugThis tag is applied to issues which reports bugs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions