diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/JBallerinaBackend.java b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/JBallerinaBackend.java index c73a5f91c9f5..df25d7cda64b 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/JBallerinaBackend.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/JBallerinaBackend.java @@ -291,6 +291,9 @@ protected Set getOptimizedPackageIDs() { private void markTestDependenciesForDuplicateBIRGen() { for (int i = pkgResolution.topologicallySortedModuleList().size() - 1; i >= 0; i--) { ModuleContext moduleContext = pkgResolution.topologicallySortedModuleList().get(i); + if (moduleContext.compilationState() != ModuleCompilationState.COMPILED) { + continue; + } BLangPackage bLangPackage = moduleContext.bLangPackage(); if (isRootModule(moduleContext) && bLangPackage.hasTestablePackage()) {