File tree Expand file tree Collapse file tree 4 files changed +19
-4
lines changed
validation-test/compiler_crashers_2_fixed Expand file tree Collapse file tree 4 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -2531,11 +2531,11 @@ void PreCheckTarget::resolveKeyPathExpr(KeyPathExpr *KPE) {
2531
2531
(void )outermostExpr;
2532
2532
assert (OEE == outermostExpr);
2533
2533
expr = OEE->getSubExpr ();
2534
- } else if (auto AE = dyn_cast<ApplyExpr >(expr)) {
2534
+ } else if (auto CE = dyn_cast<CallExpr >(expr)) {
2535
2535
// foo(), foo(val value: Int) or unapplied foo
2536
2536
components.push_back (KeyPathExpr::Component::forUnresolvedApply (
2537
- getASTContext (), AE ->getArgs ()));
2538
- expr = AE ->getFn ();
2537
+ getASTContext (), CE ->getArgs ()));
2538
+ expr = CE ->getFn ();
2539
2539
} else {
2540
2540
if (emitErrors) {
2541
2541
// \(<expr>) may be an attempt to write a string interpolation outside
Original file line number Diff line number Diff line change @@ -407,7 +407,6 @@ _ = /\()/
407
407
// expected-error@-1 {{'/' is not a prefix unary operator}}
408
408
// expected-error@-2 {{'/' is not a postfix unary operator}}
409
409
// expected-error@-3 {{invalid component of Swift key path}}
410
- // expected-error@-4 {{type of expression is ambiguous without a type annotation}}
411
410
412
411
do {
413
412
let _: Regex = ( /whatever\)/
Original file line number Diff line number Diff line change @@ -46,3 +46,16 @@ func f_56996() {
46
46
_ = \Int . byteSwapped. signum ( ) // expected-error {{key path cannot refer to instance method 'signum()'}}
47
47
_ = \Int . byteSwapped. init ( ) // expected-error {{key path cannot refer to initializer 'init()'}}
48
48
}
49
+
50
+ postfix operator ^
51
+ postfix func ^ < T> ( _ x: T ) -> T { x }
52
+
53
+ func unsupportedOperator( ) {
54
+ struct S {
55
+ var x : Int
56
+ }
57
+ _ = \.^ // expected-error {{invalid component of Swift key path}}
58
+ _ = \S ^ // expected-error {{invalid component of Swift key path}}
59
+ _ = \S . x^ // expected-error {{invalid component of Swift key path}}
60
+ _ = \. x^ // expected-error {{invalid component of Swift key path}}
61
+ }
Original file line number Diff line number Diff line change
1
+ // {"signature":"(anonymous namespace)::ConstraintWalker::walkToExprPost(swift::Expr*)"}
2
+ // RUN: not %target-swift-frontend -typecheck %s
3
+ \.+=
You can’t perform that action at this time.
0 commit comments