cosmos72/gomacro

./conversions.go:31:32: conversion from int64 to string yields a string of one rune

eclipseo opened this issue · 3 comments

Go 1.15 beta 1 on Fedora Rawhide:

# github.com/cosmos72/gomacro/go/types
./conversions.go:31:32: conversion from int64 to string yields a string of one rune
FAIL    github.com/cosmos72/gomacro/go/types [build failed]

See golang/go#32479

Thanks for spotting this.
I don't think that code is actually used in gomacro - it's a leftover of forking go/types - but it's still better to fix it.

Anyway, the conversion int64 -> rune should also perform bound checks - something like:

r := rune(codepoint)
if int64(r) != codepoint {
  r = utf8.RuneError
}
x.val = constant.MakeString(string(r))

I have updated the PR with your recommendation, could you have a look?

Merged, thanks :)