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

builtin identifiers cannot be shadowed #1091

Closed
thehowl opened this issue Sep 1, 2023 · 0 comments · Fixed by #1711
Closed

builtin identifiers cannot be shadowed #1091

thehowl opened this issue Sep 1, 2023 · 0 comments · Fixed by #1711
Assignees
Labels
🐞 bug Something isn't working 📦 🤖 gnovm Issues or PRs gnovm related

Comments

@thehowl
Copy link
Member

thehowl commented Sep 1, 2023

package main

func main() {
	rune := rune('x')
	println(rune)
}
$ gno run x.gno
--- preprocess stack ---
stack 2: func main() { rune<VPBlock(1,0)> := rune<VPUverse(0)>('x'); println<VPUverse(0)>(rune<VPUverse(0)>) }
stack 1: file{ package main; func main() { rune<VPBlock(1,0)> := rune<VPUverse(0)>('x'); println<VPUverse(0)>(rune<VPUverse(0)>) } }
stack 0: package(main)
------------------------
panic: expected block value path type [recovered]
        panic: main/x.gno:4: expected block value path type

goroutine 1 [running]:
github.com/gnolang/gno/gnovm/pkg/gnolang.Preprocess.func2.1()
        /home/howl/oc/gno/gnovm/pkg/gnolang/preprocess.go:173 +0x46d
panic({0xbf0b00, 0xf4bfc0})
        /usr/lib/go/src/runtime/panic.go:890 +0x263
github.com/gnolang/gno/gnovm/pkg/gnolang.fillNameExprPath({0xf62ed8, 0xc000581800}, 0xc0001716d0, 0x4?)
        /home/howl/oc/gno/gnovm/pkg/gnolang/preprocess.go:3218 +0x2c7

(note: one can even technically "shadow" in a global package's scope, like in this example)

@thehowl thehowl added 🐞 bug Something isn't working 📦 🤖 gnovm Issues or PRs gnovm related labels Sep 1, 2023
@moul moul moved this to 🏆 Needed for Launch in 🚀 The Launch [DEPRECATED] Sep 5, 2023
@moul moul added this to the 🚀 main.gno.land milestone Sep 6, 2023
@deelawn deelawn self-assigned this Dec 21, 2023
leohhhn added a commit that referenced this issue Mar 20, 2024
closes #1091 

This is a simple documentation update to clarify that gno does not
support shadowing native types. I've discussed with @jaekwon and this is
not something we want to support.

---------

Co-authored-by: Leon Hudak <33522493+leohhhn@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working 📦 🤖 gnovm Issues or PRs gnovm related
Projects
Status: 🚀 Needed for Launch
Development

Successfully merging a pull request may close this issue.

3 participants