interp: allow early constant evaluation from builtin call
One builtin has been identified to be used for constant definition: len(), with a constant string argument. Add support for this. Fixes #1012.
This commit is contained in:
@@ -198,7 +198,7 @@ func nodeType(interp *Interpreter, sc *scope, n *node) (*itype, error) {
|
||||
if sym.kind != constSym {
|
||||
return nil, c0.cfgErrorf("non-constant array bound %q", c0.ident)
|
||||
}
|
||||
if sym.typ == nil || sym.typ.cat != intT {
|
||||
if sym.typ == nil || sym.typ.cat != intT || !sym.rval.IsValid() {
|
||||
t.incomplete = true
|
||||
break
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user