goose icon indicating copy to clipboard operation
goose copied to clipboard

Integer conversion of len is mistranslated

Open tchajed opened this issue 4 years ago • 0 comments

Converting len to uint32 via a type wrapper is mistranslated, dropping the type wrapper and using slice.len (which produces a u64).

type Uint32 uint32

func failing_testU32NewtypeLen() bool {
	s := make([]byte, 20)
	return Uint32(len(s)) == Uint32(20)
}

The translation omits the Uint32 conversion altogether.

A workaround is to use Uint32(uint32(len(s))), so that the uint32 conversion shows up syntactically.

tchajed avatar Nov 07 '20 13:11 tchajed