Hack to work around a compiler bug in the reflection data of byte.

This commit is contained in:
David Symonds 2012-07-24 13:19:07 +10:00
Родитель 215b545f0c
Коммит 313d6a300f
3 изменённых файлов: 13 добавлений и 5 удалений

Просмотреть файл

@ -333,7 +333,15 @@ func parameterFromType(t reflect.Type) (*Parameter, error) {
var errorType = reflect.TypeOf((*error)(nil)).Elem()
var byteType = reflect.TypeOf(byte(0))
func typeFromType(t reflect.Type) (Type, error) {
// Hack workaround for http://code.google.com/p/go/issues/detail?id=3853.
// This explicit check should not be necessary.
if t == byteType {
return PredeclaredType("byte"), nil
}
if imp := t.PkgPath(); imp != "" {
return &NamedType{
Package: imp,

Просмотреть файл

@ -193,14 +193,14 @@ func (_mr *_MockIndexRecorder) Put(arg0, arg1 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "Put", arg0, arg1)
}
func (_m *MockIndex) Slice(_param0 []int) [3]int {
ret := _m.ctrl.Call(_m, "Slice", _param0)
func (_m *MockIndex) Slice(_param0 []int, _param1 []byte) [3]int {
ret := _m.ctrl.Call(_m, "Slice", _param0, _param1)
ret0, _ := ret[0].([3]int)
return ret0
}
func (_mr *_MockIndexRecorder) Slice(arg0 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "Slice", arg0)
func (_mr *_MockIndexRecorder) Slice(arg0, arg1 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "Slice", arg0, arg1)
}
func (_m *MockIndex) Summary(_param0 *bytes.Buffer, _param1 io.Writer) {

Просмотреть файл

@ -53,7 +53,7 @@ type Index interface {
Ptr(arg *int)
// A method with a slice argument and an array return.
Slice(a []int) [3]int
Slice(a []int, b []byte) [3]int
// A method with channel arguments.
Chan(a chan int, b chan<- hash.Hash)