diff --git a/lint/go.mod b/lint/go.mod index 64804cd7..c988858c 100644 --- a/lint/go.mod +++ b/lint/go.mod @@ -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 diff --git a/lint/go.sum b/lint/go.sum index 967670b7..13405452 100644 --- a/lint/go.sum +++ b/lint/go.sum @@ -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= diff --git a/lint/unused_import_analyzer.go b/lint/unused_import_analyzer.go index 973fb11c..5c3ba943 100644 --- a/lint/unused_import_analyzer.go +++ b/lint/unused_import_analyzer.go @@ -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