This adds type checking to CallExpr (excluding builtin type checking, as that is a PR in its own right) as well as handling any required constant type conversion. This also changes constant strings and runes to be represented as `constant.Value`. Runes change `rval` type at CFG typing time to avoid having to type at AST time. There are also changes to importSpecs and `stdlib` to account for the string change. With this all `untyped` types should now be `constant.Value`s, although errors are still not returned if this is not the case to be sure we do not break things. This also fixed a bug in `itype.methods` that would panic if the type was recursive.
17 lines
181 B
Go
17 lines
181 B
Go
package main
|
|
|
|
import (
|
|
"encoding/binary"
|
|
"fmt"
|
|
)
|
|
|
|
func main() {
|
|
var b [8]byte
|
|
binary.LittleEndian.PutUint64(b[:], uint64(1))
|
|
|
|
fmt.Println(b)
|
|
}
|
|
|
|
// Output:
|
|
// [1 0 0 0 0 0 0 0]
|