Skip to content

Commit

Permalink
Remove newlines from hiding messages (#1333)
Browse files Browse the repository at this point in the history
  • Loading branch information
JPercival committed Feb 28, 2024
1 parent b72808c commit 2cc4d28
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3241,12 +3241,12 @@ private String resolveWarningMessage(String matchedIdentifier, String identifier

if (trackable instanceof Literal) {
return String.format(
"You used a string literal: [%s] here that matches an identifier in scope: [%s]. Did you mean to use the identifier instead? %n",
"You used a string literal: [%s] here that matches an identifier in scope: [%s]. Did you mean to use the identifier instead?",
identifierParam, matchedIdentifier);
}

return String.format(
"%s identifier [%s] is hiding another identifier of the same name. %n", elementString, identifierParam);
"%s identifier [%s] is hiding another identifier of the same name.", elementString, identifierParam);
}

private class Scope {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void testHiddenIdentifierFromReturn() throws IOException {
warnings.stream().map(Throwable::getMessage).collect(Collectors.toSet());
assertThat(
warningMessages,
contains(String.format("A let identifier [var] is hiding another identifier of the same name. %n")));
contains(String.format("A let identifier [var] is hiding another identifier of the same name.")));
}

@Test
Expand All @@ -50,9 +50,9 @@ public void testHidingUnionWithSameAlias() throws IOException {
assertThat(distinct.size(), is(2));

final String first = String.format(
"You used a string literal: [X] here that matches an identifier in scope: [X]. Did you mean to use the identifier instead? %n");
"You used a string literal: [X] here that matches an identifier in scope: [X]. Did you mean to use the identifier instead?");
final String second = String.format(
"You used a string literal: [Y] here that matches an identifier in scope: [Y]. Did you mean to use the identifier instead? %n");
"You used a string literal: [Y] here that matches an identifier in scope: [Y]. Did you mean to use the identifier instead?");

assertThat(distinct.toString(), distinct, containsInAnyOrder(first, second));
}
Expand All @@ -75,11 +75,11 @@ public void testHidingUnionWithSameAliasEachHides() throws IOException {
assertThat(distinct.size(), is(3));

final String first = String.format(
"You used a string literal: [X] here that matches an identifier in scope: [X]. Did you mean to use the identifier instead? %n");
"You used a string literal: [X] here that matches an identifier in scope: [X]. Did you mean to use the identifier instead?");
final String second = String.format(
"You used a string literal: [Y] here that matches an identifier in scope: [Y]. Did you mean to use the identifier instead? %n");
final String third = String.format(
"An alias identifier [IWantToBeHidden] is hiding another identifier of the same name. %n");
"You used a string literal: [Y] here that matches an identifier in scope: [Y]. Did you mean to use the identifier instead?");
final String third =
String.format("An alias identifier [IWantToBeHidden] is hiding another identifier of the same name.");

assertThat(distinct.toString(), distinct, containsInAnyOrder(first, second, third));
}
Expand All @@ -103,7 +103,7 @@ public void testSoMuchNestingHidingSimple() throws IOException {
assertThat(
warnings.stream().map(Throwable::getMessage).collect(Collectors.toList()),
containsInAnyOrder(String.format(
"An alias identifier [SoMuchNesting] is hiding another identifier of the same name. %n")));
"An alias identifier [SoMuchNesting] is hiding another identifier of the same name.")));
}

@Test
Expand All @@ -124,9 +124,9 @@ public void testSoMuchNestingHidingComplex() throws IOException {
assertThat(distinct.size(), is(2));

final String first =
String.format("An alias identifier [SoMuchNesting] is hiding another identifier of the same name. %n");
String.format("An alias identifier [SoMuchNesting] is hiding another identifier of the same name.");
final String second =
String.format("A let identifier [SoMuchNesting] is hiding another identifier of the same name. %n");
String.format("A let identifier [SoMuchNesting] is hiding another identifier of the same name.");

assertThat(distinct, containsInAnyOrder(first, second));
}
Expand All @@ -142,7 +142,7 @@ public void testHidingLetAlias() throws IOException {
assertThat(
warnings.stream().map(Throwable::getMessage).collect(Collectors.toList()),
containsInAnyOrder(
String.format("A let identifier [Alias] is hiding another identifier of the same name. %n")));
String.format("A let identifier [Alias] is hiding another identifier of the same name.")));
}

