xhd2015 / xgo

All-in-one go testing library
MIT License
289 stars 16 forks source link

Bug: internal compiler error: time.Duration is not assignable to int #182

Closed xhd2015 closed 1 month ago

xhd2015 commented 1 month ago
          This fails to compile:
const (
    // The amount of time the nodecontroller should sleep between retrying node health updates
    retrySleepTime = 20 * time.Millisecond
)

func TestArrayPointer(t *testing.T) {
    a := retrySleepTime * ext.NodeHealthUpdateRetry
    _ = a
}

ext:

package ext

const (
    // NodeHealthUpdateRetry controls the number of retries of writing
    // node health update.
    NodeHealthUpdateRetry = 5
)

Test:

$ go run -tags dev ./cmd/xgo test --project-dir runtime/test/debug
# github.com/xhd2015/xgo/runtime/test/debug [github.com/xhd2015/xgo/runtime/test/debug.test]
./debug_test.go:24:27: internal compiler error: time.Duration is not assignable to int

Please file a bug report including a short program that triggers the error.
https://go.dev/issue/new
FAIL    github.com/xhd2015/xgo/runtime/test/debug [build failed]
exit status 1
exit status 1

Originally posted by @xhd2015 in https://github.com/xhd2015/xgo/issues/181#issuecomment-2143711549