File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -2119,8 +2119,7 @@ Expr *PreCheckExpression::simplifyTypeConstructionWithLiteralArg(Expr *E) {
2119
2119
return nullptr ;
2120
2120
}
2121
2121
2122
- SmallVector<ProtocolConformance *, 2 > conformances;
2123
- return castTy->getAnyNominal ()->lookupConformance (protocol, conformances)
2122
+ return DC->getParentModule ()->lookupConformance (castTy, protocol)
2124
2123
? CoerceExpr::forLiteralInit (getASTContext (), literal,
2125
2124
call->getSourceRange (),
2126
2125
typeExpr->getTypeRepr ())
Original file line number Diff line number Diff line change @@ -533,3 +533,16 @@ func f1_58231(x: Int) -> P_58231 {
533
533
func f2_58231( x: Int ) -> P_58231 ? {
534
534
return S_58231 ( ) // expected-error{{return expression of type 'S_58231' does not conform to 'P_58231'}}
535
535
}
536
+
537
+ // https://github.com/apple/swift/issues/61517
538
+
539
+ protocol P_61517 {
540
+ init ( )
541
+ init ( _: Bool )
542
+ }
543
+
544
+ _ = P_61517 ( ) // expected-error{{type 'any P_61517' cannot be instantiated}}
545
+ _ = P_61517 ( false ) // expected-error{{type 'any P_61517' cannot be instantiated}}
546
+
547
+ _ = P_61517 . init ( ) // expected-error{{type 'any P_61517' cannot be instantiated}}
548
+ _ = P_61517 . init ( false ) // expected-error{{type 'any P_61517' cannot be instantiated}}
You can’t perform that action at this time.
0 commit comments