File tree Expand file tree Collapse file tree 2 files changed +26
-6
lines changed Expand file tree Collapse file tree 2 files changed +26
-6
lines changed Original file line number Diff line number Diff line change @@ -2744,11 +2744,13 @@ Type constraints::isPlaceholderVar(PatternBindingDecl *PB) {
2744
2744
return Type ();
2745
2745
2746
2746
auto *pattern = PB->getPattern (0 );
2747
- if (auto *typedPattern = dyn_cast<TypedPattern>(pattern)) {
2748
- auto type = typedPattern->getType ();
2749
- if (type && type->hasPlaceholder ())
2750
- return type;
2751
- }
2747
+ auto *typedPattern = dyn_cast<TypedPattern>(pattern);
2748
+ if (!typedPattern || !typedPattern->hasType ())
2749
+ return Type ();
2750
+
2751
+ auto type = typedPattern->getType ();
2752
+ if (!type->hasPlaceholder ())
2753
+ return Type ();
2752
2754
2753
- return Type () ;
2755
+ return type ;
2754
2756
}
Original file line number Diff line number Diff line change
1
+ // RUN: %empty-directory(%t)
2
+ // RUN: split-file %s %t
3
+
4
+ // RUN: %target-swift-frontend -typecheck -verify -primary-file %t/a.swift %t/b.swift -plugin-path %swift-plugin-dir
5
+
6
+ //--- a.swift
7
+
8
+ func foo( ) {
9
+ _ = {
10
+ let i = 0
11
+ $bar. withValue ( i) { }
12
+ }
13
+ }
14
+
15
+ //--- b.swift
16
+
17
+ @TaskLocal
18
+ var bar : Int ?
You can’t perform that action at this time.
0 commit comments