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

range over maps requires with clause unconditionally #808

Open
gottschali opened this issue Dec 16, 2024 · 0 comments
Open

range over maps requires with clause unconditionally #808

gottschali opened this issue Dec 16, 2024 · 0 comments

Comments

@gottschali
Copy link

For range loops over maps, one has to add with visited even if visited is not used.
Otherwise, we get an error "Loop invariant might not be established".

// @ requires acc(m)
func mapRange(m map[int]int) {
	//@ invariant acc(m)
	for k, v := range m {}
}

This is inconsistent with slices where it is not mandatory.

// @ requires acc(s)
func sliceRange(s []int) {
	//@ invariant acc(s)
	for i, e := range s {}
}
@jcp19 jcp19 changed the title Map Range mandatory with range over maps requires with clause inconditionally Dec 16, 2024
@jcp19 jcp19 changed the title range over maps requires with clause inconditionally range over maps requires with clause unconditionally Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant