Skip to content

Two different enums joined by a ternary keep the first enum's names: Pure::cases() read back as Lvl cases. #567

Open

Description

@blacktrs

Summary

Two different enums joined by a ternary keep the first enum's names: Pure::cases() read back as Lvl cases.

Repro

<?php
enum Lvl: string { case A = 'a'; case B = 'b'; }
enum Pure { case X; }
function pick(bool $b): array { return $b ? Lvl::cases() : Pure::cases(); }
foreach (pick(true) as $c) { echo $c->name; }
foreach (pick(false) as $c) { echo $c->name; }
echo "\n";

Expected (php)

ABX

Actual (manticore e2f4385f, Darwin arm64)

ABA

Tracking

Known-bug repro: tests/aot/repro/wrong/enum_two_types_ternary_cases.php — bash tests/aot/xfail.sh -k enum_two_types_ternary_cases reports XFAIL while this is open and XPASS once it is fixed; then move the repro into tests/aot/cases/ and close this issue.

Activity

  1. added
    bug
    wrong-answer
    on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugwrong-answer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions