-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes crash while instrumenting generic func body embedded in another…
… func. The crash was caused by attempting to add logging expressions that capture generic variables while using the outer func decl context that was not the generic decl context of the inner (generic) func. The fix "pushes" the current func decl context into body instrumenting, then "popping" the context on return. Rather than always using the top-level func decl context for all nested func bodies.
- Loading branch information
1 parent
577945d
commit 4629e85
Showing
5 changed files
with
57 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
test/PlaygroundTransform/generic_func_in_local_scope.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// RUN: %empty-directory(%t) | ||
|
||
// Build PlaygroundSupport module | ||
// RUN: %target-build-swift -whole-module-optimization -module-name PlaygroundSupport -emit-module-path %t/PlaygroundSupport.swiftmodule -parse-as-library -c -o %t/PlaygroundSupport.o %S/Inputs/SilentPCMacroRuntime.swift %S/Inputs/PlaygroundsRuntime.swift | ||
|
||
// RUN: %target-build-swift -swift-version 5 -emit-module -Xfrontend -playground -I=%t %s | ||
// RUN: %target-build-swift -swift-version 6 -emit-module -Xfrontend -playground -I=%t %s | ||
|
||
// RUN: %target-build-swift -swift-version 5 -emit-module -Xfrontend -playground -Xfrontend -pc-macro -I=%t %s | ||
// RUN: %target-build-swift -swift-version 6 -emit-module -Xfrontend -playground -Xfrontend -pc-macro -I=%t %s | ||
|
||
// REQUIRES: executable_test | ||
|
||
import PlaygroundSupport | ||
|
||
func test1() { | ||
func buildBlock<Content>(content: Content) { | ||
content | ||
} | ||
} | ||
|
||
func test2() { | ||
func buildBlock<Content>(content: Content) -> Content { | ||
content | ||
return content | ||
} | ||
} | ||
|
||
func test3<Content>(_ content: Content) { | ||
func buildBlock<Content2>(_ content2: Content2) -> Content2 { | ||
return content2 | ||
} | ||
} |