Code review comment: Aren't we implementing record-record intersection here? If so shouldn't we change the check in L2808 to just  `targetType.tag != TypeTags.MAP`  @dulvinw is probably implementing record-record intersection though.

Code before review:
public Set<BType> expandAndGetMemberTypesRecursive(BType bType) {
Set<BType> memberTypes = new LinkedHashSet<>();
switch (bType.tag) {
case TypeTags.BYTE:
case TypeTags.INT:
memberTypes.add(symTable.intType);
memberTypes.add(symTable.byteType);
break;
case TypeTags.FINITE:
BFiniteType expType = (BFiniteType) bType;
expType.getValueSpace().forEach(value -> {
memberTypes.add(value.type);
});
break;
case TypeTags.UNION:
BUnionType unionType = (BUnionType) bType;
unionType.getMemberTypes().forEach(member -> {
memberTypes.addAll(expandAndGetMemberTypesRecursive(member));
});
break;
case TypeTags.ARRAY:
BType arrayElementType = ((BArrayType) bType).getElementType();
if (((BArrayType) bType).getSize() != -1) {
memberTypes.add(new BArrayType(arrayElementType));
}
if (arrayElementType.tag == TypeTags.UNION) {
Set<BType> elementUnionTypes = expandAndGetMemberTypesRecursive(arrayElementType);
elementUnionTypes.forEach(elementUnionType -> {
memberTypes.add(new BArrayType(elementUnionType));
});
}
memberTypes.add(bType);
break;
case TypeTags.MAP:
BType mapConstraintType = ((BMapType) bType).getConstraint();
if (mapConstraintType.tag == TypeTags.UNION) {
Set<BType> constraintUnionTypes = expandAndGetMemberTypesRecursive(mapConstraintType);
constraintUnionTypes.forEach(constraintUnionType -> {
memberTypes.add(new BMapType(TypeTags.MAP, constraintUnionType, symTable.mapType.tsymbol));
});
}
memberTypes.add(bType);
break;
default:
memberTypes.add(bType);
}
return memberTypes;
}

Line under review: switch (bType.tag) {

Code after addressing the review:
public Set<BType> expandAndGetMemberTypesRecursive(BType bType) {
Set<BType> memberTypes = new LinkedHashSet<>();
switch (bType.tag) {
case TypeTags.BYTE:
case TypeTags.INT:
memberTypes.add(symTable.intType);
memberTypes.add(symTable.byteType);
break;
case TypeTags.FINITE:
BFiniteType expType = (BFiniteType) bType;
expType.getValueSpace().forEach(value -> {
memberTypes.add(value.type);
});
break;
case TypeTags.UNION:
BUnionType unionType = (BUnionType) bType;
unionType.getMemberTypes().forEach(member -> {
memberTypes.addAll(expandAndGetMemberTypesRecursive(member));
});
break;
case TypeTags.ARRAY:
BType arrayElementType = ((BArrayType) bType).getElementType();
if (((BArrayType) bType).getSize() != -1) {
memberTypes.add(new BArrayType(arrayElementType));
}
if (arrayElementType.tag == TypeTags.UNION) {
Set<BType> elementUnionTypes = expandAndGetMemberTypesRecursive(arrayElementType);
elementUnionTypes.forEach(elementUnionType -> {
memberTypes.add(new BArrayType(elementUnionType));
});
}
memberTypes.add(bType);
break;
case TypeTags.MAP:
BType mapConstraintType = ((BMapType) bType).getConstraint();
if (mapConstraintType.tag == TypeTags.UNION) {
Set<BType> constraintUnionTypes = expandAndGetMemberTypesRecursive(mapConstraintType);
constraintUnionTypes.forEach(constraintUnionType -> {
memberTypes.add(new BMapType(TypeTags.MAP, constraintUnionType, symTable.mapType.tsymbol));
});
}
memberTypes.add(bType);
break;
default:
memberTypes.add(bType);
}
return memberTypes;
}