Skip to content

Calls not being resolved in if statements #1185

@Turupawn

Description

@Turupawn

Currently, the following fe code:

fn helper(x: u64) -> u64 { x + 1 }

pub fn test_if_else(x: u64) -> u64 {
    if x > 10 {
        let x : u64 = helper(x: 67)
        x
    } else {
        10
    }
}

Compiles to this:

function helper(x) -> ret {
  ret := add(x, 1)
}
function test_if_else(x) -> ret {
  let v0 := 0
  if gt(x, 10) {
    v0 := x
  }
  if iszero(gt(x, 10)) {
    v0 := 10
  }
  ret := v0
}

Notice the helper function is never called.

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