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

review: fix: replace Infinity, NaN in reflection model with divisions #5445

Merged
merged 2 commits into from
Sep 11, 2023

Conversation

SirYwell
Copy link
Collaborator

Fixes #5429.

(-)Infinity and NaN are no valid literals, but the reflection model previously built such literals, causing exceptions when printing them.

By representing those values by suitable divisions, we can still represent them in the model (as it is done in e.g. java.lang.Double).

df6ae1dfe89a6f3e

@SirYwell SirYwell marked this pull request as ready for review September 10, 2023 21:00
@SirYwell SirYwell changed the title wip: fix: replace Infinity, NaN in reflection model with divisions review: fix: replace Infinity, NaN in reflection model with divisions Sep 10, 2023
Comment on lines 965 to 976
Map.of(
"SpecialValues.java",
"public class SpecialValues {\n" +
" public static final double d_inf = 1.0d / 0.0d;\n" +
" public static final double d_m_inf = -1.0d / 0.0d;\n" +
" public static final double d_nan = 0.0d / 0.0d;\n" +
" public static final float f_inf = 1.0f / 0.0f;\n" +
" public static final float f_m_inf = -1.0f / 0.0f;\n" +
" public static final float f_nan = 0.0f / 0.0f;\n" +
"}\n"
),
List.of()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Map.of(
"SpecialValues.java",
"public class SpecialValues {\n" +
" public static final double d_inf = 1.0d / 0.0d;\n" +
" public static final double d_m_inf = -1.0d / 0.0d;\n" +
" public static final double d_nan = 0.0d / 0.0d;\n" +
" public static final float f_inf = 1.0f / 0.0f;\n" +
" public static final float f_m_inf = -1.0f / 0.0f;\n" +
" public static final float f_nan = 0.0f / 0.0f;\n" +
"}\n"
),
List.of()
Map.of(
"SpecialValues.java",
"public class SpecialValues {\n" +
" public static final double d_inf = 1.0d / 0.0d;\n" +
" public static final double d_m_inf = -1.0d / 0.0d;\n" +
" public static final double d_nan = 0.0d / 0.0d;\n" +
" public static final float f_inf = 1.0f / 0.0f;\n" +
" public static final float f_m_inf = -1.0f / 0.0f;\n" +
" public static final float f_nan = 0.0f / 0.0f;\n" +
"}\n"
),
List.of()

@I-Al-Istannen I-Al-Istannen merged commit adedea9 into INRIA:master Sep 11, 2023
11 checks passed
@SirYwell SirYwell deleted the printing-to-infinity branch September 12, 2023 05:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: "Can not convert Infinity to a double literal" when printing CtType<Double>
2 participants