Skip to content

Commit

Permalink
fix: convert type properly to the correct type
Browse files Browse the repository at this point in the history
  • Loading branch information
nrwiersma committed Jul 8, 2020
1 parent b376650 commit 659913e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
15 changes: 15 additions & 0 deletions _test/composite11.go
@@ -0,0 +1,15 @@
package main

import (
"fmt"
"image/color"
)

func main() {
c := color.NRGBA64{1, 1, 1, 1}

fmt.Println(c)
}

// Output:
// {1 1 1 1}
3 changes: 2 additions & 1 deletion interp/run.go
Expand Up @@ -2011,10 +2011,11 @@ func compositeBinStruct(n *node) {
}
} else {
fieldIndex[i] = []int{i}
convertLiteralValue(c.child[1], typ.Field(i).Type)
if c.typ.cat == funcT {
convertLiteralValue(c.child[1], typ.Field(i).Type)
values[i] = genFunctionWrapper(c.child[1])
} else {
convertLiteralValue(c, typ.Field(i).Type)
values[i] = genValue(c)
}
}
Expand Down

0 comments on commit 659913e

Please sign in to comment.