File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -8755,8 +8755,17 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyConformsToConstraint(
87558755 if (shouldAttemptFixes() && result.isFailure()) {
87568756 auto *loc = getConstraintLocator(locator);
87578757
8758- if (loc->isLastElement<LocatorPathElt::InstanceType>())
8759- loc = getConstraintLocator(loc->getAnchor(), loc->getPath().drop_back());
8758+ ArrayRef<LocatorPathElt> path = loc->getPath();
8759+ while (!path.empty()) {
8760+ if (!path.back().is<LocatorPathElt::InstanceType>())
8761+ break;
8762+
8763+ path = path.drop_back();
8764+ }
8765+
8766+ if (path.size() != loc->getPath().size()) {
8767+ loc = getConstraintLocator(loc->getAnchor(), path);
8768+ }
87608769
87618770 ConstraintFix *fix = nullptr;
87628771 if (loc->isLastElement<LocatorPathElt::ApplyArgToParam>()) {
Original file line number Diff line number Diff line change @@ -125,7 +125,8 @@ func parameterizedExistentials() {
125125func testNestedMetatype( ) {
126126 struct S : P { }
127127
128- func bar< T> ( _ x: T ) -> T . Type { type ( of: x) }
128+ func bar< T> ( _ x: T ) -> T . Type { }
129+ func metaBar< T> ( _ x: T ) -> T . Type . Type { }
129130 func foo1( _ x: P . Type ) { }
130131 func foo2( _ x: P . Type . Type ) { }
131132
@@ -134,4 +135,5 @@ func testNestedMetatype() {
134135 // Make sure we don't crash.
135136 foo2 ( bar ( S . self) )
136137 foo2 ( bar ( 0 ) ) // expected-error {{cannot convert value of type 'Int' to expected argument type 'any P.Type'}}
138+ foo2 ( metaBar ( 0 ) ) // expected-error {{argument type 'Int' does not conform to expected type 'P'}}
137139}
You can’t perform that action at this time.
0 commit comments