Runtime: enum type descriptor returns enum tag for nested enum value in single case payload (release-only) #61708
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler itself
IRGen
LLVM IR generation
optimized only
Flag: An issue whose reproduction requires optimized compilation
Describe the bug
Given the following nested enums:
Using the runtime to inspect the enum "tag" of
E1.c1(.c2(true))
should result in returning0
to match the index of its only case,c1
.And it does...in debug configurations.
In release configurations it returns
1
instead, which reflects the nested tag,E2.c2(true)
.Steps To Reproduce
I'm using @Azoy's Echo for ease of access to the Swift runtime metadata. In particular I am using @ole's PR fork, which adds support for release builds.
Steps to reproduce the behavior:
Clone https://github.com/stephencelis/EnumRuntimeBug
cd EnumRuntimeBug
Run this code:
https://github.com/stephencelis/EnumRuntimeBug/blob/01e5ee9ee92594930df8040da8c4b4e1eebc3c94/Sources/EnumRuntimeBug/main.swift#L1-L21
And compare in debug/release:
Expected behavior
Both debug and release should evaluate the same enum tag and print
tag 0
.Screenshots
If applicable, add screenshots to help explain your problem.
Environment (please fill out the following information)
The text was updated successfully, but these errors were encountered: