File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -2147,6 +2147,14 @@ TypeVariableBinding::fixForHole(ConstraintSystem &cs) const {
2147
2147
}
2148
2148
2149
2149
if (srcLocator->isLastElement <LocatorPathElt::PlaceholderType>()) {
2150
+ // When a 'nil' has a placeholder as contextual type there is not enough
2151
+ // information to resolve it, so let's record a specify contextual type for
2152
+ // nil fix.
2153
+ if (isExpr<NilLiteralExpr>(srcLocator->getAnchor ())) {
2154
+ ConstraintFix *fix = SpecifyContextualTypeForNil::create (cs, dstLocator);
2155
+ return std::make_pair (fix, /* impact=*/ (unsigned )10 );
2156
+ }
2157
+
2150
2158
ConstraintFix *fix = SpecifyTypeForPlaceholder::create (cs, srcLocator);
2151
2159
return std::make_pair (fix, defaultImpact);
2152
2160
}
Original file line number Diff line number Diff line change @@ -266,3 +266,7 @@ func deferredInit(_ c: Bool) {
266
266
x = " Goodbye "
267
267
}
268
268
}
269
+
270
+ // https://github.com/apple/swift/issues/63130
271
+ let _: _ = nil // expected-error{{'nil' requires a contextual type}}
272
+ let _: _ ? = nil // expected-error{{'nil' requires a contextual type}}
You can’t perform that action at this time.
0 commit comments