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

Improved UI error messages when the parameter must be a constant #74893

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Updated auxiliar method that converts int to ordinal number
  • Loading branch information
GrayFox1 committed Jul 22, 2021
commit c26a4896cd85fc9ab665166be9c4b641a87f9791
Original file line number Diff line number Diff line change
@@ -834,14 +834,9 @@ public void visitInvokeCallMember(InvokeCallMemberNode irInvokeCallMemberNode, C

private String convertIntToOrdinal(int i) {
String[] suffixes = new String[] { "th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th" };
switch (i % 100) {
case 11:
case 12:
case 13:
return i + "th";
default:
return i + suffixes[i % 10];
}
int aux = i % 100;
if(aux == 11 || aux == 12 || aux == 13) return i + "th";
return i + suffixes[i % 10];
}
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure we can just lift code from https://stackoverflow.com/questions/6810336/is-there-a-way-in-java-to-convert-an-integer-to-its-ordinal-name/6810409#6810409 - it's CC-BY-SA and we're dual SSPL/Elastic v2. I don't know.


private void replaceCallWithConstant(