@@ -427,21 +427,10 @@ private fun isSyntheticFieldAccess(methodName: String): Boolean =
427
427
methodName.contains(" access\$ get" ) || methodName.contains(" access\$ set" )
428
428
429
429
/* *
430
- * Merges fun$default(...) calls.
431
- * Kotlin functions with default values are represented as two nested calls in the stack trace.
432
- * For example:
433
- * ```
434
- * A.calLMe$default(A#1, 3, null, 2, null) at A.operation(A.kt:23)
435
- * A.callMe(3, "Hey") at A.callMe$default(A.kt:27)
436
- * ```
437
- *
438
- * This function collapses such pairs in the provided [callStackTrace]:
430
+ * Merges two consecutive calls in the stack trace into one call if they form a compressible pair,
431
+ * see [isCompressiblePair] for details.
439
432
*
440
- * ```
441
- * A.callMe(3, "Hey") at A.operation(A.kt:23)
442
- * ```
443
- *
444
- * Since each tracePoint itself contains a [callStackTrace] of it's own,
433
+ * Since each tracePoint itself contains a [callStackTrace] of its own,
445
434
* we need to recursively traverse each point.
446
435
*/
447
436
private fun compressCallStackTrace (
@@ -471,9 +460,8 @@ private fun compressCallStackTrace(
471
460
break
472
461
}
473
462
474
- // Check if current and next are a "default" or "access" combo
475
- if (isDefaultPair(currentElement.tracePoint.methodName, nextElement.tracePoint.methodName)
476
- || isAccessPair(currentElement.tracePoint.methodName, nextElement.tracePoint.methodName)) {
463
+ // Check if current and next are compressible
464
+ if (isCompressiblePair(currentElement.tracePoint.methodName, nextElement.tracePoint.methodName)) {
477
465
// Combine fields of next and current, and store in current
478
466
currentElement.tracePoint.methodName = nextElement.tracePoint.methodName
479
467
currentElement.tracePoint.parameters = nextElement.tracePoint.parameters
@@ -509,22 +497,50 @@ private fun actorNodeResultRepresentation(result: Result?, failure: LincheckFail
509
497
}
510
498
}
511
499
500
+ private fun isCompressiblePair (currentName : String , nextName : String ): Boolean =
501
+ isDefaultPair(currentName, nextName) || isAccessPair(currentName, nextName)
502
+
512
503
/* *
513
- * Default pair example:
504
+ * Used by [compressCallStackTrace] to merge `fun$default(...)` calls.
505
+ *
506
+ * Kotlin functions with default values are represented as two nested calls in the stack trace.
507
+ *
508
+ * For example:
509
+ *
514
510
* ```
515
511
* A.calLMe$default(A#1, 3, null, 2, null) at A.operation(A.kt:23)
516
- * A.callMe(3, "Hey") at A.callMe$default(A.kt:27)
517
- *```
512
+ * A.callMe(3, "Hey") at A.callMe$default(A.kt:27)
513
+ * ```
514
+ *
515
+ * will be collapsed into:
516
+ *
517
+ * ```
518
+ * A.callMe(3, "Hey") at A.operation(A.kt:23)
519
+ * ```
520
+ *
518
521
*/
519
522
private fun isDefaultPair (currentName : String , nextName : String ): Boolean =
520
523
currentName == " ${nextName} \$ default"
521
524
522
525
/* *
523
- * Access pair example:
526
+ * Used by [compressCallStackTrace] to merge `.access$` calls.
527
+ *
528
+ * The `.access$` methods are generated by the Kotlin compiler to access otherwise inaccessible members
529
+ * (e.g., private) from lambdas, inner classes, etc.
530
+ *
531
+ * For example:
532
+ *
524
533
* ```
525
534
* A.access$callMe() at A.operation(A.kt:N)
526
- * A.callMe() at A.callMe$default(A.kt:N)
527
- *```
535
+ * A.callMe() at A.access$callMe(A.kt:N)
536
+ * ```
537
+ *
538
+ * will be collapsed into:
539
+ *
540
+ * ```
541
+ * A.callMe() at A.operation(A.kt:N)
542
+ * ```
543
+ *
528
544
*/
529
545
private fun isAccessPair (currentName : String , nextName : String ): Boolean =
530
546
currentName == " access$${nextName} "
0 commit comments