@Test
Expand All @@ -154,7 +154,7 @@ public void testHiddenIdentifierArgumentToAlias() throws IOException {
assertThat(
translator.getWarnings().stream().map(Throwable::getMessage).collect(Collectors.toList()),
contains(String.format(
"An alias identifier [testOperand] is hiding another identifier of the same name. %n")));
"An alias identifier [testOperand] is hiding another identifier of the same name.")));
}

@Test
Expand All @@ -175,7 +175,7 @@ public void testHidingFunctionDefinitionWithOverloads() throws IOException {
assertThat(
warningMessages,
contains(String.format(
"An alias identifier [IWantToBeHidden] is hiding another identifier of the same name. %n")));
"An alias identifier [IWantToBeHidden] is hiding another identifier of the same name.")));
}

@Test
Expand All @@ -189,7 +189,7 @@ public void testHidingParameterDefinition() throws IOException {
assertThat(
warningMessages,
contains(String.format(
"An alias identifier [Measurement Period] is hiding another identifier of the same name. %n")));
"An alias identifier [Measurement Period] is hiding another identifier of the same name.")));
}

@Test
Expand All @@ -203,7 +203,7 @@ public void testHidingIncludeDefinition() throws IOException {
assertThat(
warningMessages,
contains(String.format(
"An alias identifier [FHIRHelpers] is hiding another identifier of the same name. %n")));
"An alias identifier [FHIRHelpers] is hiding another identifier of the same name.")));
}

@Test
Expand All @@ -219,7 +219,7 @@ public void testHidingCommaMissingInListConstruction() throws IOException {
assertThat(distinctWarningMessages.toString(), distinctWarningMessages.size(), is(1));
assertThat(
distinctWarningMessages,
contains(String.format("An alias identifier [5] is hiding another identifier of the same name. %n")));
contains(String.format("An alias identifier [5] is hiding another identifier of the same name.")));
}

@Test
Expand All @@ -235,9 +235,9 @@ public void testHidingStringLiteral() throws IOException {
assertThat(distinctWarningMessages.toString(), distinctWarningMessages.size(), is(2));

final String stringLiteralIWantToBeHidden = String.format(
"You used a string literal: [IWantToBeHidden] here that matches an identifier in scope: [IWantToBeHidden]. Did you mean to use the identifier instead? %n");
"You used a string literal: [IWantToBeHidden] here that matches an identifier in scope: [IWantToBeHidden]. Did you mean to use the identifier instead?");
final String stringLiteralIWantToHide = String.format(
"You used a string literal: [IWantToHide] here that matches an identifier in scope: [IWantToHide]. Did you mean to use the identifier instead? %n");
"You used a string literal: [IWantToHide] here that matches an identifier in scope: [IWantToHide]. Did you mean to use the identifier instead?");
assertThat(distinctWarningMessages, containsInAnyOrder(stringLiteralIWantToBeHidden, stringLiteralIWantToHide));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -353,27 +353,27 @@ public void testHidingVariousUseCases() throws IOException {
assertThat(warningMessages.toString(), distinct.size(), is(11));

final String hidingDefinition =
String.format("An alias identifier [Definition] is hiding another identifier of the same name. %n");
String.format("An alias identifier [Definition] is hiding another identifier of the same name.");
final String hidingVarLet =
String.format("A let identifier [var] is hiding another identifier of the same name. %n");
String.format("A let identifier [var] is hiding another identifier of the same name.");
final String hidingContextValueSet =
String.format("An alias identifier [ValueSet] is hiding another identifier of the same name. %n");
String.format("An alias identifier [ValueSet] is hiding another identifier of the same name.");
final String hidingLetValueSet =
String.format("A let identifier [ValueSet] is hiding another identifier of the same name. %n");
String.format("A let identifier [ValueSet] is hiding another identifier of the same name.");
final String hidingContextCode =
String.format("An alias identifier [Code] is hiding another identifier of the same name. %n");
String.format("An alias identifier [Code] is hiding another identifier of the same name.");
final String hidingLetCode =
String.format("A let identifier [Code] is hiding another identifier of the same name. %n");
String.format("A let identifier [Code] is hiding another identifier of the same name.");
final String hidingContextCodeSystem =
String.format("An alias identifier [CodeSystem] is hiding another identifier of the same name. %n");
String.format("An alias identifier [CodeSystem] is hiding another identifier of the same name.");
final String hidingLetCodeSystem =
String.format("A let identifier [CodeSystem] is hiding another identifier of the same name. %n");
String.format("A let identifier [CodeSystem] is hiding another identifier of the same name.");
final String hidingContextFhir =
String.format("An alias identifier [FHIR] is hiding another identifier of the same name. %n");
String.format("An alias identifier [FHIR] is hiding another identifier of the same name.");
final String hidingLetFhir =
String.format("A let identifier [FHIR] is hiding another identifier of the same name. %n");
String.format("A let identifier [FHIR] is hiding another identifier of the same name.");
final String hidingAliasLet =
String.format("A let identifier [Alias] is hiding another identifier of the same name. %n");
String.format("A let identifier [Alias] is hiding another identifier of the same name.");

assertThat(
distinct,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ public void testOverload() throws IOException {
assertThat(warningMessages.toString(), translator.getWarnings().size(), is(2));

final String first = String.format(
"You used a string literal: [Encounter] here that matches an identifier in scope: [Encounter]. Did you mean to use the identifier instead? %n");
"You used a string literal: [Encounter] here that matches an identifier in scope: [Encounter]. Did you mean to use the identifier instead?");
final String second =
"The function TestOverload.Stringify has multiple overloads and due to the SignatureLevel setting (None), the overload signature is not being included in the output. This may result in ambiguous function resolution at runtime, consider setting the SignatureLevel to Overloads or All to ensure that the output includes sufficient information to support correct overload selection at runtime.";

Expand All @@ -872,7 +872,7 @@ public void testOverloadOutput() throws IOException {
warningMessages,
contains(
String.format(
"You used a string literal: [Encounter] here that matches an identifier in scope: [Encounter]. Did you mean to use the identifier instead? %n")));
"You used a string literal: [Encounter] here that matches an identifier in scope: [Encounter]. Did you mean to use the identifier instead?")));
}

