Skip to content

Unreachable code is reached with roc test but not with roc #9636

@ageron

Description

@ageron

The following expect test fails with Unreachable crash when run with roc test, yet the same code works fine when run with roc:

expect {
	is_approx_eq(0.999995.F64, 1.00005.F64)
}

is_approx_eq : F64, F64 -> Bool
is_approx_eq = |x1, x2| {
	i1 = (x1 * 1000 + 0.5).to_u64_try() ?? { crash "Unreachable" }
	i2 = (x2 * 1000 + 0.5).to_u64_try() ?? { crash "Unreachable" }
	i1 == i2
}

main! = |_args| {
	dbg is_approx_eq(0.999995.F64, 1.00005.F64)
	Ok({})
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions