Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions linter/internal/types/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,13 @@ func newTypeGraph(importFunc ImportFunc) *typeGraph {
},
})

g.newPlaceholder()
g._placeholders[boolArrayType] = concreteTP(TypeDesc{
ArrayDesc: &arrayDesc{
furtherContain: []placeholderID{boolType},
},
})

g.newPlaceholder()
g._placeholders[anyObjectType] = concreteTP(TypeDesc{
ObjectDesc: anyObjectDesc,
Expand Down
1 change: 1 addition & 0 deletions linter/internal/types/placeholder.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const (
nullType
anyArrayType
numberArrayType
boolArrayType
anyObjectType
anyFunctionType
stdlibType
Expand Down
3 changes: 3 additions & 0 deletions linter/internal/types/stdlib.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ func prepareStdlib(g *typeGraph) {
"minArray": g.newFuncType(anyArrayType, []ast.Parameter{required("arr"), optional("keyF")}),
"maxArray": g.newFuncType(anyArrayType, []ast.Parameter{required("arr"), optional("keyF")}),
"contains": g.newSimpleFuncType(boolType, "arr", "elem"),
// TODO these need test cases written by someone who understands how to make them
"all": g.newSimpleFuncType(boolArrayType, "arr"),
"any": g.newSimpleFuncType(boolArrayType, "arr"),
"remove": g.newSimpleFuncType(anyArrayType, "arr", "elem"),
"removeAt": g.newSimpleFuncType(anyArrayType, "arr", "i"),

Expand Down