From 0f83c3b3c6e73021bf5489c4d3ee3ce1bf150103 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Thu, 6 Sep 2018 10:53:18 +0200 Subject: [PATCH] compiler: allow copying a string to a slice Now that strings and slices are similar, this just works. --- compiler.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/compiler.go b/compiler.go index 80a50a13..7f52c030 100644 --- a/compiler.go +++ b/compiler.go @@ -1532,9 +1532,6 @@ func (c *Compiler) parseBuiltin(frame *Frame, args []ssa.Value, callName string) if err != nil { return llvm.Value{}, err } - if _, ok := args[1].Type().(*types.Basic); ok { - return llvm.Value{}, errors.New("todo: copy: string to []byte") - } dstLen := c.builder.CreateExtractValue(dst, 1, "copy.dstLen") srcLen := c.builder.CreateExtractValue(src, 1, "copy.srcLen") dstBuf := c.builder.CreateExtractValue(dst, 0, "copy.dstArray")