Skip to content

Conversation

@apolyakov
Copy link
Contributor

This PR addresses an issue related to type handling in futures. Consider the following example:

$f1 = fork(...); // future<int>
$f2 = fork(...); // future<array<int>>

$arr = [$f1, $f2]; // []future<mixed>
wait($f1);
wait($f2);

In this example, the array $arr is expected to contain elements of type future<mixed>. However, at the time of creation, the futures have different types: future<int> and future<array<int>>. To ensure correct type handling and conversion, the compiler needs to insert runtime type conversions.

This PR enables the generation of such runtime type conversions.

@apolyakov apolyakov added this to the next milestone Dec 23, 2025
@apolyakov apolyakov self-assigned this Dec 23, 2025
@apolyakov apolyakov added the k2 k2 related label Dec 23, 2025
Copy link
Contributor

@PetrShumilov PetrShumilov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@apolyakov apolyakov merged commit 4ae3966 into master Dec 24, 2025
7 checks passed
@apolyakov apolyakov deleted the apolyakov/k2-support-covariance-in-futures branch December 24, 2025 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

k2 k2 related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants