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

unexpected type declaration type *gnolang.TypeType when using type alias from a remote package. #2479

Closed
moul opened this issue Jul 2, 2024 · 0 comments · Fixed by #2483
Closed
Assignees
Labels
🐞 bug Something isn't working

Comments

@moul
Copy link
Member

moul commented Jul 2, 2024

Example available here (uncomment): #928 (comment)

panic: unexpected type declaration type *gnolang.TypeType [recovered]
	panic: urequire/urequire.gno:3: unexpected type declaration type *gnolang.TypeType:
--- preprocess stack ---
stack 0: file{ package urequire; import uassert gno.land/p/demo/uassert; type TestingT = uassert<VPBlock(1,0)>.TestingT; func NoError(t uassert<VPUverse(0)>.TestingT, err error<VPUverse(0)>, msgs ...string<VPUverse(0)>) { t<VPUverse(0)>.Helper(); if uassert<VPUverse(0)>.NoError(t<VPUverse(0)>, err<VPUverse(0)>, msgs<VPUverse(0)>...) { return }; t<VPUverse(0)>.FailNow() }; func Error(t uassert<VPUverse(0)>.TestingT, err error<VPUverse(0)>, msgs ...string<VPUverse(0)>) { t<VPUverse(0)>.Helper(); if uassert<VPUverse(0)>.Error(t<VPUverse(0)>, err<VPUverse(0)>, msgs<VPUverse(0)>...) { return }; t<VPUverse(0)>.FailNow() }; func ErrorContains(t uassert<VPUverse(0)>.TestingT, err error<VPUverse(0)>, contains string<VPUverse(0)>, msgs ...string<VPUverse(0)>) { t<VPUverse(0)>.Helper(); if uassert<VPUverse(0)>.ErrorContains(t<VPUverse(0)>, err<VPUverse(0)>, contains<VPUverse(0)>, msgs<VPUverse(0)>...) { return }; t<VPUverse(0)>.FailNow() }; func True(t uassert<VPUverse(0)>.TestingT, value bool<VPUverse(0)>, msgs ...string<VPUverse(0)>) { t<VPUverse(0)>.Helper(); if uassert<VPUverse(0)>.True(t<VPUverse(0)>, value<VPUverse(0)>, msgs<VPUverse(0)>...) { return }; t<VPUverse(0)>.FailNow() }; func False(t uassert<VPUverse(0)>.TestingT, value bool<VPUverse(0)>, msgs ...string<VPUverse(0)>) { t<VPUverse(0)>.Helper(); if uassert<VPUverse(0)>.False(t<VPUverse(0)>, value<VPUverse(0)>, msgs<VPUverse(0)>...) { return }; t<VPUverse(0)>.FailNow() }; func ErrorIs(t uassert<VPUverse(0)>.TestingT, err error<VPUverse(0)>, target error<VPUverse(0)>, msgs ...string<VPUverse(0)>) { t<VPUverse(0)>.Helper(); if uassert<VPUverse(0)>.ErrorIs(t<VPUverse(0)>, err<VPUverse(0)>, target<VPUverse(0)>, msgs<VPUverse(0)>...) { return }; t<VPUverse(0)>.FailNow() }; func PanicsWithMessage(t uassert<VPUverse(0)>.TestingT, msg string<VPUverse(0)>, f func(), msgs ...string<VPUverse(0)>) { t<VPUverse(0)>.Helper(); if uassert<VPUverse(0)>.PanicsWithMessage(t<VPUverse(0)>, msg<VPUverse(0)>, f<VPUverse(0)>, msgs<VPUverse(0)>...) { return }; t<VPUverse(0)>.FailNow() }; func NotPanics(t uassert<VPUverse(0)>.TestingT, f func(), msgs ...string<VPUverse(0)>) { t<VPUverse(0)>.Helper(); if uassert<VPUverse(0)>.NotPanics(t<VPUverse(0)>, f<VPUverse(0)>, msgs<VPUverse(0)>...) { return }; t<VPUverse(0)>.FailNow() }; func Equal(t uassert<VPUverse(0)>.TestingT, expected interface {  }, actual interface {  }, msgs ...string<VPUverse(0)>) { t<VPUverse(0)>.Helper(); if uassert<VPUverse(0)>.Equal(t<VPUverse(0)>, expected<VPUverse(0)>, actual<VPUverse(0)>, msgs<VPUverse(0)>...) { return }; t<VPUverse(0)>.FailNow() }; func Empty(t uassert<VPUverse(0)>.TestingT, obj interface {  }, msgs ...string<VPUverse(0)>) { t<VPUverse(0)>.Helper(); if uassert<VPUverse(0)>.Empty(t<VPUverse(0)>, obj<VPUverse(0)>, msgs<VPUverse(0)>...) { return }; t<VPUverse(0)>.FailNow() } }
------------------------ [recovered]
	panic: urequire/urequire.gno:3: unexpected type declaration type *gnolang.TypeType:
