Commit dfc56a4 caused a regression where the following code fails to compile:
package main
import (
"testing"
"time"
)
type Value interface{}
type DateTime time.Time
var _ Value = DateTime(time.Time{})
var (
date1Time = time.Date(2014, 2, 3, 1, 2, 3, 400000000, time.UTC)
date1 = DateTime(date1Time)
)
var dateTimeNotSupported = []struct {
in Value
out Value
}{{in: date1, out: nil}}
func Test(*testing.T) {}
On the commit in question, I see the following:
# command-line-arguments
./main_test.go:24: cannot use date1Time (type time.Time) as type DateTime in assignment
./main_test.go:24: internal compiler error: unhandled OCONV STRUCT -> STRUCT
goroutine 1 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
/home/rawr/Projects/go/src/runtime/debug/stack.go:24 +0x79
cmd/compile/internal/gc.Fatalf(0xab7efc, 0x18, 0xc42053e260, 0x2, 0x2)
/home/rawr/Projects/go/src/cmd/compile/internal/gc/subr.go:165 +0x22f
cmd/compile/internal/gc.(*ssaExport).Fatalf(0xde9a9a, 0x18, 0xab7efc, 0x18, 0xc42053e260, 0x2, 0x2)
/home/rawr/Projects/go/src/cmd/compile/internal/gc/ssa.go:4772 +0x5d
cmd/compile/internal/ssa.(*Config).Fatalf(0xc4204dc000, 0xc400000018, 0xab7efc, 0x18, 0xc42053e260, 0x2, 0x2)
/home/rawr/Projects/go/src/cmd/compile/internal/ssa/config.go:292 +0x6e
cmd/compile/internal/gc.(*state).Fatalf(0xc4203f87e0, 0xab7efc, 0x18, 0xc42053e260, 0x2, 0x2)
/home/rawr/Projects/go/src/cmd/compile/internal/gc/ssa.go:280 +0x83
cmd/compile/internal/gc.(*state).expr(0xc4203f87e0, 0xc42053d560, 0x0)
/home/rawr/Projects/go/src/cmd/compile/internal/gc/ssa.go:1698 +0x428b
cmd/compile/internal/gc.(*state).stmt(0xc4203f87e0, 0xc42053c630)
/home/rawr/Projects/go/src/cmd/compile/internal/gc/ssa.go:678 +0x409
cmd/compile/internal/gc.(*state).stmts(0xc4203f87e0, 0xc4204b9fe0)
/home/rawr/Projects/go/src/cmd/compile/internal/gc/ssa.go:481 +0x5e
cmd/compile/internal/gc.buildssa(0xc42053c870, 0x0)
/home/rawr/Projects/go/src/cmd/compile/internal/gc/ssa.go:126 +0x67f
cmd/compile/internal/gc.compile(0xc42053c870)
/home/rawr/Projects/go/src/cmd/compile/internal/gc/pgen.go:402 +0x209
cmd/compile/internal/gc.funccompile(0xc42053c870)
/home/rawr/Projects/go/src/cmd/compile/internal/gc/dcl.go:1260 +0x179
cmd/compile/internal/gc.fninit(0xc4204bc300, 0x7, 0x8)
/home/rawr/Projects/go/src/cmd/compile/internal/gc/init.go:182 +0xb8f
cmd/compile/internal/gc.Main()
/home/rawr/Projects/go/src/cmd/compile/internal/gc/main.go:480 +0x23f5
cmd/compile/internal/amd64.Main()
/home/rawr/Projects/go/src/cmd/compile/internal/amd64/galign.go:93 +0x2fa
main.main()
/home/rawr/Projects/go/src/cmd/compile/main.go:33 +0x279
I expect the test to compile and pass.
/cc @josharian, @randall77, @mdempsky
Commit dfc56a4 caused a regression where the following code fails to compile:
On the commit in question, I see the following:
I expect the test to compile and pass.
/cc @josharian, @randall77, @mdempsky