Skip to content
Open
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
2 changes: 1 addition & 1 deletion lint/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.25.0

require (
github.com/logrusorgru/aurora v2.0.3+incompatible
github.com/onflow/cadence v1.10.2
github.com/onflow/cadence v1.10.3-0.20260416181305-e8fe69bc408a
github.com/onflow/flow-go-sdk v1.10.2
github.com/stretchr/testify v1.11.1
google.golang.org/grpc v1.79.3
Expand Down
4 changes: 2 additions & 2 deletions lint/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/onflow/atree v0.16.0 h1:b+f/suzcnnr1Lx1KdJEjpn2CX+AKSAz1yIB30NQDutU=
github.com/onflow/atree v0.16.0/go.mod h1:hiOT/vKK/Zyw34Ru9OFbfEemC5NnQ7SHFB43bN9/4qI=
github.com/onflow/cadence v1.10.2 h1:wa0olSOUNgcxAxjJHbMU+zsvxzFXkm+FNANQTsfpdr8=
github.com/onflow/cadence v1.10.2/go.mod h1:tyUNaYlAgeQVgfR2C38MI1dtFFjKay+yGGPMrCRc068=
github.com/onflow/cadence v1.10.3-0.20260416181305-e8fe69bc408a h1:NIzKakxSE0vLSbbVMJNJEOvH9DQCLpUNz8OY37T0Luw=
github.com/onflow/cadence v1.10.3-0.20260416181305-e8fe69bc408a/go.mod h1:tyUNaYlAgeQVgfR2C38MI1dtFFjKay+yGGPMrCRc068=
github.com/onflow/crypto v0.25.3 h1:XQ3HtLsw8h1+pBN+NQ1JYM9mS2mVXTyg55OldaAIF7U=
github.com/onflow/crypto v0.25.3/go.mod h1:+1igaXiK6Tjm9wQOBD1EGwW7bYWMUGKtwKJ/2QL/OWs=
github.com/onflow/fixed-point v0.1.1 h1:j0jYZVO8VGyk1476alGudEg7XqCkeTVxb5ElRJRKS90=
Expand Down
58 changes: 0 additions & 58 deletions lint/unused_import_analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,64 +119,6 @@ var UnusedImportAnalyzer = (func() *analysis.Analyzer {
}
},
)
// TODO: Remove the below section once https://github.com/onflow/cadence/issues/4470 is fixed.
// The Walk methods for composite, interface, and attachment declarations
// do not recurse into conformance lists, attachment base types, or
// entitlement access specifiers, so the inspector never visits the
// NominalType nodes there. Check those positions explicitly.

markNominalTypeUsed := func(t *ast.NominalType) {
name := t.Identifier.Identifier
if _, isImported := importedNames[name]; isImported {
usedImports[name] = struct{}{}
}
}

markEntitlementAccessUsed := func(access ast.Access) {
entAccess, ok := access.(ast.EntitlementAccess)
if !ok {
return
}
for _, e := range entAccess.EntitlementSet.Entitlements() {
markNominalTypeUsed(e)
}
}

inspector.Preorder(
[]ast.Element{
(*ast.CompositeDeclaration)(nil),
(*ast.InterfaceDeclaration)(nil),
(*ast.AttachmentDeclaration)(nil),
(*ast.FunctionDeclaration)(nil),
(*ast.FieldDeclaration)(nil),
},
func(element ast.Element) {
switch decl := element.(type) {
case *ast.CompositeDeclaration:
markEntitlementAccessUsed(decl.Access)
for _, c := range decl.Conformances {
markNominalTypeUsed(c)
}
case *ast.InterfaceDeclaration:
markEntitlementAccessUsed(decl.Access)
for _, c := range decl.Conformances {
markNominalTypeUsed(c)
}
case *ast.AttachmentDeclaration:
markEntitlementAccessUsed(decl.Access)
if decl.BaseType != nil {
markNominalTypeUsed(decl.BaseType)
}
for _, c := range decl.Conformances {
markNominalTypeUsed(c)
}
case *ast.FunctionDeclaration:
markEntitlementAccessUsed(decl.Access)
case *ast.FieldDeclaration:
markEntitlementAccessUsed(decl.Access)
}
},
)

// Collect unused imports.
// For implicit imports, we only report if ALL imports from that declaration are unused
Expand Down
Loading