@Test
Expand All @@ -885,7 +885,7 @@ public void testOverloadForward() throws IOException {
assertThat(warningMessages.toString(), translator.getWarnings().size(), is(2));

final String first = String.format(
"You used a string literal: [Encounter] here that matches an identifier in scope: [Encounter]. Did you mean to use the identifier instead? %n");
"You used a string literal: [Encounter] here that matches an identifier in scope: [Encounter]. Did you mean to use the identifier instead?");
final String second =
"The function TestOverloadForward.Stringify has multiple overloads and due to the SignatureLevel setting (None), the overload signature is not being included in the output. This may result in ambiguous function resolution at runtime, consider setting the SignatureLevel to Overloads or All to ensure that the output includes sufficient information to support correct overload selection at runtime.";

Expand All @@ -905,6 +905,6 @@ public void testOverloadForwardOutput() throws IOException {
warningMessages,
contains(
String.format(
"You used a string literal: [Encounter] here that matches an identifier in scope: [Encounter]. Did you mean to use the identifier instead? %n")));
"You used a string literal: [Encounter] here that matches an identifier in scope: [Encounter]. Did you mean to use the identifier instead?")));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void testAuthoringPatterns() throws IOException {
assertThat(translator.getWarnings().toString(), translator.getWarnings().size(), is(1));

final String first =
String.format("An alias identifier [Diabetes] is hiding another identifier of the same name. %n");
String.format("An alias identifier [Diabetes] is hiding another identifier of the same name.");

assertThat(
translator.getWarnings().stream().map(Throwable::getMessage).collect(Collectors.toList()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void testAuthoringPatterns() throws IOException {
assertThat(translator.getWarnings().toString(), translator.getWarnings().size(), is(1));

final String first =
String.format("An alias identifier [Diabetes] is hiding another identifier of the same name. %n");
String.format("An alias identifier [Diabetes] is hiding another identifier of the same name.");

assertThat(
translator.getWarnings().stream().map(Throwable::getMessage).collect(Collectors.toList()),
Expand Down

0 comments on commit 2cc4d28

Please sign in to comment.