compiler: fix named string to []byte slice conversion

This was missing a `.Underlying()` call to avoid testing the named type
(but instead test for the underlying type).
This commit is contained in:
Ayke van Laethem
2020-07-27 12:35:29 +02:00
committed by Ron Evans
parent e41e5106cc
commit d4e04e4e49
2 changed files with 4 additions and 1 deletions
+1 -1
View File
@@ -2536,7 +2536,7 @@ func (b *builder) createConvert(typeFrom, typeTo types.Type, value llvm.Value, p
return llvm.Value{}, b.makeError(pos, "todo: convert: basic non-integer type: "+typeFrom.String()+" -> "+typeTo.String())
case *types.Slice:
if basic, ok := typeFrom.(*types.Basic); !ok || basic.Info()&types.IsString == 0 {
if basic, ok := typeFrom.Underlying().(*types.Basic); !ok || basic.Info()&types.IsString == 0 {
panic("can only convert from a string to a slice")
}