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

[PORT][Expression]Enable list concatenation for function "concat" #2386

Merged
merged 2 commits into from
Jun 22, 2020

Conversation

Danieladu
Copy link
Contributor

Fixes #2373

concat:

  1. If all items are lists, concatenate them with list mode.
    concat([1, 2], [3, 4]) -> [1, 2, 3, 4]

  2. If there exists any item that is not a list, use string concatenation mode:
    concat('a', 'b', 1, 2) -> 'ab12'
    concat('a', [1, 2]) -> aSystem.Collections.Generic.List 1[System.Object] // unreadable, best to avoid

  3. If null exists, skip it
    concat([1, 2], null) -> [1, 2]
    concat('a', 1, null) -> 'a1'

@coveralls
Copy link

coveralls commented Jun 19, 2020

Pull Request Test Coverage Report for Build 139491

  • 19 of 20 (95.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 80.917%

Changes Missing Coverage Covered Lines Changed/Added Lines %
libraries/adaptive-expressions/src/expressionFunctions.ts 19 20 95.0%
Totals Coverage Status
Change from base Build 139207: 0.02%
Covered Lines: 12882
Relevant Lines: 15204

💛 - Coveralls

@Danieladu Danieladu changed the title [Expression]Enable list concatenation for function "concat" [PORT][Expression]Enable list concatenation for function "concat" Jun 19, 2020
Copy link
Contributor

@chrimc62 chrimc62 left a comment

Choose a reason for hiding this comment

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

:shipit:

@@ -1962,6 +1962,20 @@ export class ExpressionFunctions {
return res;
}

private static commonStringify(input: any): string {
if (input === null || input === undefined) {
Copy link
Contributor

Choose a reason for hiding this comment

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

(input === null || input === undefined [](start = 11, length = 38)

!input would be clearer and more idiomatic. It is also fine for the empty string case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but it is not fine for the boolean type false

@Danieladu Danieladu merged commit c86fe82 into master Jun 22, 2020
@Danieladu Danieladu deleted the hond/concatlist branch June 22, 2020 03:45
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.

[PORT] [Expression]Enable list concatenation for function "concat"
3 participants