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

Passing nameless argument to function requiring an implicit named argument fails #422

Open
BSteffaniak opened this issue Aug 23, 2022 · 0 comments

Comments

@BSteffaniak
Copy link
Member

BSteffaniak commented Aug 23, 2022

public trimEnd(var Int: end = count - 1, Char[] charsToTrim = WHITESPACE) -> String {
  while (end >= 0 && charsToTrim.contains(chars[end])) end--

  return end < 0 ? "" : substring(0, end + 1)
}

public trimEnd(Char charToTrim, var Int: end = count - 1) =>
  trimEnd(end, [charToTrim])

passes [charToTrim] as generated54: [charToTrim]

A workaround is to call the function like this: trimEnd(end, charsToTrim: [charToTrim])

@BSteffaniak BSteffaniak self-assigned this Aug 23, 2022
@BSteffaniak BSteffaniak changed the title Passing array literal to function requiring an implicit named argument fails Passing nameless argument to function requiring an implicit named argument fails Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

1 participant