From db0b569086556549c57b3faaea93208b03cdb9c5 Mon Sep 17 00:00:00 2001 From: dulaj Date: Mon, 10 Jun 2024 09:54:42 +0530 Subject: [PATCH] Address review comments --- .../ballerinalang/compiler/semantics/analyzer/Types.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/Types.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/Types.java index 3ad7f4e67044..24b542d353ab 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/Types.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/Types.java @@ -5685,8 +5685,9 @@ private BErrorType createErrorType(BType lhsType, BType rhsType, BType detailTyp BErrorType lhsErrorType = (BErrorType) lhsType; BErrorType rhsErrorType = (BErrorType) rhsType; - BErrorType errorType = createErrorType(detailType, lhsType.flags, env); - errorType.tsymbol.flags |= rhsType.flags; + long flags = lhsType.flags | rhsType.flags | Flags.PUBLIC; // Anonymous error intersection types must be public + + BErrorType errorType = createErrorType(detailType, flags, env); errorType.typeIdSet = BTypeIdSet.getIntersection(lhsErrorType.typeIdSet, rhsErrorType.typeIdSet); @@ -5695,8 +5696,7 @@ private BErrorType createErrorType(BType lhsType, BType rhsType, BType detailTyp public BErrorType createErrorType(BType detailType, long flags, SymbolEnv env) { String name = anonymousModelHelper.getNextAnonymousIntersectionErrorTypeName(env.enclPkg.packageID); - BErrorTypeSymbol errorTypeSymbol = Symbols.createErrorSymbol(flags | Flags.ANONYMOUS | Flags.PUBLIC, - Names.fromString(name), + BErrorTypeSymbol errorTypeSymbol = Symbols.createErrorSymbol(flags | Flags.ANONYMOUS, Names.fromString(name), env.enclPkg.symbol.pkgID, null, env.scope.owner, symTable.builtinPos, VIRTUAL); errorTypeSymbol.scope = new Scope(errorTypeSymbol);