Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected compile error using a typed constant #1517

Closed
joshring opened this issue Oct 4, 2024 · 2 comments
Closed

Unexpected compile error using a typed constant #1517

joshring opened this issue Oct 4, 2024 · 2 comments
Assignees
Labels
Bug Something isn't working Fixed Needs Verification Fixed, but needs verification that it works
Milestone

Comments

@joshring
Copy link
Contributor

joshring commented Oct 4, 2024

module test;
import std::math;

const float M_PI = 3.14159265358979323846;

fn void main()
{
    double error_here = math::copysign(M_PI / 2, 1.0000);
}

Error: @require "values::@assign_to(sgn, values::promote_int(mag))" violated.

but replacing 2 with 2.0 works

module test;
import std::math;

const float M_PI = 3.14159265358979323846;

fn void main()
{
    double error_here = math::copysign(M_PI / 2.0, 1.0000);
}

or replacing the const with it's value:

module test;
import std::math;

fn void main()
{
    double error_here = math::copysign(3.14159265358979323846 / 2, 1.0000);
}
@lerno lerno self-assigned this Oct 4, 2024
@lerno lerno added Bug Something isn't working In Progress This task is currently being worked on labels Oct 4, 2024
@lerno lerno added this to the 0.6.4 milestone Oct 4, 2024
@lerno lerno added Fixed Needs Verification Fixed, but needs verification that it works and removed In Progress This task is currently being worked on labels Oct 4, 2024
@lerno
Copy link
Collaborator

lerno commented Oct 4, 2024

This was a too strict contract, please try now.

@joshring
Copy link
Contributor Author

joshring commented Oct 4, 2024

Nice one

@joshring joshring closed this as completed Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Fixed Needs Verification Fixed, but needs verification that it works
Projects
None yet
Development

No branches or pull requests

2 participants