--- preprocess stack ---
stack 0: file{ package urequire; import uassert gno.land/p/demo/uassert; type TestingT = uassert<VPBlock(1,0)>.TestingT; func NoError(t uassert<VPUverse(0)>.TestingT, err error<VPUverse(0)>, msgs ...string<VPUverse(0)>) { t<VPUverse(0)>.Helper(); if uassert<VPUverse(0)>.NoError(t<VPUverse(0)>, err<VPUverse(0)>, msgs<VPUverse(0)>...) { return }; t<VPUverse(0)>.FailNow() }; func Error(t uassert<VPUverse(0)>.TestingT, err error<VPUverse(0)>, msgs ...string<VPUverse(0)>) { t<VPUverse(0)>.Helper(); if uassert<VPUverse(0)>.Error(t<VPUverse(0)>, err<VPUverse(0)>, msgs<VPUverse(0)>...) { return }; t<VPUverse(0)>.FailNow() }; func ErrorContains(t uassert<VPUverse(0)>.TestingT, err error<VPUverse(0)>, contains string<VPUverse(0)>, msgs ...string<VPUverse(0)>) { t<VPUverse(0)>.Helper(); if uassert<VPUverse(0)>.ErrorContains(t<VPUverse(0)>, err<VPUverse(0)>, contains<VPUverse(0)>, msgs<VPUverse(0)>...) { return }; t<VPUverse(0)>.FailNow() }; func True(t uassert<VPUverse(0)>.TestingT, value bool<VPUverse(0)>, msgs ...string<VPUverse(0)>) { t<VPUverse(0)>.Helper(); if uassert<VPUverse(0)>.True(t<VPUverse(0)>, value<VPUverse(0)>, msgs<VPUverse(0)>...) { return }; t<VPUverse(0)>.FailNow() }; func False(t uassert<VPUverse(0)>.TestingT, value bool<VPUverse(0)>, msgs ...string<VPUverse(0)>) { t<VPUverse(0)>.Helper(); if uassert<VPUverse(0)>.False(t<VPUverse(0)>, value<VPUverse(0)>, msgs<VPUverse(0)>...) { return }; t<VPUverse(0)>.FailNow() }; func ErrorIs(t uassert<VPUverse(0)>.TestingT, err error<VPUverse(0)>, target error<VPUverse(0)>, msgs ...string<VPUverse(0)>) { t<VPUverse(0)>.Helper(); if uassert<VPUverse(0)>.ErrorIs(t<VPUverse(0)>, err<VPUverse(0)>, target<VPUverse(0)>, msgs<VPUverse(0)>...) { return }; t<VPUverse(0)>.FailNow() }; func PanicsWithMessage(t uassert<VPUverse(0)>.TestingT, msg string<VPUverse(0)>, f func(), msgs ...string<VPUverse(0)>) { t<VPUverse(0)>.Helper(); if uassert<VPUverse(0)>.PanicsWithMessage(t<VPUverse(0)>, msg<VPUverse(0)>, f<VPUverse(0)>, msgs<VPUverse(0)>...) { return }; t<VPUverse(0)>.FailNow() }; func NotPanics(t uassert<VPUverse(0)>.TestingT, f func(), msgs ...string<VPUverse(0)>) { t<VPUverse(0)>.Helper(); if uassert<VPUverse(0)>.NotPanics(t<VPUverse(0)>, f<VPUverse(0)>, msgs<VPUverse(0)>...) { return }; t<VPUverse(0)>.FailNow() }; func Equal(t uassert<VPUverse(0)>.TestingT, expected interface {  }, actual interface {  }, msgs ...string<VPUverse(0)>) { t<VPUverse(0)>.Helper(); if uassert<VPUverse(0)>.Equal(t<VPUverse(0)>, expected<VPUverse(0)>, actual<VPUverse(0)>, msgs<VPUverse(0)>...) { return }; t<VPUverse(0)>.FailNow() }; func Empty(t uassert<VPUverse(0)>.TestingT, obj interface {  }, msgs ...string<VPUverse(0)>) { t<VPUverse(0)>.Helper(); if uassert<VPUverse(0)>.Empty(t<VPUverse(0)>, obj<VPUverse(0)>, msgs<VPUverse(0)>...) { return }; t<VPUverse(0)>.FailNow() } }
------------------------

