Skip to content

Type checks of the SwitchExpression are incomplete

test case

unit temp

function main(): s32
{
    var s32 a;
    const u64 v = switch a do
    {
        0 => 0,
        1 => 0:s8
    };
    return 0;
}    

output

error, the IR for unit temp is invalid
PHI node operands are not the same type as the result!
%0.8.0 = phi i32 [ 0, %8 ], [ 0, %9 ]

notes

  • There are some cast missing when castExpressionsToCommonType is called on the array of values.
  • Might affect ArrayExpression sema as well, as it is verified using castExpressionsToCommonType too.
Edited by Basile.B