File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -1993,7 +1993,8 @@ bool TypeVariableBinding::attempt(ConstraintSystem &cs) const {
19931993 // without any contextual information, so even though `x` would get
19941994 // bound to result type of the chain, underlying type variable wouldn't
19951995 // be resolved, so we need to propagate holes up the conversion chain.
1996- if (TypeVar->getImpl ().canBindToHole ()) {
1996+ if (TypeVar->getImpl ().canBindToHole () &&
1997+ srcLocator->directlyAt <OptionalEvaluationExpr>()) {
19971998 if (auto objectTy = type->getOptionalObjectType ()) {
19981999 if (auto *typeVar = objectTy->getAs <TypeVariableType>())
19992000 cs.recordPotentialHole (typeVar);
Original file line number Diff line number Diff line change 1+ // RUN: %target-typecheck-verify-swift -swift-version 5
2+
3+ // https://github.com/apple/swift/issues/58661
4+ class I58661 {
5+ func throwing< T> ( ) throws -> T { // expected-note{{in call to function 'throwing()'}}
6+ throw Swift . fatalError ( )
7+ }
8+
9+ func reproduce( ) {
10+ let check = try ? throwing ( ) // expected-error{{generic parameter 'T' could not be inferred}}
11+ }
12+ }
You can’t perform that action at this time.
0 commit comments