Skip to content

Commit

Permalink
Fix for index attribute resolution via a function call return (#325)
Browse files Browse the repository at this point in the history
  • Loading branch information
TristonianJones authored Mar 25, 2020
1 parent 72fa28c commit 74ccfea
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion interpreter/interpreter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,15 @@ var (
},
{
name: "index",
expr: `m['key'][1] == 42u && m['null'] == null`,
expr: `m['key'][1] == 42u && m['null'] == null && m[string(0)] == 10`,
env: []*exprpb.Decl{
decls.NewIdent("m", decls.NewMapType(decls.String, decls.Dyn), nil),
},
in: map[string]interface{}{
"m": map[string]interface{}{
"key": []uint{21, 42},
"null": nil,
"0": 10,
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion interpreter/planner.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ func (p *planner) planCallIndex(expr *exprpb.Expr,
if isIndAttr {
return opAttr.AddQualifier(indAttr.Attr())
}
return nil, fmt.Errorf("unsupported index expression: %v", expr)
return opAttr.AddQualifier(p.attrFactory.RelativeAttribute(ind.ID(), ind))
}

// planCreateList generates a list construction Interpretable.
Expand Down

0 comments on commit 74ccfea

Please sign in to comment.