Skip to content

Commit

Permalink
Merge pull request #42738 from chiranSachintha/fix-42728
Browse files Browse the repository at this point in the history
Fix file too large error due to unnecessary node cloning
  • Loading branch information
chiranSachintha authored May 22, 2024
2 parents 0b650e5 + f68436c commit c09a92c
Show file tree
Hide file tree
Showing 5 changed files with 439 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1893,18 +1893,12 @@ private BType checkListConstructorCompatibility(BType referredType, BType origin
return new BTypedescType(listConstructor.typedescType, null);
}

BLangListConstructorExpr exprToLog = listConstructor;
if (data.commonAnalyzerData.nonErrorLoggingCheck) {
listConstructor.cloneAttempt++;
exprToLog = nodeCloner.cloneNode(listConstructor);
}

if (referredType == symTable.semanticError) {
// Ignore the return value, we only need to visit the expressions.
getInferredTupleType(exprToLog, symTable.semanticError, data);
} else {
getInferredTupleType(listConstructor, symTable.semanticError, data);
} else if (!data.commonAnalyzerData.nonErrorLoggingCheck) {
dlog.error(listConstructor.pos, DiagnosticErrorCode.INCOMPATIBLE_TYPES, originalType,
getInferredTupleType(exprToLog, symTable.noType, data));
getInferredTupleType(listConstructor, symTable.noType, data));
}

return symTable.semanticError;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ public void testLargeMethods3() {
BRunUtil.runMain(testLargeMethods3Result);
}

public void testLargeMethods4() {
BCompileUtil.compile("test-src/jvm/largeMethods4");
}

@Test
public void testLargeNumberOfListeners() {
CompileResult compileResult = BCompileUtil.compile("test-src/jvm/large-number-of-listeners.bal");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
target
Dependencies.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[build-options]
observabilityIncluded = false

[package]
org = "testOrg"
name = "largeMethods4"
version = "0.1.0"
Loading

0 comments on commit c09a92c

Please sign in to comment.