diff --git a/ets2panda/checker/types/typeRelation.cpp b/ets2panda/checker/types/typeRelation.cpp index c21bf71471f95ef592cf6762b266bdd5b09dfd64..9a50fa79787841d5ded0df8091d884e344c71ad6 100644 --- a/ets2panda/checker/types/typeRelation.cpp +++ b/ets2panda/checker/types/typeRelation.cpp @@ -234,13 +234,20 @@ bool TypeRelation::IsLegalBoxedPrimitiveConversion(Type *target, Type *source) return false; } - if (!target->AsETSObjectType()->IsBoxedPrimitive() || !source->AsETSObjectType()->IsBoxedPrimitive()) { + if (!target->AsETSObjectType()->IsBoxedPrimitive() && !source->AsETSObjectType()->IsBoxedPrimitive()) { return false; } Type *targetUnboxedType = checker->MaybeUnboxType(target); Type *sourceUnboxedType = checker->MaybeUnboxType(source); + if (target->IsETSIntEnumType()) { + targetUnboxedType = checker->GlobalIntType(); + } + if (source->IsETSIntEnumType()) { + targetUnboxedType = checker->GlobalIntType(); + } + if (targetUnboxedType == nullptr || sourceUnboxedType == nullptr) { return false; }