google / google/go-jsonnet

Linter panic involving a circular dependency?

Open
#591 8 comments 8 reactions 1 assignee Claimed by @sbarzowski View on GitHub
Dominant language
Go
Stars
1.8k
Forks
263
PR merge metrics
No merged PRs in 30d

Description

Here's a reduced example, using jsonnet-lint from 0.18.0:

```a.libsonnet
# a.libsonnet
local b = import './b.libsonnet';

local p = {
s:: [],

c: b.callThis(self.s),
};

// Exposed for public use.
{
p:: p,
}
```
```b.libsonnet
# b.libsonnet
local callThis(fromOther) = fromOther;

// Exposed for public use.
{
callThis:: callThis,
}
```

Linter behavior:
```
jsonnet-lint a.libsonnet b.libsonnet [git:master] ✖
panic: Bug - placeholder for a dependent node cannot be noType

goroutine 1 [running]:
github.com/google/go-jsonnet/linter/internal/types.(*typeGraph).getExprPlaceholder(...)
/private/tmp/go-jsonnet-20211222-86046-dhqer5/go-jsonnet-0.18.0/linter/internal/types/build_graph.go:26
github.com/google/go-jsonnet/linter/internal/types.calcTP({0x11fe8b8, 0xc0001da180}, 0x0, 0xc0001fb320)
/private/tmp/go-jsonnet-20211222-86046-dhqer5/go-jsonnet-0.18.0/linter/internal/types/build_graph.go:217 +0x280e
github.com/google/go-jsonnet/linter/internal/types.prepareTPWithPlaceholder({0x11fe8b8, 0xc0001da180}, 0x0, 0xc0001fb320, 0x79)
/private/tmp/go-jsonnet-20211222-86046-dhqer5/go-jsonnet-0.18.0/linter/internal/types/build_graph.go:86 +0x1ae
github.com/google/go-jsonnet/linter/internal/types.prepareTPWithPlaceholder({0x11feaf8, 0xc0001b0460}, 0x7ff7bfeff875, 0xc0001fb320, 0x77)
/private/tmp/go-jsonnet-20211222-86046-dhqer5/go-jsonnet-0.18.0/linter/internal/types/build_graph.go:62 +0x5ba
github.com/google/go-jsonnet/linter/internal/types.(*typeGraph).addRoots(0xc0001fb320, 0x11fe8b8, 0xd0)
/private/tmp/go-jsonnet-20211222-86046-dhqer5/go-jsonnet-0.18.0/linter/internal/types/build_graph.go:96 +0x31a
github.com/google/go-jsonnet/linter/internal/types.Check({0x11feaf8, 0xc0001b0460}, 0x11bbb03, 0x4, 0xc0001c4348, 0x0)
/private/tmp/go-jsonnet-20211222-86046-dhqer5/go-jsonnet-0.18.0/linter/internal/types/check.go:138 +0xc7
github.com/google/go-jsonnet/linter.lint(0xc0001821e0, {0xc00018e300, 0x2, 0x10a0c54}, 0xc0001a20c0)
/private/tmp/go-jsonnet-20211222-86046-dhqer5/go-jsonnet-0.18.0/linter/linter.go:87 +0x6d4
github.com/google/go-jsonnet/linter.LintSnippet(0x119fcc0, {0x11fa4e0, 0xc000180010}, {0xc00018e200, 0x2, 0x12fe080})
/private/tmp/go-jsonnet-20211222-86046-dhqer5/go-jsonnet-0.18.0/linter/linter.go:152 +0x9d
main.main()
/private/tmp/go-jsonnet-20211222-86046-dhqer5/go-jsonnet-0.18.0/cmd/jsonnet-lint/cmd.go:183 +0x906
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.