Skip to content

Type inference problem: expected {integer}, found i64 #354

@jonatcln

Description

@jonatcln

The following piece of code doesn't compile because of a type inference error:

fn value() -> i64 { 6 }

pub fn main() {
    let t = 2;
    t = loop { break value(); };
}

The error message:

error: expected `{integer}`, found `i64`
 --> mod.mun:5:9
  |
5 |     t = loop { break value(); };
  |         ^^^^^^^^^^^^^^^^^^^^^^^ expected `{integer}`, found `i64`
  |

Expected behavior: the code compiles without error. i64 is an integer type so the compiler should be able to infer that t is of type i64.

Edit: I'm using mun v0.3.0 (the pre-built binaries)

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