forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Constraint solver] Fix backward trailing closures with ".member" exp…
…ressions The introduction of forward-scan matching for trailing closures (SE-0286) failed to account for unresolved member expressions, sometimes causing a crash in SILGen. Fixes rdar://problem/67781123.
- Loading branch information
1 parent
6ad2757
commit 0b2b7b5
Showing
2 changed files
with
22 additions
and
1 deletion.
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
19 changes: 19 additions & 0 deletions
19
test/expr/postfix/call/forward_trailing_closure_unresolved_member.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,19 @@ | ||
// RUN: %target-swift-emit-silgen %s | %FileCheck %s | ||
|
||
// rdar://problem/67781123 - crash in SILGen | ||
|
||
struct Foo { | ||
var title: String | ||
var handler1: ((Int, String) -> Void)? | ||
var handler2: (() -> Void)? | ||
} | ||
|
||
func take(foo: Foo) { } | ||
|
||
// CHECK-LABEL: sil hidden [ossa] @$s42forward_trailing_closure_unresolved_member4testyy | ||
func test() { | ||
// CHECK: function_ref @$s42forward_trailing_closure_unresolved_member4testyyFyycfU_ : $@convention(thin) () -> () | ||
take(foo: .init(title: "") { | ||
print("handler2 is called") | ||
}) | ||
} |