File tree Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -2555,13 +2555,14 @@ namespace {
2555
2555
auto selected = *selectedElt;
2556
2556
switch (selected.choice .getKind ()) {
2557
2557
case OverloadChoiceKind::DeclViaBridge: {
2558
+ base = cs.coerceToRValue (base);
2559
+
2558
2560
// Look through an implicitly unwrapped optional.
2559
- auto baseTy = cs.getType (base)-> getRValueType () ;
2561
+ auto baseTy = cs.getType (base);
2560
2562
if (auto objTy = cs.lookThroughImplicitlyUnwrappedOptionalType (baseTy)){
2561
2563
base = coerceImplicitlyUnwrappedOptionalToValue (base, objTy,
2562
2564
cs.getConstraintLocator (base));
2563
-
2564
- baseTy = cs.getType (base)->getRValueType ();
2565
+ baseTy = objTy;
2565
2566
}
2566
2567
2567
2568
auto &tc = cs.getTypeChecker ();
Original file line number Diff line number Diff line change
1
+ // RUN: %empty-directory(%t)
2
+ // RUN: %build-silgen-test-overlays
3
+ // RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -Xllvm -sil-full-demangle -emit-silgen %s -enable-sil-ownership
4
+
5
+ // REQUIRES: objc_interop
6
+
7
+ import Foundation
8
+
9
+ extension NSString {
10
+ var x : Float { return 0.0 }
11
+ }
12
+
13
+ // note: this has to be a var
14
+ var str : String = " hello world "
15
+
16
+ // Crash when NSString member is accessed on a String with an lvalue base
17
+ _ = str. x
You can’t perform that action at this time.
0 commit comments