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

Crash when constant is negative #42

Closed
moeshin opened this issue Oct 11, 2023 · 0 comments · Fixed by #43
Closed

Crash when constant is negative #42

moeshin opened this issue Oct 11, 2023 · 0 comments · Fixed by #43

Comments

@moeshin
Copy link
Contributor

moeshin commented Oct 11, 2023

package test_tygo

const A = -1
> tygo generate
unhandled unary expr: &{32 - 0xc00020aa40}
 *ast.UnaryExpr
panic: unhandled unary expr: &{32 - 0xc00020aa40}
 *ast.UnaryExpr

goroutine 1 [running]:
github.com/gzuidhof/tygo/tygo.(*PackageGenerator).writeType(0xc000208690, 0xc000087168, {0x69cd60?, 0xc00020aa60?}, 0x0, 0x8?)
        C:/Users/MoeShin/go/pkg/mod/github.com/gzuidhof/tygo@v0.2.10/tygo/write.go:114 +0x20a8
github.com/gzuidhof/tygo/tygo.(*PackageGenerator).writeValueSpec(0xc000208690, 0xc00020aa80, 0xc000258000, 0xc000087260)
        C:/Users/MoeShin/go/pkg/mod/github.com/gzuidhof/tygo@v0.2.10/tygo/write_toplevel.go:204 +0xb9b
github.com/gzuidhof/tygo/tygo.(*PackageGenerator).writeSpec(0xc000230100?, 0x3f?, {0x69cb80?, 0xc000258000?}, 0x510bfe?)
        C:/Users/MoeShin/go/pkg/mod/github.com/gzuidhof/tygo@v0.2.10/tygo/write_toplevel.go:65 +0xd5
github.com/gzuidhof/tygo/tygo.(*PackageGenerator).writeGroupDecl(0xc000208690, 0xc00020aa80?, 0xc000230100?)
        C:/Users/MoeShin/go/pkg/mod/github.com/gzuidhof/tygo@v0.2.10/tygo/write_toplevel.go:51 +0xfe
github.com/gzuidhof/tygo/tygo.(*PackageGenerator).Generate.func1({0x69b9a0?, 0xc0002220c0?})
        C:/Users/MoeShin/go/pkg/mod/github.com/gzuidhof/tygo@v0.2.10/tygo/package_generator.go:38 +0xcc
go/ast.inspector.Visit(0xc0002580a0, {0x69b9a0?, 0xc0002220c0?})
        C:/Users/MoeShin/scoop/apps/go/current/src/go/ast/walk.go:386 +0x2b
go/ast.Walk({0x69ad58?, 0xc0002580a0?}, {0x69b9a0?, 0xc0002220c0?})
        C:/Users/MoeShin/scoop/apps/go/current/src/go/ast/walk.go:51 +0x5c
go/ast.walkDeclList(...)
        C:/Users/MoeShin/scoop/apps/go/current/src/go/ast/walk.go:38
go/ast.Walk({0x69ad58?, 0xc0002580a0?}, {0x69b978?, 0xc00024a0a0?})
        C:/Users/MoeShin/scoop/apps/go/current/src/go/ast/walk.go:366 +0x1b05
go/ast.Inspect(...)
        C:/Users/MoeShin/scoop/apps/go/current/src/go/ast/walk.go:397
github.com/gzuidhof/tygo/tygo.(*PackageGenerator).Generate(0xc000208690)
        C:/Users/MoeShin/go/pkg/mod/github.com/gzuidhof/tygo@v0.2.10/tygo/package_generator.go:24 +0x532
github.com/gzuidhof/tygo/tygo.(*Tygo).Generate(0xc000087b58)
        C:/Users/MoeShin/go/pkg/mod/github.com/gzuidhof/tygo@v0.2.10/tygo/generator.go:65 +0x26e
github.com/gzuidhof/tygo/cmd.generate(0xc0000b0a00?, {0x619c5a?, 0x4?, 0x619c5e?})
        C:/Users/MoeShin/go/pkg/mod/github.com/gzuidhof/tygo@v0.2.10/cmd/root.go:45 +0x110
github.com/spf13/cobra.(*Command).execute(0xc000071680, {0x8de700, 0x0, 0x0})
        C:/Users/MoeShin/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:860 +0x67b
github.com/spf13/cobra.(*Command).ExecuteC(0xc000071400)
        C:/Users/MoeShin/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:974 +0x38d
github.com/spf13/cobra.(*Command).Execute(...)
        C:/Users/MoeShin/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:902
github.com/gzuidhof/tygo/cmd.Execute()
        C:/Users/MoeShin/go/pkg/mod/github.com/gzuidhof/tygo@v0.2.10/cmd/root.go:31 +0x2be
main.main()
        C:/Users/MoeShin/go/pkg/mod/github.com/gzuidhof/tygo@v0.2.10/main.go:6 +0xf
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

Successfully merging a pull request may close this issue.

1 participant