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

Mismatched types #90

Closed
ldez opened this issue Feb 9, 2019 · 0 comments
Closed

Mismatched types #90

ldez opened this issue Feb 9, 2019 · 0 comments
Labels
bug Something isn't working

Comments

@ldez
Copy link
Member

ldez commented Feb 9, 2019

The following program sample.go triggers a panic:

package main

import "fmt"

type Foo string
type Bar string

func main() {
	f := Foo("test")
	b := Bar("test")
	fmt.Println(f == b) // Error
}

Expected result:

$ go run ./sample.go
_test/type8.go:11:16: invalid operation: f == b (mismatched types Foo and Bar)

Got:

$ dyngo ./sample.go
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x604c49]

goroutine 1 [running]:
github.com/containous/dyngo/interp.runCfg.func1(0xc0001943c0)
	/home/ldez/sources/go/src/github.com/containous/dyngo/interp/run.go:103 +0x134
panic(0xbe9e00, 0x1650f30)
	/home/ldez/.gvm/gos/go1.11.5/src/runtime/panic.go:513 +0x1b9
github.com/containous/dyngo/interp.equal.func8(0xc0001943c0, 0xc0001c9b00)
	/home/ldez/sources/go/src/github.com/containous/dyngo/interp/op.go:782 +0x49
github.com/containous/dyngo/interp.runCfg(0xc0001f9b00, 0xc0001943c0)
	/home/ldez/sources/go/src/github.com/containous/dyngo/interp/run.go:108 +0x62
github.com/containous/dyngo/interp.(*Interpreter).run(0xc000200070, 0xc0001f9200, 0xc000194370)
	/home/ldez/sources/go/src/github.com/containous/dyngo/interp/run.go:90 +0xa6
github.com/containous/dyngo/interp.(*Interpreter).Eval(0xc000200070, 0xc000204000, 0x8f, 0xca583f, 0x4, 0xc000200070, 0x0, 0x115f2e0)
	/home/ldez/sources/go/src/github.com/containous/dyngo/interp/interp.go:236 +0x4c3
main.main()
	/home/ldez/sources/go/src/github.com/containous/dyngo/dyngo.go:50 +0x334
exit status 2
@ldez ldez added the bug Something isn't working label Feb 9, 2019
mvertes added a commit that referenced this issue Feb 25, 2019
The types of operands are checked prior to generate closures.

Test: improve evalCheck() to check against expected output and/or
expected errors.

Fix #90
@ldez ldez closed this as completed in #109 Feb 26, 2019
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
None yet
Development

No branches or pull requests

1 participant