goroutine 1 [running]:
github.com/gnolang/gno/gnovm/pkg/gnolang.predefineNow.func1()
	/Users/moul/go/src/github.com/gnolang/gno/gnovm/pkg/gnolang/preprocess.go:3067 +0x16c
panic({0x101a7d5a0?, 0x140074ff050?})
	/nix/store/n1k6wf8q10q7k0863gb78b1rf0j07r7r-go-1.22.1/share/go/src/runtime/panic.go:770 +0x124
github.com/gnolang/gno/gnovm/pkg/gnolang.Preprocess.func1.1()
	/Users/moul/go/src/github.com/gnolang/gno/gnovm/pkg/gnolang/preprocess.go:176 +0x200
panic({0x101a0fb20?, 0x140027f7dd0?})
	/nix/store/n1k6wf8q10q7k0863gb78b1rf0j07r7r-go-1.22.1/share/go/src/runtime/panic.go:770 +0x124
github.com/gnolang/gno/gnovm/pkg/gnolang.Preprocess.func1({0x1400748d800, 0x0, 0x20}, 0x0, 0x1400008124c?, {0x101b75050, 0x14000237700}, 0x3)
	/Users/moul/go/src/github.com/gnolang/gno/gnovm/pkg/gnolang/preprocess.go:2004 +0x4924
github.com/gnolang/gno/gnovm/pkg/gnolang.transcribe(0x1400921f170, {0x1400748d800, 0x0, 0x20}, 0x0, 0x0, {0x101b75050, 0x14000237700}, 0x1400921f0a7)
	/Users/moul/go/src/github.com/gnolang/gno/gnovm/pkg/gnolang/transcribe.go:728 +0x195c
github.com/gnolang/gno/gnovm/pkg/gnolang.Transcribe({0x101b75050, 0x14000237700}, 0x1400921f170)
	/Users/moul/go/src/github.com/gnolang/gno/gnovm/pkg/gnolang/transcribe.go:133 +0xb4
github.com/gnolang/gno/gnovm/pkg/gnolang.Preprocess({0x101b80e38, 0x140002c40a0}, {0x101b7ed80, 0x140002c0908}, {0x101b75050, 0x14000237700?})
	/Users/moul/go/src/github.com/gnolang/gno/gnovm/pkg/gnolang/preprocess.go:151 +0x218
github.com/gnolang/gno/gnovm/pkg/gnolang.predefineNow2({0x101b80e38, 0x140002c40a0}, {0x101b7ed80, 0x140002c0908}, {0x101b76f00, 0x14000237700}, 0x1400921f488)
	/Users/moul/go/src/github.com/gnolang/gno/gnovm/pkg/gnolang/preprocess.go:3195 +0x22c
github.com/gnolang/gno/gnovm/pkg/gnolang.predefineNow({0x101b80e38, 0x140002c40a0}, {0x101b7ed80, 0x140002c0908}, {0x101b76f00, 0x14000237700})
	/Users/moul/go/src/github.com/gnolang/gno/gnovm/pkg/gnolang/preprocess.go:3075 +0xd4
github.com/gnolang/gno/gnovm/pkg/gnolang.PredefineFileSet({0x101b80e38, 0x140002c40a0}, 0x140002c0c08, 0x140003163f0)
	/Users/moul/go/src/github.com/gnolang/gno/gnovm/pkg/gnolang/preprocess.go:61 +0x4c0
github.com/gnolang/gno/gnovm/pkg/gnolang.(*Machine).runFiles(0x14000275448, {0x1400007eec0, 0x1, 0x1})
	/Users/moul/go/src/github.com/gnolang/gno/gnovm/pkg/gnolang/machine.go:530 +0x1c8
