Skip to content

Commit 125af80

Browse files
authored
Merge pull request #6741 from apple/revert-6737-revert-6719-fix-playground-transform-generics-3.1
Revert "Revert "Playground Transform: Fix assertion failure in generic code [3.1]""
2 parents 0daca09 + afa5482 commit 125af80

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

lib/Sema/PlaygroundTransform.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -741,8 +741,7 @@ class Instrumenter : InstrumenterBase {
741741
true, // let
742742
SourceLoc(), Context.getIdentifier(NameBuf),
743743
MaybeLoadInitExpr->getType(), TypeCheckDC);
744-
745-
VD->setInterfaceType(VD->getType());
744+
VD->setInterfaceType(TypeCheckDC->mapTypeOutOfContext(VD->getType()));
746745
VD->setImplicit();
747746

748747
NamedPattern *NP = new (Context) NamedPattern(VD, /*implicit*/ true);
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// RUN: rm -rf %t
2+
// RUN: mkdir -p %t
3+
// RUN: cp %s %t/main.swift
4+
// RUN: %target-build-swift -Xfrontend -playground -Xfrontend -debugger-support -o %t/main %S/Inputs/PlaygroundsRuntime.swift %t/main.swift
5+
// RUN: %target-run %t/main | %FileCheck %s
6+
// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -Xfrontend -debugger-support -o %t/main %S/Inputs/PlaygroundsRuntime.swift %S/Inputs/SilentPCMacroRuntime.swift %t/main.swift
7+
// RUN: %target-run %t/main | %FileCheck %s
8+
// REQUIRES: executable_test
9+
10+
func id<T>(_ t: T) -> T {
11+
return t
12+
}
13+
14+
for i in 0..<3 {
15+
_ = id(i)
16+
}
17+
18+
// CHECK: $builtin_log_scope_entry
19+
// CHECK-NEXT: $builtin_log_scope_entry
20+
// CHECK-NEXT: $builtin_log[='0']
21+
// CHECK-NEXT: $builtin_log_scope_exit
22+
// CHECK-NEXT: $builtin_log[='0']
23+
// CHECK-NEXT: $builtin_log_scope_exit
24+
// CHECK-NEXT: $builtin_log_scope_entry
25+
// CHECK-NEXT: $builtin_log_scope_entry
26+
// CHECK-NEXT: $builtin_log[='1']
27+
// CHECK-NEXT: $builtin_log_scope_exit
28+
// CHECK-NEXT: $builtin_log[='1']
29+
// CHECK-NEXT: $builtin_log_scope_exit
30+
// CHECK-NEXT: $builtin_log_scope_entry
31+
// CHECK-NEXT: $builtin_log_scope_entry
32+
// CHECK-NEXT: $builtin_log[='2']
33+
// CHECK-NEXT: $builtin_log_scope_exit
34+
// CHECK-NEXT: $builtin_log[='2']
35+
// CHECK-NEXT: $builtin_log_scope_exit

0 commit comments

Comments
 (0)