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

cannot use non-empty(comparable) struct as key of a map #2041

Closed
ltzmaxwell opened this issue May 6, 2024 · 1 comment · Fixed by #2044
Closed

cannot use non-empty(comparable) struct as key of a map #2041

ltzmaxwell opened this issue May 6, 2024 · 1 comment · Fixed by #2044
Assignees

Comments

@ltzmaxwell
Copy link
Contributor

see

package main

type S struct {
	x int
}

func main() {
	m := make(map[S]string)
	m[S{x: 0}] = "test"
	println(m)
}

this compiles in Go but not in Gno, with error msg:
// Error:
// FieldType is a pseudotype with no elements

@omarsy
Copy link
Member

omarsy commented May 6, 2024

I'm looking into it. Maybe I have a PR for that

omarsy added a commit to TERITORI/gno that referenced this issue May 6, 2024
thehowl pushed a commit that referenced this issue May 9, 2024
Closes #2041. Use fieldlist to get field type
<!-- please provide a detailed description of the changes made in this
pull request. -->

<details><summary>Contributors' checklist...</summary>

- [ ] Added new tests, or not needed, or not feasible
- [ ] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [ ] Updated the official documentation or not needed
- [ ] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [ ] Added references to related issues and PRs
- [ ] Provided any useful hints for running manual tests
- [ ] Added new benchmarks to [generated
graphs](https://gnoland.github.io/benchmarks), if any. More info
[here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md).
</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

2 participants