diff --git a/README.md b/README.md index fed235f6..a1432878 100644 --- a/README.md +++ b/README.md @@ -291,6 +291,8 @@ Here are the Go packages that can be imported correctly: * [fmt](https://pkg.go.dev/fmt) (partially) * [reflect](https://pkg.go.dev/reflect) (partially) * [time](https://pkg.go.dev/time) (partially) +* [encoding/binary](https://pkg.go.dev/encoding/binary) +* [encoding/base64](https://pkg.go.dev/encoding/base64) * [regexp](https://pkg.go.dev/regexp) * [regexp/syntax](https://pkg.go.dev/regexp/syntax) diff --git a/_cmptest/base64demo/base64.go b/_cmptest/base64demo/base64.go new file mode 100644 index 00000000..22728ba9 --- /dev/null +++ b/_cmptest/base64demo/base64.go @@ -0,0 +1,18 @@ +package main + +import ( + "encoding/base64" + "fmt" +) + +func main() { + msg := "Hello, 世界" + encoded := base64.StdEncoding.EncodeToString([]byte(msg)) + fmt.Println(encoded) + decoded, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + fmt.Println("decode error:", err) + return + } + fmt.Println(string(decoded)) +} diff --git a/ssa/expr.go b/ssa/expr.go index 9400958a..263ebb7a 100644 --- a/ssa/expr.go +++ b/ssa/expr.go @@ -699,6 +699,7 @@ func (b Builder) ChangeType(t Type, x Expr) (ret Expr) { case vkFuncDecl: ret.impl = checkExpr(x, t.raw.Type, b).impl case vkClosure: + // TODO(xsw): change type should be a noop instruction convType := func() Expr { r := Expr{llvm.CreateAlloca(b.impl, t.ll), b.Prog.Pointer(t)} b.Store(r, x)