mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-04 19:17:47 +00:00
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:
committed by
Ron Evans
parent
e41e5106cc
commit
d4e04e4e49
@@ -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")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user