Skip to content

Comparing a typed tuple with a tuple literal fails MIR validation: literal elements stay i32 #1996

Closed

Description

@ehartford

Found while fixing #1964; reproduces on the fix-1438 base stage1.

fn main:
    let u: (i8, i64) = (1, 2)
    print(f"{u == (1, 2)}")
DEBUG cmp fail: lhs_ty=... lhs_kind=10 rhs_ty=... rhs_kind=10
error: invalid MIR before codegen: comparison operands have incompatible MIR types

The literal (1, 2) is typed (i32, i32) instead of taking the expected type from the other operand, as an integer literal does in x == 1. Expected: true. (Also: a DEBUG cmp fail: line is printed to the user.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions