From fefd6ed0a3286be6847855f2ae1589bf036cbf59 Mon Sep 17 00:00:00 2001 From: poorna2152 Date: Sun, 7 Jul 2024 15:21:03 +0530 Subject: [PATCH] Add tsymbol --- .../compiler/semantics/analyzer/Types.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 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 611a57d3d60d..fe8cdaa12244 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 @@ -168,7 +168,6 @@ public class Types { private BLangDiagnosticLog dlog; private Names names; private int finiteTypeCount = 0; - private BUnionType expandedXMLBuiltinSubtypes; private final BLangAnonymousModelHelper anonymousModelHelper; private int recordCount = 0; private SymbolEnv env; @@ -200,9 +199,6 @@ public Types(CompilerContext context) { this.symResolver = SymbolResolver.getInstance(context); this.dlog = BLangDiagnosticLog.getInstance(context); this.names = Names.getInstance(context); - this.expandedXMLBuiltinSubtypes = BUnionType.create(null, - symTable.xmlElementType, symTable.xmlCommentType, - symTable.xmlPIType, symTable.xmlTextType); this.unifier = new Unifier(); this.anonymousModelHelper = BLangAnonymousModelHelper.getInstance(context); } @@ -2062,10 +2058,14 @@ private BType getTypedBindingPatternTypeForXmlCollection(BType collectionType) { case TypeTags.NEVER: return constraint; case TypeTags.UNION: + BTypeSymbol collectionTSymbol = collectionType.tsymbol; + BTypeSymbol typeSymbol = + Symbols.createTypeSymbol(SymTag.UNION_TYPE, Flags.asMask(EnumSet.of(Flag.PUBLIC)), Names.EMPTY, + collectionTSymbol.pkgID, null, collectionTSymbol.owner, symTable.builtinPos, VIRTUAL); Set collectionTypes = getEffectiveMemberTypes((BUnionType) constraint); - Set builtinXMLConstraintTypes = getEffectiveMemberTypes - ((BUnionType) ((BXMLType) symTable.xmlType).constraint); - return BUnionType.create(null, (LinkedHashSet) collectionTypes); + BType type = BUnionType.create(typeSymbol, (LinkedHashSet) collectionTypes); + typeSymbol.type = type; + return type; default: return null; }