diff --git a/ets2panda/checker/ets/function.cpp b/ets2panda/checker/ets/function.cpp index 2e5149daf65f6b7d2c0ae8b3381a3e24108ebe10..9ad18a0a15a62eadd4ce24f4eb92ee8d8a393f9b 100644 --- a/ets2panda/checker/ets/function.cpp +++ b/ets2panda/checker/ets/function.cpp @@ -875,10 +875,17 @@ void ETSChecker::SearchAmongMostSpecificTypes(Type *&mostSpecificType, Signature } if (isClassType && sigType->AsETSObjectType()->IsBoxedPrimitive() && mostSpecificType->IsETSObjectType() && mostSpecificType->AsETSObjectType()->IsBoxedPrimitive()) { + // NOTE (smartin): when a param with type int is available, make it more specific than other primitive + // types. The making of correct rules for this is still in progress in spec, so this is a temp solution. + if (mostSpecificType->AsETSObjectType()->HasObjectFlag(ETSObjectFlags::BUILTIN_INT)) { + return; + } + TypeRelationFlag flags = TypeRelationFlag::NO_THROW | TypeRelationFlag::UNBOXING | TypeRelationFlag::BOXING | TypeRelationFlag::WIDENING; Relation()->SetFlags(flags); - if (Relation()->IsLegalBoxedPrimitiveConversion(mostSpecificType, sigType)) { + if (sigType->AsETSObjectType()->HasObjectFlag(ETSObjectFlags::BUILTIN_INT) || + Relation()->IsLegalBoxedPrimitiveConversion(mostSpecificType, sigType)) { Relation()->Result(true); mostSpecificType = sigType; prevSig = sig;