Skip to content

Commit 5717ce6

Browse files
authored
Merge branch 'main' into function-compose-n
2 parents 4bea8b4 + a430dea commit 5717ce6

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

vavr/generator/Generator.scala

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ val VARARGS = 10
2929
val TARGET_MAIN = s"${project.getBasedir()}/src-gen/main/java"
3030
val TARGET_TEST = s"${project.getBasedir()}/src-gen/test/java"
3131
val CHARSET = java.nio.charset.StandardCharsets.UTF_8
32+
val comment = "//"
33+
val javadoc = "**"
3234

3335
/**
3436
* ENTRY POINT
@@ -43,9 +45,6 @@ def run(): Unit = {
4345
*/
4446
def generateMainClasses(): Unit = {
4547

46-
// Workaround: Use /$javadoc instead of /** in a StringContext when IntelliJ IDEA otherwise shows up errors in the editor
47-
val javadoc = "**"
48-
4948
genAPI()
5049
genFunctions()
5150
genTuples()
@@ -3216,9 +3215,9 @@ def generateTestClasses(): Unit = {
32163215
// should return memoized value of second apply()
32173216
$assertThat(memo.apply(${(1 to i).gen(j => s"$j")(", ")})).isEqualTo(expected);
32183217
${(i > 0).gen(xs"""
3219-
// should calculate new values when called subsequently with different parameters
3218+
$comment should calculate new values when called subsequently with different parameters
32203219
$assertThat(memo.apply(${(1 to i).gen(j => s"${j + 1} ")(", ")})).isEqualTo(${(1 to i).gen(j => s"${j + 1} ")(" + ")} + 1);
3221-
// should return memoized value of second apply() (for new value)
3220+
$comment should return memoized value of second apply() (for new value)
32223221
$assertThat(memo.apply(${(1 to i).gen(j => s"${j + 1} ")(", ")})).isEqualTo(${(1 to i).gen(j => s"${j + 1} ")(" + ")} + 1);
32233222
""")}
32243223
}
@@ -3265,7 +3264,7 @@ def generateTestClasses(): Unit = {
32653264
assertThat(pf.isDefinedAt(0)).isTrue();
32663265
assertThat(pf.isDefinedAt(1)).isFalse();
32673266
assertThat(pf.apply(0)).isEqualTo("0");
3268-
assertThat(pf.apply(1)).isEqualTo("1"); // it is valid to return a value, even if isDefinedAt returns false
3267+
assertThat(pf.apply(1)).isEqualTo("1"); $comment it is valid to return a value, even if isDefinedAt returns false
32693268
}
32703269
"""})}
32713270

@@ -3337,7 +3336,7 @@ def generateTestClasses(): Unit = {
33373336
$assertThrows(${im.getType("java.security.NoSuchAlgorithmException")}.class, () -> {
33383337
$name$i<MessageDigest> digest = () -> ${im.getType("java.security.MessageDigest")}.getInstance("Unknown");
33393338
Function$i<MessageDigest> unchecked = digest.unchecked();
3340-
unchecked.apply(); // Look ma, we throw an undeclared checked exception!
3339+
unchecked.apply(); $comment Look ma, we throw an undeclared checked exception!
33413340
});
33423341
}
33433342

@@ -3404,7 +3403,7 @@ def generateTestClasses(): Unit = {
34043403
public void shouldUncheckedThrowIllegalState() {
34053404
$assertThrows(${im.getType("java.security.NoSuchAlgorithmException")}.class, () -> {
34063405
final Function$i<${(1 to i).gen(j => "String")(", ")}, MessageDigest> unchecked = digest.unchecked();
3407-
unchecked.apply(${toArgList("Unknown")}); // Look ma, we throw an undeclared checked exception!
3406+
unchecked.apply(${toArgList("Unknown")}); $comment Look ma, we throw an undeclared checked exception!
34083407
});
34093408
}
34103409

0 commit comments

Comments
 (0)