fix: handle index expression on binary string type
This commit is contained in:
committed by
Traefiker Bot
parent
08a37fc4bf
commit
56bec974e1
11
_test/str3.go
Normal file
11
_test/str3.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package main
|
||||
|
||||
import "strconv"
|
||||
|
||||
func main() {
|
||||
str := strconv.Itoa(101)
|
||||
println(str[0] == '1')
|
||||
}
|
||||
|
||||
// Output:
|
||||
// true
|
||||
@@ -634,7 +634,11 @@ func (interp *Interpreter) cfg(root *node) ([]*node, error) {
|
||||
case stringT:
|
||||
n.typ = sc.getType("byte")
|
||||
case valueT:
|
||||
n.typ = &itype{cat: valueT, rtype: t.rtype.Elem()}
|
||||
if t.rtype.Kind() == reflect.String {
|
||||
n.typ = sc.getType("byte")
|
||||
} else {
|
||||
n.typ = &itype{cat: valueT, rtype: t.rtype.Elem()}
|
||||
}
|
||||
default:
|
||||
n.typ = t.val
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user