Skip to content

Commit 2b98123

Browse files
committed
[PlaygroundTransform] Don't log the results of functions that return ().
The fix for missing logging for += accidentally made us log ALL functions that return (), not just the ones that happen to touch inout parameters. That's not really desirable, and resulted from a missing testcase. This fixes the problem and adds a testcase. <rdar://problem/27995558>
1 parent 111db9e commit 2b98123

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

lib/Sema/PlaygroundTransform.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,9 +621,9 @@ class Instrumenter {
621621
Elements.insert(Elements.begin() + (EI + 1), *Log);
622622
++EI;
623623
}
624-
Handled = true;
625624
}
626625
}
626+
Handled = true; // Never log ()
627627
}
628628
if (!Handled) {
629629
// do the same as for all other expressions
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// RUN: rm -rf %t && mkdir %t
2+
// RUN: cp %s %t/main.swift
3+
// RUN: %target-build-swift -Xfrontend -playground -Xfrontend -debugger-support -o %t/main %S/Inputs/PlaygroundsRuntime.swift %t/main.swift
4+
// RUN: %target-run %t/main | %FileCheck %s
5+
// REQUIRES: executable_test
6+
func foo() { }
7+
foo()
8+
1+2
9+
// CHECK: {{.*}} $builtin_log[='3']

0 commit comments

Comments
 (0)