File tree Expand file tree Collapse file tree 2 files changed +29
-3
lines changed
validation-test/compiler_crashers_2_fixed Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -1406,9 +1406,7 @@ namespace {
1406
1406
}
1407
1407
1408
1408
Type visitDynamicMemberRefExpr (DynamicMemberRefExpr *expr) {
1409
- return addMemberRefConstraints (expr, expr->getBase (),
1410
- expr->getMember ().getDecl (),
1411
- /* FIXME:*/ FunctionRefKind::DoubleApply);
1409
+ llvm_unreachable (" Already typechecked" );
1412
1410
}
1413
1411
1414
1412
virtual Type visitUnresolvedMemberExpr (UnresolvedMemberExpr *expr) {
@@ -3121,6 +3119,17 @@ namespace {
3121
3119
}
3122
3120
}
3123
3121
3122
+ if (auto *dynamicMember = dyn_cast<DynamicMemberRefExpr>(expr)) {
3123
+ if (auto memberRef = dynamicMember->getMember ()) {
3124
+ auto base = skipImplicitConversions (dynamicMember->getBase ());
3125
+ return new (TC.Context ) MemberRefExpr (base,
3126
+ dynamicMember->getDotLoc (),
3127
+ memberRef,
3128
+ dynamicMember->getNameLoc (),
3129
+ expr->isImplicit ());
3130
+ }
3131
+ }
3132
+
3124
3133
if (auto dotIgnored = dyn_cast<DotSyntaxBaseIgnoredExpr>(expr)) {
3125
3134
// A DotSyntaxBaseIgnoredExpr is a static member reference that has
3126
3135
// already been type-checked down to a call where the argument doesn't
Original file line number Diff line number Diff line change
1
+ // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck %s -verify
2
+ // REQUIRES: objc_interop
3
+
4
+ import Foundation
5
+
6
+ @objc class Foo : NSObject {
7
+ let x : Int = 0
8
+ }
9
+ @objc protocol Bar {
10
+ @objc optional var foo : Foo { get }
11
+ }
12
+
13
+ func baz( bar: Bar ) {
14
+ max ( bar, bar. foo? . x ?? 0 )
15
+ // expected-error@-1 {{cannot invoke 'max' with an argument list of type '(Bar, Int)'}}
16
+ // expected-note@-2 {{expected an argument list of type '(T, T)'}}
17
+ }
You can’t perform that action at this time.
0 commit comments