github.com/gnolang/gno/gnovm/pkg/gnolang.(*Machine).RunFiles(...)
	/Users/moul/go/src/github.com/gnolang/gno/gnovm/pkg/gnolang/machine.go:496
github.com/gnolang/gno/gnovm/pkg/gnolang.(*Machine).runMemPackage(0x14000275448, 0x140002a02c0, 0x1, 0x0)
	/Users/moul/go/src/github.com/gnolang/gno/gnovm/pkg/gnolang/machine.go:287 +0x1d8
github.com/gnolang/gno/gnovm/pkg/gnolang.(*Machine).RunMemPackage(...)
	/Users/moul/go/src/github.com/gnolang/gno/gnovm/pkg/gnolang/machine.go:255
main.gnoTestPkg({0x16ee3e864, 0xa}, {0x1400028edb0?, 0x1, 0x0?}, {0x0, 0x0, 0xa2d4091d00000000?}, 0x14000263600, {0x101b79770, ...})
	/Users/moul/go/src/github.com/gnolang/gno/gnovm/cmd/gno/test.go:298 +0xe60
main.execTest(0x14000263600, {0x1400028ed60?, 0x1?, 0x1?}, {0x101b79770, 0x14000295220})
	/Users/moul/go/src/github.com/gnolang/gno/gnovm/cmd/gno/test.go:198 +0x35c
main.newTestCmd.func1({0x0?, 0x140000300b0?}, {0x1400028ed60?, 0x140000998c0?, 0x0?})
	/Users/moul/go/src/github.com/gnolang/gno/gnovm/cmd/gno/test.go:99 +0x3c
github.com/gnolang/gno/tm2/pkg/commands.(*Command).Run(0x140001f5ef8?, {0x101b6d038?, 0x1021b0940?})
	/Users/moul/go/src/github.com/gnolang/gno/tm2/pkg/commands/command.go:255 +0x17c
github.com/gnolang/gno/tm2/pkg/commands.(*Command).Run(0x1400027e840?, {0x101b6d038?, 0x1021b0940?})
	/Users/moul/go/src/github.com/gnolang/gno/tm2/pkg/commands/command.go:259 +0x12c
github.com/gnolang/gno/tm2/pkg/commands.(*Command).ParseAndRun(0x1400027e840, {0x101b6d038, 0x1021b0940}, {0x14000030090?, 0x1400027ed10?, 0x1400027edc0?})
	/Users/moul/go/src/github.com/gnolang/gno/tm2/pkg/commands/command.go:140 +0x4c
github.com/gnolang/gno/tm2/pkg/commands.(*Command).Execute(0x101b79770?, {0x101b6d038?, 0x1021b0940?}, {0x14000030090?, 0x1020cddc8?, 0x140000021c0?})
	/Users/moul/go/src/github.com/gnolang/gno/tm2/pkg/commands/command.go:117 +0x28
main.main()
	/Users/moul/go/src/github.com/gnolang/gno/gnovm/cmd/gno/main.go:13 +0x6c
@moul moul added the 🐞 bug Something isn't working label Jul 2, 2024
@deelawn deelawn self-assigned this Jul 2, 2024
deelawn added a commit that referenced this issue Jul 16, 2024
Closes #2479.

When defining a type alias to a type in another package, the existing
type is specified with a selector expression. This PR ensures that the
underlying type being aliased is properly extracted.

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

- [x] Added new tests, or not needed, or not feasible
- [x] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [x] Updated the official documentation or not needed
- [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [x] Added references to related issues and PRs
- [x] Provided any useful hints for running manual tests
- [x] 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>

Co-authored-by: Manfred Touron <[email protected]>
gfanton pushed a commit to gfanton/gno that referenced this issue Jul 23, 2024
Closes gnolang#2479.

When defining a type alias to a type in another package, the existing
type is specified with a selector expression. This PR ensures that the
underlying type being aliased is properly extracted.

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

- [x] Added new tests, or not needed, or not feasible
- [x] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [x] Updated the official documentation or not needed
- [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [x] Added references to related issues and PRs
- [x] Provided any useful hints for running manual tests
- [x] 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>

Co-authored-by: Manfred Touron <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
Development

Successfully merging a pull request may close this issue.

2 participants