./conversions.go:31:32: conversion from int64 to string yields a string of one rune
eclipseo opened this issue · 3 comments
eclipseo commented
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
cosmos72 commented
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))
eclipseo commented
I have updated the PR with your recommendation, could you have a look?
cosmos72 commented
Merged, thanks :)